OpenGL

Hello everyone. I have a question about 3d development having made my own 2D engine without any dependencies. I took a look at many alternatives so as to create my own 3d engine. Usually I like Unity with which I made many games in the past, but I would like to increase my C++ understanding. SDL2 is really interesting and powerful, Vulkan seems cool too, but I prefer for some reasons OpenGL - the latest version. OpenGL is old, deprecated since they released Vulkan. If I create something using OpenGL, do you think that I am losing my time? Who is developing those days something solid with OpenGL ? Thank you for your advice ++
Last edited on
Well for starters it is better to learn OpenGL 1st since it takes care of a lot of things under the hood that would easily make the learning process a lot harder if you had to take care of them also, it makes things easier if you only need to concern yourself with learning to actually produce graphics before learning to deal with hardware quirks that vulkan exposes.

I will add this tidbit since I'm learning opengl myself, it has a few confusing things, like vertex attribute arrays vs vertex buffer arrays, the attribute arrays are normally referred to as layouts in guides but I've found they're easier to understand if I think of them as scoped configurations (or just plain scopes).

Then there's uniform structures, it wasn't until recently I figured out how they are supposed to be filled, using the same functions you would for individual uniforms, like this:

Shader:
1
2
3
4
5
6
7
8
...
uniform int screen_width;
uniform struct UNIFORMS
{
	int Screen_width;
	int Screen_height;
} uniforms;
...

Rough find & fill (forgot the functions, the below ones are just rough examples of what kind of input/output to expect of the correct ones)
1
2
3
4
5
6
7
...
int loc_screen_width = glFindUniform( program_id, "screen_width");
int loc_UNIFORMS = glFindUniform( program_id, "UNIFORMS" );
glSetUniformi( loc_screen_width, 640 ); // screen_width
glSetUniformi( loc_UNIFORMS + 0, 640 ); // uniforms.Screen_width
glSetUniformi( loc_UNIFORMS + 1, 480 ); // uniforms.Screen_height
...

The guides were by no means helpful to me when learning the above.
Hello awsdert. Thank you for your explanation. You are skilled about OpenGL and your point of view seems to me clever. I will start a first little project using OpenGL and SDL - and I will see in a few weeks if Vulkan could be an interesting alternative. I wish you the best. Thank you ++
I don't think Vulkan will make OpenGL obsolete, or that OpenGL will go away anytime soon. There are tons of existing software that use OpenGL, so dropping OpenGL support will just not be an option. Maybe, at one point, there will be an OpenGL emulation layer on top of the "native" Vulkan API, just like you can run old 3dfx Glide games on modern hardware thanks to emulation libraries that run on top of Direct3D/OpenGL.

A description I have often read is that while OpenGL is a "graphics rendering" API, Vulkan is more a low-level "GPU" API. Of course, you can do graphics rendering with Vulkan, but you will have to implement a whole lot of things yourself that OpenGL just does "out-of-the-box"; you effectively will have to implement your own custom "graphics rendering" API on top of Vulkan. Due to its "low-level" nature, Vulkan has a great potential for optimizations, as the programmer controls pretty much everything. At the same time, though, it will be much more work to implement your 3D engine with Vulkan, compared to just using OpenGL.

So, it comes down to the question whether your project actually is going to take advantage of what Vulkan has to offer, and whether that is worth the extra work. Otherwise, you might be better off with OpenGL...
Last edited on
Registered users can post here. Sign in or register to post.