What 3d graphic library to use?

Started by
7 comments, last by warcod3 10 years, 8 months ago

I just started making a game in visual c++ using glut. People say everywhere that glut is not suited for game development, and it is too old.

-I really want to know what are glut's limitations, why is it so bad for game development. I like using it, but it is the only 3d library I tried so I can't compare.

-And I also would like to know how large is the gap between opengl and directx in terms of performance,

-and how hard would it be to learn directx after using glut. (I don't need a library that's cross-platform, I need a lib that works good in windows.)

If you don't mind, please suggest some libraries which you know are good.

Advertisement

GLUT is just a utility library for OpenGL. You can do OpenGL without Glut at all (forget on Linux, but on Window's you just make a normal Win32 Window and put an OpenGL context in it using a few Microsoft wgl_ functions). A GLUT like library is Freeglut, another alternative is SDL and there are many more.

On the non-game orientated side, things like wxWidgets can also give you OpenGL for a window (with all their normal windowing capabilities like events, dialogues, layingout multiple child windows, just with gl* stuff to draw that part of the window).

Direct3D is like OpenGL (and not GLUT, I guess the GLUT equivalent is DXUT?) although for Microsoft platforms only, and similarly to OpenGL on the desktop you just take a normal Win32 Window and use D3D to render into it.

Then their is the higher level stuff like Ogre3D, which can do almost all the 3D rendering work for you, and higher still you have complete game engines which can all save a lot of time and effort depending on what you want.

please suggest some libraries which you know are good


If you just want to display 3D, a lot of libraries/engines do that well. As a free solution, try Irrlicht.

Is it more performant than using glut?

A while back I did A Modern OpenGL Resource Roundup, including links to the various GL libraries. There are also a ton of links that might help with your knowledge of OpenGL in general. I would recommend starting there.

I assume you are looking for a cross platform library to handle the stuff OpenGL doesnt ( Windowing, IO ). In that case, GLFW and freeGLUT are probably the most commonly used, although SDL or SFML can be used.

GLUT is just a utility library for OpenGL. You can do OpenGL without Glut at all (forget on Linux, but on Window's you just make a normal Win32 Window and put an OpenGL context in it using a few Microsoft wgl_ functions). A GLUT like library is Freeglut, another alternative is SDL and there are many more.

Ever heard of GLX + XLib? Works without glut. Glut isn't Linux domain either, and there is like a ton of way doing it:

Standard XLib + GLX (all in all each implementation running on X does this in the end)

GTK+ with GDK and OpenGL

Qt and QtGL

and tons of others...

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

I wasn't saying you need GLUT on Linux I was saying the opposite, that GLUT is only a utility library and never compulsory, just said I could not recall what the Linux low level OpenGL stuff is (e.g. like the Microsoft wgl functions, which as far as I am aware GLUT/QT/wx/etc have to ultimately use to get a Win32 window with OpenGL, or even a fullscreen Window)

Is it more performant than using glut?

The problem with GLUT is not strictly performance related, it is design related.

GLUT takes full control of your game loop and while that is fine for simple examples where the focus is on demonstrating or teaching OpenGL concepts its just not that suitable for games.

freeGLUT and QT have the same problem (QT is great for GUI applications though), you can hack around the gameloop stealing in both QT and freeGLUT but unless you really want other features provided by those libraries it is not worth the effort.

SDL, GLFW and SFML are all solid cross-platform options to use with OpenGL. (I'd recommend against using Win32 or X11 directly since those APIs are pretty darn painful to use and X11 might be replaced by Wayland or Mir on Linux in the near future anyway)

As for D3D vs OpenGL performance: it depends.

For old versions of the APIs(OpenGL 1.x, D3D<=8) it really doesn't matter, use something more modern, neither is suitable for modern hardware.

For semi-old versions of the APIs (OpenGL 2.x and D3D9) You have less API overhead with OpenGL (and thus you can possibly get slightly better performance with it unless your GPU manufacturer has bad OpenGL drivers (Intel GPUs will most likely perform better with D3D9 than with OpenGL 2.x)

For modern versions of the APIs (OpenGL 3.x/4.x and D3D10/11) the difference is pretty much all in the drivers, nvidias drivers are of equivalent quality for both APIs, Intels are quite a bit better for D3D, not sure how AMD stand today.

Personally i wouldn't worry too much about performance at this point though, the skills transfer between the APIs and by the time you're at a stage where every last microsecond counts the APIs and possibly also the market will be different from what they are today.

Also: Direct3D only works on Microsofts platforms, everyone else either uses OpenGL(Mac,Linux,Solaris,BSD), OpenGL:ES(Android,iOS) or some proprietary hardware specific API(Sony and Nintendo consoles), to hit all major platforms you will be forced to use several different APIs anyway.

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Thank you for your posts. I am trying now irrlicht, and in the far future maybe Ogre. Simon, I just thought the maximum perormance of the libraries vary more, that's why I asked. But as you said, I probabbly won't need that last milisecond that much. Thanks for the library suggestions. :)

This topic is closed to new replies.

Advertisement