multitexturing problems
hi folks!
i've been off forum for the last year or two, but have been working in OpenGL for over five years now, and as all things go, there've been ups and downs but lately i've come upon a problem i don't know how to solve so i thought maybe some of you will know the answer :)
it concerns multitexturing by blending the textures using glTexEnvi functions...
so here's my problem: when i try to do a multitexturing without using glTexEnvis, i get standard multitextured object (let's say it is a quad), with all of the textures evenly blended together...BUT, when i uncomment those functions all i get is a first texture and no second...
here's my drawing code:
if(t2e){
glActiveTextureARB(GL_TEXTURE1_ARB);
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,textures[1].texID);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB );
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE_ARB );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB_ARB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_TEXTURE );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB_ARB, GL_SRC_COLOR );
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE2_RGB_ARB, GL_PRIMARY_COLOR_ARB );
glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB_ARB, GL_SRC_COLOR );
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT,0,tArray);
}
if(t1e){
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,textures[0].texID);
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2,GL_FLOAT,0,tArray);
}
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,vArray);
glDrawElements(GL_TRIANGLE_STRIP,10,GL_UNSIGNED_INT,vOrder);
glDisableClientState(GL_VERTEX_ARRAY);
glActiveTextureARB(GL_TEXTURE0_ARB);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
now, i've carefuly red through articles by bash: glClientActiveTextureARB() and "Advanced" multitexture - more than two layers... and Bloom's texture splatting article but haven't found anythng wrong with my code so i hope some of you will know what to do...
:)
thanks in advance
follow the yellow brick road
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
This could be the problem?? But i dont know its just the GL_REPLACE is a command
that kinda voids other commands unless its run first... i dont know...
Consider if te2 was applied first and then te1?
This could be the problem?? But i dont know its just the GL_REPLACE is a command
that kinda voids other commands unless its run first... i dont know...
Consider if te2 was applied first and then te1?
----------------------------http://djoubert.co.uk
the thing is that a graphics card works by using texture combinations not in the order they were put down in the code but by tmu's...thus, the first thing applied is GL_TEXTURE0_ARB with GL_REPLACE which means replace TMU's that have been drawed previously (none in this case as TEXTURE0 is the first one) with TEXTURE0...
so i don't think that's the problem, unfortunately :(
but i've tried applying the second texture before the first :)
alas, with no success ....
thanks for the sugestion anyway...
:)
so i don't think that's the problem, unfortunately :(
but i've tried applying the second texture before the first :)
alas, with no success ....
thanks for the sugestion anyway...
:)
follow the yellow brick road
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement