• Popular Now

• 12
• 12
• 9
• 10
• 13

Archived

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

Scope in OpenGL?

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

Recommended Posts

Hi there, Never tried, but just wondering : can I use scope in OpenGL? Like :
  glRotatef(rotation-rate,x,y,z); glBegin(GL_TRIANGLES); glrotatef(rotation-rate,x,y,z); glBegin(GL_TRIANGLES); //object no. 1 glEnd(); glrotatef(rotation-rate,x,y,z); glBegin(GL_TRIANGLES); //object no. 2 glEnd(); glEnd(); 
Okay, I know this code probably won''t work (cause of GL_TRIANGLES), but it''s just for the idea. Making 2 objects, rotate each of them separately, and then rotate both of the objects as if they where one object. Are such things possible? Thanks!

Share on other sites
You can kind of do what you want (if I understand) like this:
  glRotatef(FirstVal,x,y,z);glPushMatrix(); glRotatef(SecondVal,x,y,z); glBegin(GL_TRIANGLES); // ... glEnd();glPopMatrix();glPushMatrix(); glRotatef(ThirdVal,x,y,z); glBegin(GL_TRIANGLES); // ... glEnd();glPopMatrix();

[Resist Windows XP''s Invasive Production Activation Technology!]