Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

share|improve this question
    
Don't you need another glVertexAttribPointer call for your texture coordinate vertex attribute? –  John Calsbeek Mar 25 '12 at 21:20
    
I just added it another one with the index 1 and the texture doesn't show correctly still hmm I can't think why ;( –  RubyKing Mar 25 '12 at 21:26
    
anyone with any helpfull ideas why this is not working ? –  RubyKing Mar 25 '12 at 22:53
1  
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. –  Nicol Bolas Mar 26 '12 at 1:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.