Jump to content
  • Advertisement
Sign in to follow this  
neodingo

OpenGL GLUT, GLX, WGL, etc.

This topic is 4888 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

Alrighty, I am cruising right along through numerous OpenGL tutorials and have
gained a decent understanding of OpenGL.
I use OpenGL because I am a huge fan of cross-platform developement as I use
windows, linux, and solaris myself. So far I have had experience with GL and GLUT,
and GL and WGL.
I guess I am wondering what the best approach to cross-platform OpenGL is. Should
I use GLUT because it does work the same, or should I do a little
#ifdef WIN32 
etc. ? I'm also curious as to the performance of each. I'm sure the differences are
pretty negligible, but it would still be interesting to see the variation.

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
GLUT is good for small demos and stuff, it doesn't have sound or anyway to control system resources ( at least the standard GLUT doesn't).

SDL is a good cross platform library , real easy to use and it works and has support for mostly everything you need in a game.




Share this post


Link to post
Share on other sites
There are several libraries available for developing cross-platform OpenGL applications. You've already mentioned GLUT. Name_Unknown mentioned SDL, which is a good library, but in my opinion it's a bit bloated, and might be more than you actually need. GLFW is a third such library which provides exactly what you need to set up and manage a window and handle input. Personally I prefer GLFW, mostly because of its good documentation.

Take a look at all of them and settle on whatever tickles your fancy.

Share this post


Link to post
Share on other sites
SDL is rather light actually if you ask me, compared to what I consider more heavyweight libs such as Allegro or ClanLib (not sure if ClanLib counts [smile]). SDL provides pretty much the bare minimum of what you cannot do without an API (everything else, i.e. shape drawing is not provided).

That's just my opinion though. Cheers!

Share this post


Link to post
Share on other sites
Runtime performance will not be affected by whether you're using GLUT, using wgl or GLX (or whatever Macs use) directly to create a context, or creating a context with SDL or GLFW.

The opengl calls will be exactly the same, regardless of how the context is created. What's likely to take time is rendering (which will be done the same regardless of context creation) and game logic processing (which is independent of graphics or anything else).

You are only likely to have to call one non-opengl graphics function per main loop, that will be to swap the front & back buffers (GLXSwapBuffers etc), and the same thing always needs to be done on a given platform anyway.

I hope this makes some sense.

Mark

Share this post


Link to post
Share on other sites
Some real good insight here, it's good to get some reinforcement to the idea of different context creation methods negligably(spelling) affecting performance. I thought that it might be as such but wasn't positive.

fyhuang - SDL is quite full-featured actually, OpenGL will handle the primitive drawing that I need, besides, I need 3d primitives, not 2d. Thanks for the suggestion though.

James Trotter - GLFW is quite nice, I've worked with it before but I find its event processing system lacking in the window manager area, understandably these type of events vary widely by platform but SDL seems to handle it quite well. I'll have to to give it another try, as its been a version I think since I used it last, and see if it does what it needs.

markr - Thanks for verifying my thought process, I've been considering just what impacts performance and had come to the conclusion that it can't be that different but lacked the technical reasoning to convince myself.

Rating++ for the timely responses on all.

Thanks again

Share this post


Link to post
Share on other sites
Quote:
Original post by markr
Runtime performance will not be affected by whether you're using GLUT, using wgl or GLX (or whatever Macs use) directly to create a context, or creating a context with SDL or GLFW.

You're entirely right. However, I just thought I'd warn that I've had problems with GLFW being very little responsive. There is often a noticeable lag in the input. I don't know why this is, and I haven't tried to look into the problem yet, but I might at some time or other.

Quote:
Original post by neodingo
James Trotter - GLFW is quite nice, I've worked with it before but I find its event processing system lacking in the window manager area, understandably these type of events vary widely by platform but SDL seems to handle it quite well. I'll have to to give it another try, as its been a version I think since I used it last, and see if it does what it needs.

Since you've already used GLFW, have you had any problems with responsiveness as mentioned above?

Anyway, I'm not sure that there were alot of changes since the last version, but you might want to try anyway. Here's a list that was mentioned in the news section of the GLFW site:

* glfwWaitEvents() (in addition to glfwPollEvents())
* A window close callback function
* A window refresh callback function
* Alpha texture support
* Support for up to eight mouse buttons
* Better Mac OS X support
* Support for Lua and D
* Many bugfixes...

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!