Jump to content
  • Advertisement
Sign in to follow this  
Tree2

Lesson 25 problem

This topic is 4898 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, with lesson 25, is there an easy way to get it implemented correctly with polygons insted of points? Simply changing the gbBegin to GL_POLYGON causes the faces to move in in a spiral motion, rather than connecting the outside vertices. I understand this is is because it is just connecting up the vertices in the order they are in the file, but i would like to know how to make it so the sphere looks how you would expect it to.

Share this post


Link to post
Share on other sites
Advertisement
well, first, you must assume the ferticies are in the correct order (if they are just in some random order, it would be impossible) Assuming they are in the correct order, you cannot just change glBegin to GL_POLYGON, for multiple reasons. The main reason being, GL_POLYGON expects a list ov ferticies which it will turn into a single polygon, and since a sphere is not a single polygon, but an appoximation of a sphere made of many polygons, just calling GL_POLYGON is impossible.

The best solution would be to call GL_TRIANGLE_STRIP then change the for loop so that it calls 2 verticies each time, one on the current circle (the verticies most likely are listed in the file in horizontal circles), and then on on the circle above or below the curent circle.

of coarse, if you just want to draw a sphere, your much better off using quadratics.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!