6 ms·
Always interested seeing finished 3D engines, but this is written using OpenGL immediate mode mostly, something you shouldn't really learn anymore and that has
by inDigiNeous 11y ago
Always interested seeing finished 3D engines, but this is written using OpenGL immediate mode mostly, something you shouldn't really learn anymore and that has been deprecated already years ago.
Just bad practice nowadays, and results in slower performance too.
- heinrichhartman 11y agoSo, which APIs should be used nowadays?
- ajuc 11y agoOpenGL is OK, but not the immediate mode, it's "at least one function call per vertex" and that just doesn't make sense with modern hardware. Basicaly it's only there for backward compatibility and because it's simple to learn basic 3d graphic concepts experimenting with it. OpenES and WebGL (both based on OpenGL) removed immediate mode altogether because of that. In modern OpenGL you should use you own shaders (and not the fixed pipeline), and push geometry to GPU using Vertex Buffer Objects (VBOs).
- pjmlp 11y agoThe problem is that modern hardware has followed the ideas from Amiga, NeXT and others and moved the graphics processing fully into the graphics card. So even with OpenGL, you should move all the graphics processing into the GPU. The CPU is only working as orchestrator between data sets. With geometry shaders you can even generate the data on the GPU itself.
- ajuc 11y agoEDIT: it seems it's using VBOs? What do you mean by immediate mode? https://sites.google.com/site/letsmakeavoxelengine/home/display-lists-or-vertex-buffers https://sites.google.com/site/letsmakeavoxelengine/home/disp...
- inDigiNeous 11y agoOkay yeah I was wording it wrong. I see it's not using immediate mode later on in the tutorial. I just took a look at the engine, and there's lots of fixed pipeline calls and immediate mode stuff there still. See: https://github.com/AlwaysGeeky/Vox/blob/master/source/Renderer/Renderer.cpp https://github.com/AlwaysGeeky/Vox/blob/master/source/Render... Technically yes, immediate mode and fixed pipeline are a different thing. But modern OpenGL implementations upwards from 3.x (3.3 I think) don't anymore support the fixed pipeline of rendering, which means that you have to implement your own matrix setting, no default shaders and so on. Which is a kinda of a hassle and a steep learning curve, yeah, but once you get it, so much more flexible and better way to do things. Anyway, good tutorial on explaining the basic stuff, but wouldn't recommend learning any of this fixed pipeline stuff anymore.
- bananaoomarang 11y agoThis does use immediate mode for a brief demonstration early on, but then VertexBuffers, which are fine in modern GL. The author knows immediate mode was never performant.
- pjmlp 11y agoSure it was. I guess people already have forgotten how 3D programming used to be like.
- inDigiNeous 11y agoHmm. Well, okay, maybe I'm wrong, but I looked at the sources and in the renderer class it was using still legacy methods of setting matrixes, lights and so on.
- VikingCoder 11y agoI'm sorry, but this point of view is often repeated, and it's wrong. Immediate mode has the benefit that it's READABLE. It's possible to scan through code, and actually understand what's happening, and what the impact of small decisions will be. Modern OpenGL exists for performance. People who are worried about performance should absolutely, without question, use Modern OpenGL when they're moving to their final code. And I get that's the spirit of what you're trying to say. But when someone is trying to teach, and someone is trying to learn, how given input data translates to pixels on screen, immediate mode is vastly better at making READABLE code. Sure, yes, if you're an expert with modern OpenGL, you'd probably want your teacher to write modern OpenGL, because, well, why not? You're an expert, right?!? But that's akin to saying that you should explain advanced data structures with hand-coded machine language binaries. No. C and C++ and immediate mode OpenGL are better for teaching the core concepts.
- inDigiNeous 11y agoI agree on your point, but at the same time, teaching deprecated methods is just silly. You can teach Modern OpenGL also if you just think about how you approach it. Start with simple things and go from there. Also with Modern OpenGL you actually have to understand more about the whole process, with old OpenGL it's possible just ignore lightning, matrixes almost completely and not really understand them. But yeah, I kinda agree on that point also.
- AlwaysGeeky 11y agoI do kinda say in the articles that this tutorial set is not supposed to teach the reader about rendering or graphics programming. The whole reason for my writing it (3 years ago) was so that someone who already knows graphics programming could create a voxel engine. If I had to also teach modern OpenGL in the articles too, they would be over double the size before even getting to anything voxel related.
- captainmuon 11y agoWhen I read this, I feel old. When I dabbled in 3D graphics back in the day, you were not supposed to use (DirectX) retained mode. Immediate mode was the faster and closer to hardware option. I know the terms mean something else than 15 years ago (retained was a scenegraph model, put a box here, a model there; whereas immediate meant draw triangles yourself every frame), but still :-).