I recently began adventuring into the world of OpenGL 3.3 coming from a background of limited knowledge of OpenGL 1.1. I understand basic texture loading and usage, however, I can’t seem to figure out how to use the texture in my shader. I know it may sound like a stupid question, but I can’t find any resources on how to actually use them. Can somebody give me or link me to an example usage of a GL_TEXTURE_2D texture in a GLSL 3.3 shader?
hi,
the basics are still the same …
- you create a texture
- you fill it with your texture data
- you bind it …
now 2 new thinks come along: - you create a “sampler2d” variable in your shader
- you populate the value of it
somthing like:
glActiveTexture( GL_TEXTURE0 );
glBindTexture ( GL_TEXTURE_2D, textureId );
glUniform1i ( samplerLoc, 0 );
in the shader its like
uniform sampler2D mytexture;
cu
uwi2k2