Questions about SDL with OpenGL

Started by
4 comments, last by Ezbez 16 years, 9 months ago
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?
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.
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?
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.
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.
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.

This topic is closed to new replies.

Advertisement