Jump to content
  • Advertisement

Archived

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

NaliXL

Scope in OpenGL?

This topic is 6065 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 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 this post


Link to post
Share on other sites
Advertisement
No, because you can only use a subset of OpenGL commands between glBegin and glEnd. You can have OpenGL "remember" previous states (though not for the drawing mode as in your example), using the glPush* and glPop* commands. This is particularly useful for matrices.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!