OpenGL sky and water texture techno colors

For some reason my water and sky textures change colors in some areas to be almost like a techno rave.

The color spots change randomly.

My sky is just a textured sphere loaded by a 3d model. Other models loaded the same way as the sphere render as they should.

Anyone know why? This runs just fine on Intel and Radeon graphics.

The flickering you describe sounds similar to using uninitialized memory in shaders. I’m guessing something colour related the in the vertex (or geometry) shader, also perhaps something related to a sky camera pass or reflections (in an attempt to explain why it doesn’t happen to other things)?

Here is a video of the problem.

How could I tell where there could be uninitialized memory? I’d assume it would either be in the sky texture or sky data? At least for the sky problems.

My fragment shader is as follows if that helps. Text with underline is the path the sky is using when getting color data.

#version 150
#extension GL_EXT_gpu_shader4: enable
#extension GL_EXT_texture_array: enable

uniform sampler2DShadow ShadowMap;
uniform sampler2D TextureData;
uniform sampler2DArray TextureArrayData;

uniform vec4 AmbientLight;
uniform bool UseLighting;
uniform bool UseTexture;
uniform bool UseTextureArray;
uniform bool UseAlpha;
uniform float ColorAlpha;

in vec4 vColor;
in vec4 LightShade;
in vec4 ShadowCoord;
in vec3 tCoord;

out vec4 FragColor;

void main()
{
vec4 color = vec4(1.0);
float Shadow = 1.0;
if(UseTexture)
{

if(UseTextureArray)
{
color = texture2DArray(TextureArrayData, tCoord.stp);
}
else
{
color = texture2D(TextureData, tCoord.st);
}

	[u]if(UseLighting)
	{
		Shadow = textureProj(ShadowMap, ShadowCoord);
	}

[/u]
if(UseAlpha)
{
color = vec4(color.r, color.g, color.b, ColorAlpha);
}

	[u]FragColor = (LightShade * color) * Shadow + (color * AmbientLight);[/u]
}
else
{
	float Shadow = 1.0;
	if(UseLighting)
	{
		Shadow = textureProj(ShadowMap, ShadowCoord);
	}
	
	if(UseAlpha)
	{
		color = vec4(vColor.r, vColor.g, vColor.b, ColorAlpha);
	}

	FragColor = color * Shadow;
}

}

Sleap, thank you for your input. I believe you are correct. I should be able to solve the problem by myself now, it will just time time.

I finally solved my issue. Again thank you Sleap.

It took some time to find that the bug had to do with the path my shader code took was the path that didn’t use lighting techniques. Anyways Sleap was correct.

If anyone runs into this problem in the future here is how it is caused. A simple demo.

Your vertex shader would be something like this:

#version 150

in vec3 vertexPosition;
out vec4 vertexColor;

void main()
{
if(false)
{
vertexColor = vec4(1.0);
}
}

Your fragment shader would be similar to this

#version 150
in vec4 vertexColor;
out vec4 FragColor;
void main()
{
FragColor = vertexColor;
}

Since vertexColor never gets set in the previous shader to a value you will have random colors as shown in the video.

This thread can be locked if there is a moderator on the forum.