Hi all I'm trying to do texture mapping GLSL 150.
The problem is the texture shows but has this weird flicker I can show a video here
<object width="425" height="350"> <param name="movie" value="http://www.youtube.com/v/xbzw_LMxlHw"></param> <param name="wmode" value="transparent"></param> <embed src="http://www.youtube.com/v/xbzw_LMxlHw" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"> </embed></object>
and I have everything setup best I can
have my texcords in my vertex array sent up to opengl
I have my fragment color set to the texture values and texel values I have my vertex sending the textures cords to texture cordinates to be used in the fragment shader I have my ins and outs setup and I still don't know what I'm missing that could be causing that flicker.
here is my code
Fragment Shader
Code :#version 150 //orginally 130 //orginally 110 //Texture Uniform Sampler 2D Container uniform sampler2D texture; in vec2 texture_coord; varying vec3 texture_coordinate; //Main Entry Point void main(void){ //To Tell GLSL The Texture and Texture Coords texture cords is the position gl_FragColor = texture(texture, texture_coord); //vec4(1.0, 0.0, 0.0, 1.0); //gl_FragColor = vec4(texture_coordinate.xy, 0.0, 1.0); }
vertex shader
Code :#version 150 //Always use a attribute vec4 for position variable in vec4 position; //Matrix 3 x 3 row //mat4 projection; //Texture Cordinates 2 element vector of varying type //attribute vec2 texture_coordinate; out vec2 texture_coordinate; out vec2 texture_coord; //Translations 3 element vector uniform uniform vec3 translations; //Projection Matrix //mat4 projection = mat4( // vec4(1.0, 0.0, 0.0, 0.0), // vec4(0.0, 1.0, 0.0, 0.0), // vec4(0.0, 0.0, 1.0, 0.0), // vec4(0.0, 0.0, 0.0, 1.0)); //Main Entry Point void main() { //Passing The Texture Coordinate of Texture Unit 0 To The Fragment Shader texture_coord = (texture_coordinate); // To Put The Vertex in View? //ORGINALLY 8.0 gl_Position = vec4(position.xyz + translations.xyz, 1.0); }
Oh and here is my vertex array with texture cordinates
Code :// X //y //z //u //v GLfloat vVerts[] = { 0.5f, 0.5f, 0.0f, 0.0f, 1.0f , 0.0f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f}; //tex x and y
thank you for your help



