Is there an OpenGL equivalent of D3DTSS_TEXCOORDINDEX ?

Hyp-X

New member
I'm porting an engine from D3D to OpenGL, but I have can't find in the docs if there's an equivalent for D3DTSS_TEXCOORDINDEX in OpenGL.

The idea is, I have one set of texture coordinates for the mesh, but I want to use it at two texture stages.
In D3D this can be done with:
pD3DDev->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0);

The workaround I can think of is using "glTexCoordPointer" for both stages with the same address, but it really complicates code.
(Setting up data sources and setting up render states are separated in the code, and for a good reason.)
And I don't know how well it will work out on the long run if I want to support VAOs.

Btw, D3DTSS_TEXCOORDINDEX can also enable TexGen. Looking at the docs I can't find the equivalent of D3DTSS_TCI_CAMERASPACENORMAL. Is there such a thing in OpenGL?
 
So basicly you want to share one texture coord set across two texturing units? With standard OpenGL, I don't think you can with out assigning it to both (as you said), but with a vertex program (ARB_vertex_program) you could use that to spread out the one set to the other units (the down fall here is that it uses an extension that still isn't widely supported).
 
Right I want that.

Yes I know it can be done with vertex shaders, but I'd like to have a solution which works with DX7 level hardware.

I'll do the workaround - it won't be easy to do it in the genaral case. But at least it will be ugly.
 
Back
Top