PDA

View Full Version : Using GL ES 1.x, how do I combine with modulate2x ?



idrise
10-10-2011, 06:54 AM
Hi

I am trying to support OpenGL ES 1.0 in an existing engine and I need the vertex colour to scale the texture with modulate 2x.

IE Vertex color 128,128,128 combined with texture of 216,216,216 would result in 216,216,216 Vertex color of 255,255,255 combined with texture of 216,216,216 would cap and result in 255,255,255.

I have tried this code and it has no effect.


glActiveTexture(GL_TEXTURE0 );
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0f);

The directX code that I am trying to port is...


hr = IDirect3DDevice7_SetRenderState(
direct3d_device, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
hr = IDirect3DDevice7_SetTextureStageState(
direct3d_device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
hr = IDirect3DDevice7_SetTextureStageState(
direct3d_device, 0, D3DTSS_COLOROP, D3DTOP_MODULATE2X);
hr = IDirect3DDevice7_SetTextureStageState(
direct3d_device, 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
hr = IDirect3DDevice7_SetTextureStageState(
direct3d_device, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
hr = IDirect3DDevice7_SetTextureStageState(
direct3d_device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);

I couldn't add diffuse to glTexEnvi(GL_TEXTURE_ENV

Any idea how to get this effect ?

Dave