1
\$\begingroup\$

I'm trying to do texture mapping in GLSL 150 and OpenGL 3.3

Here are my shaders I've tried my best to get this correct as possible hopefully this is :)

I'm guessing you want to know what the problem is well my texture shows but not in its fullest form just one section of it not the full texture on the quad.

All I can think of is its the texture cordinates in the main.cpp which is at the bottom of this post.

FRAGMENT SHADER

#version 150


in vec2 Texcoord_VSPS;

out vec4 color;

// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;


//Main Entry Point
void main()
{   

    // Output color = color of the texture at the specified UV
    color = texture2D( myTextureSampler, Texcoord_VSPS );

}

VERTEX SHADER

#version 150

//Position Container
in vec3 position;

//Container for TexCoords
attribute vec2 Texcoord0;

out vec2 Texcoord_VSPS;


//out vec2 ex_texcoord;
//TO USE A DIFFERENT COORDINATE SYSTEM JUST MULTIPLY THE MATRIX YOU WANT




//Main Entry Point
void main()
{ 
    //Translations and w Cordinates stuff
    gl_Position = vec4(position.xyz, 1.0);
      Texcoord_VSPS = Texcoord0;
}

LINK TO MAIN.CPP http://pastebin.com/t7Vg9L0k

\$\endgroup\$
4
  • \$\begingroup\$ Don't you need another glVertexAttribPointer call for your texture coordinate vertex attribute? \$\endgroup\$ Mar 25 '12 at 21:20
  • \$\begingroup\$ I just added it another one with the index 1 and the texture doesn't show correctly still hmm I can't think why ;( \$\endgroup\$
    – RubyKing
    Mar 25 '12 at 21:26
  • \$\begingroup\$ anyone with any helpfull ideas why this is not working ? \$\endgroup\$
    – RubyKing
    Mar 25 '12 at 22:53
  • 1
    \$\begingroup\$ You'd be more likely to get help if you actually put the code into the post, rather than in some link. And of course if you stripped it down to the bare minimum, so that you're not posting a lot of random stuff. \$\endgroup\$ Mar 26 '12 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.