Hello all,
I’m very new to GLSL, so apologies in advance if any of the stuff below is very elementary
Here are a couple of questions to kick things off (I’m sure there’ll be more ;-))
- When using shaders, do I still need to call glEnable(GL_TEXTURE_2D); ?
Trial and error showed that as long as I glBindTexture, then I can do something like
gl_TexCoord[0] = gl_MultiTexCoord0;
and everything seemed to work fine. Is a glEnable(GL_TEXTURE_2D) necessary?
And now to the more important point!
2) In my fixed func stuff, I used to pass a pointer to my tex coords before calling glDrawElements and then the following code would make sure my texture generation was all good.
const GLfloat sPlane[] = { 1.0f/someVal, 0.0f, 0.0f, 0.0f } ;
const GLfloat tPlane[] = { 0.0f, 0.0f, 1.0f/someVal, 0.0f } ;
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, sPlane);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tPlane);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
Having moved to shaders, passing the same UVs and doing this on the vert shader:
gl_TexCoord[0] = gl_MultiTexCoord0;
doesn’t have the same effect…
This makes sense, I just have no idea how to make my shader work the same way the fixed func stuff used to.
Any help much appreciated.
cheers,
g.