Jump to content
  • Advertisement
Sign in to follow this  
chubbc

OpenGL Questions about SDL with OpenGL

This topic is 4174 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, I am sorry if this has already been covered in the forums. I have recently begun learning OpenGL and SDL. I am currently reading the red book and I have found some issues. The book uses Glut which i understand to be a simple windowing system and is an alternative to SDL (correct me if I'm wrong). The guide uses glut features to draw cubes and spheres etc. Am i able to use those features in SDL or does SDL have equivelent features?

Share this post


Link to post
Share on other sites
Advertisement
I use the SDL/OpenGL combination myself and also read the red book to learn OpenGL. There are also PDF versions of the red book online by the way.
Whether the red book uses glut features to draw cube and spheres I can't remember but I don't think so. I think it just uses the GLU library for that which you can use with SDL of course.

Share this post


Link to post
Share on other sites
Yes it actually uses glut for both windowing and draws cubes and spheres with it for testing with lighting and cliping etc. The following is an exmample from the lighting section where it draws a cube:

glutWireCube (0.1);

Is there any way in which i can similarly draw a generic cube for testing on?

Share this post


Link to post
Share on other sites
Ok, i just looked at the PDFs and as you pointed out it really uses GLUT. I learned OpenGL more by reading and then doing my own examples. Drawing a cube is not that difficult, but then drawing a sphere is not too easy either.
You could either switch to GLUT for the examples and then do your own work with SDL or it might also be possible to use those GLUT draw functions without even initializing GLUT itself. So you could try to create the window with SDL but still use glutWireCube as it only makes OpenGL calls which are independant of the windowing system.

Share this post


Link to post
Share on other sites
Ok yea thanks I was going to try that but i cant currently as I'm not on my own computer and what not but yea thank you for the help mate.

Share this post


Link to post
Share on other sites
As said, drawing cubes isn't very hard if you've already gotten to lighting and what-not. Write your own function to do that. It'll be good practice. Making a sphere would be even better practice.

And to let you know, GLUT is old and no longer maintained (the newest version is six years old!). It's only really viable for learning. SDL is a much nicer choice IMO and if you're going to be using it later, learn to use it right now.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!