Archived

This topic is now archived and is closed to further replies.

celic

glDrawElements with multitexturing

Recommended Posts

I need to render a textured object then apply envirnment mapping. I can`t use multitexturing because I use glTexCoordPointer(). help me please. thanks.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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*

Share this post


Link to post
Share on other sites
quote:
It will be restored "when it''s done"

LAUGHING OUT LOUD

''k, then you can skip my point #1 even though this is still a good suggestion for forums where the search feature is available (like at opengl.org)

Share this post


Link to post
Share on other sites