glDrawElements with multitexturing
I need to render a textured object then apply envirnment mapping.
I can`t use multitexturing because I use glTexCoordPointer().
help me please.
thanks.
celic
Use two tex coord arrays and set pointers for each texture unit:
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(3, GL_FLOAT, 0, @texturearray1);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(3, GL_FLOAT, 0, @texturesarray2);
That should do it
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(3, GL_FLOAT, 0, @texturearray1);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(3, GL_FLOAT, 0, @texturesarray2);
That should do it
______________________________DGDev - The Delphi Games Development Community
1. this question has been answered several times before. Please search the forums before asking the question.
2. the answer already resides in OpenGL specifications - the very least document you should have if you want to work with OpenGL.
3. there is a reply on your topic at opengl.org forums
4. yes BlueCat solution works even though I would add glEnableClientState(GL_TEXTURE_COORD_ARRAY) for each texture unit
5. for environment mapping, there is another solution that does not use the glTexCoordPointer for the second texture unit : map the texture coordinates 'automatically' using GL_SPHERE_MAP.
For the fifth point, you can do something like this :
glClientActiveTextureARB(GL_TEXTURE0_ARB); // or glActiveTextureARB(GL_TEXTURE0_ARB) if all your texture coordinate pointers are used in the first texture unit.
glTexCoordPointer(...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glActiveTextureARB(GL_TEXTURE1_ARB);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
[edited by - vincoof on October 16, 2002 1:11:16 PM]
2. the answer already resides in OpenGL specifications - the very least document you should have if you want to work with OpenGL.
3. there is a reply on your topic at opengl.org forums
4. yes BlueCat solution works even though I would add glEnableClientState(GL_TEXTURE_COORD_ARRAY) for each texture unit
5. for environment mapping, there is another solution that does not use the glTexCoordPointer for the second texture unit : map the texture coordinates 'automatically' using GL_SPHERE_MAP.
For the fifth point, you can do something like this :
glClientActiveTextureARB(GL_TEXTURE0_ARB); // or glActiveTextureARB(GL_TEXTURE0_ARB) if all your texture coordinate pointers are used in the first texture unit.
glTexCoordPointer(...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glActiveTextureARB(GL_TEXTURE1_ARB);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
[edited by - vincoof on October 16, 2002 1:11:16 PM]
The search feature is temporarily disabled while we patch some security holes in it. We apologize for any inconvenience.
Please don''t email us asking when the search will be back up. It will be restored "when it''s done"
*g*
Please don''t email us asking when the search will be back up. It will be restored "when it''s done"

*g*
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement