PDA

View Full Version : DX => GL



M109uk
25-11-2003, 02:57 PM
Hi all,

Im not sure if to post this in DX or GL but i am trying to figure out what the following DX commands are in GL ::

D3DDEV8.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DDEV8.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);

D3DDEV8.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DDEV8.SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
D3DDEV8.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
d3ddev8.SetTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
d3ddev8.SetTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);

d3ddev8.SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
d3ddev8.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

And im guessing this one sets a global material setting or something ::

m.Diffuse.r:=1;m.Diffuse.g:=1;m.Diffuse.b:=1;m.Dif fuse.a:=1;
m.Ambient:=m.Diffuse;
m.Specular:=m.Diffuse;
m.Emissive:=m.Diffuse;

d3ddev8.SetMaterial(m);

Thanx for any help....

Alimonster
25-11-2003, 03:36 PM
I'm just guessing myself here, but they should mostly be a combination of glTexEnvi and glTexParameteri...


D3DDEV8.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DDEV8.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);

The first one may well be about blending here. The first parameter in all these calls will probably be the texture unit affected by the change. You may well have to use extensions (multitexturing etc) to get the full effect. The modulate will be a glTexParameteri call I think.


D3DDEV8.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DDEV8.SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_CURRENT);
D3DDEV8.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_MODULATE);
d3ddev8.SetTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
d3ddev8.SetTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
The clamp ones are dealt with by glTexEnvi and GL_TEXTURE_WRAP_S + GL_TEXTURE_WRAP_T I believe. The modulate one is a glTexParameteri call, with the above ones maybe(?) being blending again.


d3ddev8.SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);
d3ddev8.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
These two are glCullFace or glFrontFace (not sure which from the above tho, probably glFrontFace). Also glEnable/disable(GL_CULL_FACE), I'd guess.

I'm not sure about the material one though. Sorry I couldn't be more helpful here (I've not used d3d myself), but hopefully someone else will help out.

M109uk
26-11-2003, 02:07 AM
I had a go at trying to find similar functions and variables in the Gl unit, and then started to see double :?

I kinda guessed that D3DTOP_MODULATE was a texture call, but i just was'nt sure because of the D3DTSS_COLOROP!?

I copyed them from a lightmapping source, it basicly generates the lightmaps and then renders them (of course) but my copy doesnt seem to be working very well :(

I might be coming from the wrong angle though, would any of these functions/calls have any effect on calculating the lightmaps? Because the only difference that i can think of is these calls (and of course the way the data is stored, but im pretty sure thats not the problem)!?



Sorry I couldn't be more helpful here (I've not used d3d myself), but hopefully someone else will help out.

Your help is still very much appreciated :D