Archived

This topic is now archived and is closed to further replies.

Help with texture rotation

This topic is 4941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m trying to rotate a texture and apply it to an object. The code is the following: code: -------------------------------------------------------------------------------- cgGLEnableTextureParameter( g_CGparam_steam_animation );cgGLSetTextureParameter( g_CGparam_steam_animation, heat_effect_textures.texID);glMatrixMode(GL_TEXTURE);glLoadIdentity();glRotatef(rot,0, 0, 1);glMatrixMode(GL_MODELVIEW);Draw_Object();cgGLDisableTextureParameter( g_CGparam_steam_animation ); -------------------------------------------------------------------------------- Funny thing happens: ALL the textures rotate except the one that i want.

Share this post


Link to post
Share on other sites
I made some improvements but i really need some help. Here is the code:


code:
--------------------------------------------------------------------------------

glActiveTextureARB( GL_TEXTURE0_ARB );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, textures[95].texID); // this is the first texture to rotate
glActiveTextureARB( GL_TEXTURE1_ARB );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, heat_effect_textures[heat_texture_counter].texID); // this is the second one
cgGLBindProgram( g_CGprogram_vertex );
cgGLBindProgram( g_CGprogram_pixel );
cgGLEnableProfile( g_CGprofile_vertex );
cgGLEnableProfile( g_CGprofile_pixel );
cgGLEnableTextureParameter( g_CGparam_testTexture );
cgGLSetTextureParameter( g_CGparam_testTexture, VolumeTexture1 );
cgGLEnableTextureParameter( g_CGparam_testTexture2 );
cgGLSetTextureParameter( g_CGparam_testTexture2, BlurTexture);
cgGLEnableTextureParameter( g_CGparam_testTexture3 );
cgGLSetTextureParameter( g_CGparam_testTexture3, textures[30].texID);
glBegin(GL_TRIANGLE_STRIP);
glMultiTexCoord2fARB( GL_TEXTURE0_ARB,fTexMul4x * (x+ quad_ext)+x_tex,y_tex+ fTexMul4y * (y + quad_ext+quad_ext_sub)-.19);
glMultiTexCoord2fARB( GL_TEXTURE1_ARB,fTexMul4x * (x+ quad_ext)+x_tex,y_tex+ fTexMul4y * (y + quad_ext+quad_ext_sub)-.19);
glVertex2f(x, y+quad_ext_sub-82);
glMultiTexCoord2fARB( GL_TEXTURE0_ARB,fTexMul4x * (x+ quad_ext)+x_tex, y_tex+ fTexMul4y * (y+quad_ext)-.19);
glMultiTexCoord2fARB( GL_TEXTURE1_ARB,fTexMul4x * (x+ quad_ext)+x_tex, y_tex+ fTexMul4y * (y+quad_ext)-.19);
glVertex2f(x, y-82 );
glEnd();
glActiveTextureARB( GL_TEXTURE1_ARB );
glDisable(GL_TEXTURE_2D);
glActiveTextureARB( GL_TEXTURE0_ARB );
cgGLDisableTextureParameter( g_CGparam_testTexture );
cgGLDisableTextureParameter( g_CGparam_testTexture2 );
cgGLDisableTextureParameter( g_CGparam_testTexture3 );

--------------------------------------------------------------------------------

All the textures are correctly rendered, but the ones binded through the glActiveTextureARB call are not rotated.
The problem seems to occur when i enable the vertex and fragment programs with cgGLEnableProfile. Otherwise, if i disable the shader, the two textures are correctly rotated (but of course the shader is off) . I don''t know how to solve this, so any help is GREATLY appreciated.

Share this post


Link to post
Share on other sites