PDA

View Full Version : Texture Image Scaling In GLSL Vertex Shader



Rennie Johnson
11-11-2011, 11:11 AM
1) Is there sample code that will enable me to duplicate these OpenGL drawing commands in a Vertex Shader:

glTranslatef();
glRotatef();
glScalef();

2) How can I translate GL_TEXTURE_2D textures in X/Y direction within a Vertex shader by referencing the number of actual pixels I want to offset, instead of using normalized (0-1) coordinates?

Thanks.

Alfonse Reinheart
11-11-2011, 12:27 PM
Is there sample code that will enable me to duplicate these OpenGL drawing commands in a Vertex Shader:

Those commands modify OpenGL state. You can't do that from a vertex shader.

You can create matrices (which is the kind of state that they modify). But you can find the matrices these generate online via the man pages (http://www.opengl.org/sdk/docs/man/).

Rennie Johnson
11-11-2011, 01:14 PM
Thanks Alfonse. Can you point me to the page or functions I should look at? I'm very new at Vertex Shaders. I'm trying to get away from pipeline stuff, and most of my experience in in fragment shaders.

Thanks.