How to setup my texture cordinates correctly in GLSL 150 and OpenGL 3.3?

Posted by RubyKing on Game Development See other posts from Game Development or by RubyKing
Published on 2012-03-25T21:08:44Z Indexed on 2012/03/25 23:42 UTC
Read the original article Hit count: 168

Filed under:

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

© Game Development or respective owner

Related posts about glsl