PDA

View Full Version : CVA and multitexturing



owcs
06-17-2002, 06:18 PM
Hey guys,

I am rendering a terrain using cva and multitexturing it. Any ideas why the second texture doesn't seem to show? Thanks in advance

if (glLockArraysEXT)
{
glLockArraysEXT(...);
}

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertex);

glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, color);

glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_INDEX_ARRAY);
glDisableClientState(GL_EDGE_FLAG_ARRAY);

glClientActiveTextureARB(GL_TEXTURE0_ARB );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture1);

glClientActiveTextureARB(GL_TEXTURE1_ARB );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture2);

glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_CO MBINE_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB,2);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, 0,texCoord1);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2, GL_FLOAT, 0,texCoord2);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

for (...)
{
glDrawElements(...);
}

glClientActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);

glClientActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);

if (glUnlockArraysEXT)
glUnlockArraysEXT();

[This message has been edited by owcs (edited 06-17-2002).]

[This message has been edited by owcs (edited 06-17-2002).]

dorbie
06-18-2002, 12:08 PM
First try a simple texenv like MODULATE on unit two to test stuff then reenable the combiners. I'm not sure about the defaults but you need to ensure the combiners have the correct operands and operators. You don't seem to set any of this except to scale the result by two.

You'd want to set your source operands to previous and texture for args 0 and 1 (surely the default) and then choose your operand, try a modulate just as a test.

For terrain I expect you ultimately want to use all 3 operands and an interpolate operator with arg 2 getting input from primary color, args 0 and 1 remain as above.

Or something like that.

[This message has been edited by dorbie (edited 06-18-2002).]

owcs
06-18-2002, 04:47 PM
nope. changing the texenv to GL_MODULATE still didnt help at all. the 2nd texture is still missing. any idea why?

btw how do you set the source operands,the textures and the operand? i am very new at this and i know very little about combiners. thanks again




[This message has been edited by owcs (edited 06-18-2002).]