PDA

View Full Version : Please help me to clear up my confusion about OpenGL.



Kaesebrot
07-15-2015, 01:21 AM
Hi folks,

I tried to get into OpenGL a couple of times now. Everything was clear while I was working in immediate mode. Well I also did understand how vbo's and voa's work. The problem is I find most of the tutorials on the web incoherent. For example a lot of them use functionality which they describe as deprecated. Plus it seems that every tutorial is using different libraries. There are:


GLUT
FreeGlut
GLU
GLFW

So I am pretty confused. My goals are:

Rendering in retained mode
loading and using shaders
loading + displaying meshes created with Blender (or something similar).

Maybe at some point I want to process some user input but this is not my main goal. So I generally have two questions:


What are the libraries I need to achive goals 1 + 2? And can someone point me to a tutorial where loading and using shaders is explained well. Please no NeHe, I am getting confused by those tutorials.
What about Vulkan? Is it worth learning OpenGL right now? When is Vulkan coming out? Will it differ much from OpenGL? I read that it will be even more low level than OpenGL? Or would it be smarter to wait for it instead of deep diving into OpenGL right now?

I would love to learn graphics programming but I do not want it to be DirectX, so I would be very thankful if you give me some advice.

Regards

P.S.: If I get it right OpenGL applications can be implemented in both C and C++, what should be my choice here? I have a feeling that most of the tutorials are in C++? What are the pros and cons here?

GClements
07-15-2015, 02:17 AM
What are the libraries I need to achive goals 1 + 2?

You don't actually need any of those libraries, although a toolkit such as GLUT (original or FreeGLUT or OpenGLUT) or GLFW or SDL will make it easier, particularly if you want to write cross-platform code.

You don't need GLU for anything. Much of its functionality doesn't even work in conjunction with shaders or when using a core profile (which is necessary for OpenGL 3 on Macs).

However, for modern OpenGL, you may want to use GLM for handling matrices.


P.S.: If I get it right OpenGL applications can be implemented in both C and C++, what should be my choice here? I have a feeling that most of the tutorials are in C++? What are the pros and cons here?
OpenGL is a C API, as are most of the libraries (except GLM, which is C++).

When learning, it's probably better to stick to C (or at least C-like code), as this makes it easier to post snippets of code which other people can understand.

Kaesebrot
07-15-2015, 02:23 AM
You don't actually need any of those libraries, although a toolkit such as GLUT (original or FreeGLUT or OpenGLUT) or GLFW or SDL will make it easier, particularly if you want to write cross-platform code.

So of the above mentioned which one would you pick? Which one is most suitable for beginners?

Btw, I also would rather stick to C but like I said, all the tutorials seem to be written in C++ :(

GClements
07-15-2015, 02:36 AM
So of the above mentioned which one would you pick? Which one is most suitable for beginners?
Personally, I use GLUT for experimental code, SDL (or a full GUI toolkit such as GTK, Qt or wxWidgets) for anything which might have actual requirements. GLUT is the simplest but somewhat limited.