Opengl 3.3 load & display texture

Started by
19 comments, last by PrestoChung 13 years, 2 months ago
Can anyone recommend a tutorial on loading and drawing textures that might include sample code in an OpenGL 3.3 core context?
Advertisement
Loading textures has not changed in GL3

http://www.opengl.org/wiki/Tutorials
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

Loading textures has not changed in GL3

http://www.opengl.org/wiki/Tutorials


Hmm I don't find the glTexEnv function in GL3

Hmm I don't find the glTexEnv function in GL3


glTexEnvi is deprecated post gl 3.0.
another thing I've noticed is glEnable(GL_TEXTURE_2D),
GL_TEXTURE_2D is no longer a valid enum

another thing I've noticed is glEnable(GL_TEXTURE_2D),
GL_TEXTURE_2D is no longer a valid enum


As no longer fixed function pipeline, the GL_TEXTURE_2D (and the others) flag is pointless.
glDisable(GL_TEXTURE_2D) = dont send to the shader. :)

another thing I've noticed is glEnable(GL_TEXTURE_2D),
GL_TEXTURE_2D is no longer a valid enum



'sk8beast' said:


another thing I've noticed is glEnable(GL_TEXTURE_2D),
GL_TEXTURE_2D is no longer a valid enum


As no longer fixed function pipeline, the GL_TEXTURE_2D (and the others) flag is pointless.
glDisable(GL_TEXTURE_2D) = dont send to the shader. :)



Just to clarify this quote, glEnable/glDisable(GL_TEXTURE_2D) has no effect on shader pipeline. When you have a sampler at location 0, it will always sample the texture bound to glActiveTexture(GL_TEXTURE0), regardless of the enabled state of GL_TEXTURE_2D.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
O-o I need to post some code to remain sane...tell me if you see anything obviously wrong

Initialization functions

Loading Vbo & Texture


Drawing and shader source
If you post that inline with code tags or on codepad I'd consider taking a look at it, but I'm currently on a VPN which doesn't allow access to filesharing sites for security reasons. There's really no reason why you need to have people your download your files, just post the relevant parts.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Initialization functions
http://codepad.org/N6G4L0mO
Loading vbo & texture
http://codepad.org/txCRarG5
Drawing + shader source
http://codepad.org/78ylAPSm

This topic is closed to new replies.

Advertisement