Jump to content
  • Advertisement

Archived

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

wamingo

rotating texture maps?

This topic is 5603 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

hi all! Could you help a newbee (me) rotate texture maps please? I''ve searched the net up and down and found some, but none of it seems to work for me (doing it wrong probably)... Even messed with trigonometry but it seems I must have slept during my once long-ago math classes I''ve managed to load up the uv coordinates from the ASE format like this (simplified and snipped down a single point in a triangle): glTexCoord2d( uvmap[0].u , uvmap[0].v ); glVertex3f ( ver[0].x , ver[0].y , ver[0].z ); what I want is to rotate the UVmap, lets just say 45 degrees... I need to use glMatrixMode(GL_TEXTURE); is that right ? but how? something like this:?? glMatrixMode(GL_TEXTURE); glRotatef( 45, 0 , 0 , 1 ) glTexCoord2d( uvmap[0].u , uvmap[0].v ); glMatrixMode(GL_MODELVIEW); glVertex3f ( ver[0].x , ver[0].y , ver[0].z ); of course this isn''t it or I wouldn''t be asking... please assist

Share this post


Link to post
Share on other sites
Advertisement
That should work.

// setup model transform
glMatrixMode(GL_MODELVIEW);

// setup texture transform
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadIdentity(); // might not need this if your sure it is already identity
glRotatef(45.0,0,0,1); // rotate around z axis (ie x(u),y(v) are affected)

glBegin(GL_WHATEVER);
glTexCoord2f(u1,v1);
glVertex3f(x,y,z);

...

glEnd();

glPopMatrix(); // restore texture matrix

Share this post


Link to post
Share on other sites
just know that using a texture matrix can more than half your fillrate and/or vertex throughput (depending on the video card). So don''t use it just because you can.

| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |

Share this post


Link to post
Share on other sites
I''ve seen graphs showing vertex througput on quadros before, the hit was around 50% when using texture matrices. but of course quadros arn''t exactly cutting edge. And if your not transform limited anyway, well, it don''t matter too much now does ett?

| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |

Share this post


Link to post
Share on other sites
I''ve seen that graph too, and it''s not representative of the total time, just of the GPU part. I''ve seen the same graph (for GeForce) where the CPU part was taken in account, and texgen was faster because with texgen the CPU has nothing to do.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!