PDA

View Full Version : GL_TEXTURE_ENV_COLOR does not change in run-time



Alexded
09-02-2004, 03:12 AM
When i use

glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color );its affect on fragments color only when called first time. For example, i have two functions:

//texture prepare function
{
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE );
}
//rendering function
{
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_vertexBufferID );
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_indexBufferID );

glVertexPointer( COORD_PER_VERTEX, GL_FLOAT, 0, (char *)NULL );
glNormalPointer( GL_FLOAT, 0, (char *)NULL + m_verticesQuantity * COORD_PER_VERTEX * sizeof( float ) );
glTexCoordPointer( COORD_PER_TEXTURE, GL_FLOAT, 0,
(char *)NULL
+ m_verticesQuantity * COORD_PER_VERTEX * sizeof( float )
+ m_verticesQuantity * COORD_PER_NORMAL * sizeof( float )
+ m_verticesQuantity * COORD_PER_TEXTURE * sizeof ( float ) );
glDrawRangeElements( PRIMITIVE_TYPE, startIndex, endIndex, count, dataType, ( INDEX_TYPE* )NULL + startIndex );
}when i call these functions, binded texture is applying on the geometry. This work correct.
Also, i have third function, where i change GL_TEXTURE_ENV_COLOR and source for operand0:

changeColor( int c )
{
const GLfloat cf[] = { cg, cg, cg, cg };
glTexEnvfv( GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, cf );
glTexEnvf( GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT );
}when i call changeColor( c0 ) i suppose, that instead texture i will see colored triangle. When i use this function first time, it works correct. Triangle color became c0. But when i call this function second time with another color, nothing changes. Triangles color stays c0, but i've just called changeColor( c1 ). What is wrong?

Hampel
09-02-2004, 05:51 AM
This seems to be the driver bug for NVidia GeForce FX level hardware described here: Topic: GL_CONSTANT bug in 56.64? (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011742) It has been fixed in one of the newer drivers...

Alexded
09-02-2004, 06:32 AM
Thanks a lot Hampel. You save my life. My boss wanted to kill me.