OpenGL and the Libraries

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

OpenGL and the Libraries

Postby metallicsoul92 on Sun Mar 29, 2015 5:03 pm

Can someone explain to me the differences between each library? Such as :
1. GLFW
2. GLEW
3. GLUS
4. GLU
5. GLUT


Like, are all of these necessary for one application? Or can i pick between which one i want to use.
metallicsoul92
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 7
Joined: Sun Mar 08, 2015 12:31 am

Re: OpenGL and the Libraries

Postby tommyg on Mon Mar 30, 2015 6:17 am

Alright! Short answer - you don't need any of them. Only use one if it does something that you need and don't really want to be bothered with writing yourself. and you should try to use as few as possible (well, loads of small ones would be better than one really big one, but you know what i mean) but i suppose this only really matters on resource limited systems - but you should definitely do it if you're gonna release it.

anyway..

to make something that uses opengl to display something on screen, you need to:-

make a window, or get full screen, get an opengl context, and use it. (for all of which, using a library is sensible, especially if you want to do it cross platform - i use sdl2 for this on anything new). (i think that glfw does this too, amongst other things?)

if you want to use any opengl extensions at all (and you really should these days, to use shaders and such) - then you need to either get them all yourself through opengl (which looks like a big complex thing that you may want to save for later - if you do it yourself at all) or use a library. i use glew for this.

if using fixed function drawing (like in the old nehe tutorials, or any old tutorials), you need to make a matrix and send to the graphics card - using glOrtho for orthographic projection, or something from a library for a perspective projection (or make it yourself if you understand matrices). you probably shouldn't use fixed function drawing nowadays though. but you can do what you want.. (i believe that glut or glu does this, amongst other things...)

load a graphic image if you're doing anything textured (and who isn't?), decompress it if it is compressed (and i guess you may be using png, which is), and upload to graphics card - also seems sensible to use a library, though some uncompressed image formats may be easy enough to write your own thing for - you would still need to make use of some file i/o library if you're doing this - and again, take note of cross platform stuff. (i use SOIL for this purpose - you can use sdl2's file io, or use soil's - using sdl2's i guess that this should be as cross platform as sdl2 is) - i think that glut does this (or it could be glu, but i haven't used them)

get input from a joypad - again, a library is sensible (i use sdl2).
tommyg
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 3
Joined: Wed Mar 11, 2015 6:00 am

Re: OpenGL and the Libraries

Postby rocklobster on Thu Apr 02, 2015 12:25 am

I've been out of the OpenGL dev for about 6 months now but from what I remember I only used GLFW and GLEW out of that list.

GLFW will handle things for you such as creating/managing a window and capturing raw input (keyboard/mouse events) and setting up your OpenGL Context.
GLEW is necessary if you want to use modern OpenGL features. The short story is that windows only supports an old version of OpenGL so you have to use this extension lib to get the new stuff.

GLFW can replace GLUT entirely (more modern equivalent)
Haven't looked into GLUS.
GLU: https://www.opengl.org/archives/resourc ... al/glu.htm - basically provides some higher level functionality for OpenGL. You may or may not want to use this.

Also I'd recommend looking into a math library such as GLM.
rocklobster
Chaos Rift Newbie
Chaos Rift Newbie
 
Posts: 1
Joined: Thu Apr 02, 2015 12:16 am


Return to Programming Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron