A Quick, Easy and Extendable OpenGL Renderer in 250 LOC!

  Рет қаралды 9,925

VoxelRifts

VoxelRifts

Күн бұрын

Пікірлер: 25
@DylanFalconer
@DylanFalconer Жыл бұрын
Nice, I have been using something similar myself for quite a while, but with quad rendering as the atom. Nice tip about the EBO not being worth it in these cases - I'll be using that info :)
@springogeek
@springogeek Жыл бұрын
I don't think that the EBO tip is entirely accurate. It makes sense if you have very little vertex data, but once you start adding texture coordinates, texture ids, colors, the vertex reuse saves data on quads for sure.
@enriquedelacal2814
@enriquedelacal2814 2 ай бұрын
@@springogeek yea idk where he got that from, itd be nice if he clarified
@torphedo6286
@torphedo6286 Жыл бұрын
This is pretty cool! I'll consider using this if I do more 2D rendering in the future. It's a little too barebones for my 3D needs (I'm trying to support GLTF loading), but this is perfect for a 2D game.
@BiskitSlippers
@BiskitSlippers Жыл бұрын
Thank you for taking the time to make these videos! I think I understand the concept of a memory arena - I like to think of it as a stage where the memory lives for a certain amount of time. What I don't understand is how do you load specific data into them? Do you just use void pointers everywhere and cast them whenever you need to use them? I think I am on the edge of fully understanding this but I'm not there yet.
@voxelrifts
@voxelrifts Жыл бұрын
Yeah, I implement them as linear allocators, holding an offset of where the next allocation will go with respect to a base pointer. If you haven't seen it already, I made a video about arenas that goes indepth into the semantics of it all (as you said, the allocations living a certain amount of time)
@Maxjoker98
@Maxjoker98 4 ай бұрын
Nice video, I've used completely custom "game engines" for game jams etc. before, but mostly for 2D stuff. However, the way you handle textures is very OpenGl 2. In more modern OpenGL you can use TEXTURE_2D_ARRAY: It is basically what you've manually implemented, you just give it 3 indices when sampling. (u, v, and "texture id" aka "layer" or "w"). I think it's an OpenGL 3 feature, might be 3.3, either way WebGL2 supports it :)
@juliapaci
@juliapaci 14 сағат бұрын
unfortunately, however, the textures must be the same resolution :(
@JacobElliottSermons
@JacobElliottSermons 4 ай бұрын
I think I am grasping what you are doing. I am wanting to develop a 3D renderer. This seems to be extendable to the 3D world but I think I will need to study it and make sure. Do you think the concepts work and are transferable? It seems to me but need to think on it further.
@yogxoth1959
@yogxoth1959 Жыл бұрын
Thanks a lot for this video. It’s very helpful since I’m learning OpenGL right now. But I’m wondering why you aren’t using the GL types, like GLuint? What are those u32 types?
@voxelrifts
@voxelrifts Жыл бұрын
they are typedef-ed to the same thing. the u prefix stands for unsigned, the i prefix is for signed, the f prefix stands for floating point. the number stands for how many bits the type takes up. Only reason for using those is shorter type names. (Also since I'm doing opengl function loading myself, I'd have to typedef GL types myself so It isn't really great)
@torphedo6286
@torphedo6286 Жыл бұрын
GLuint is just a 32-bit int anyway, so it's the same thing. I typedef'd them to "gl_id" in my codebase to shorten the name, but "u32" works too.
@anon_y_mousse
@anon_y_mousse Жыл бұрын
This is a good idea, but I think it should be written more portably. Something that might help is if you download a copy of MingW or CygWin. When I was still using Windows, they made it a lot easier to target POSIX as a platform, and both include a port of bash. For getting input, you might consider using SDL, and for simple GUI construction consider GTK. I think I'm going to see what it takes to port this by getting your tetris clone working.
@voxelrifts
@voxelrifts Жыл бұрын
Oh definitely. The main point of the repository was JUST the renderer c file. The rest of the scaffolding was just my codebase which I'm in the process of making more cross platform at the moment.
@torphedo6286
@torphedo6286 Жыл бұрын
GLFW also works and can get you both the rendering and input. I've been using that with CMake, and my code is portable to MinGW, MSVC, and GCC on Linux
@anon_y_mousse
@anon_y_mousse Жыл бұрын
@@torphedo6286 Yep, another excellent choice.
@LainIrukawa
@LainIrukawa 10 ай бұрын
i like the colorscheme and font , names ?
@voxelrifts
@voxelrifts 9 ай бұрын
Font is inconsolata, the colorscheme is Ryan fleury's which is modified from the theme Casey uses for handmade hero. I don't think it has a name.
@asherhaun
@asherhaun Жыл бұрын
things look to have improved since azurite :D
@voxelrifts
@voxelrifts Жыл бұрын
Improved AND simplified a lot indeed!
@enriquedelacal2814
@enriquedelacal2814 8 күн бұрын
quads do save space with indices
@Shadowblitz16
@Shadowblitz16 Жыл бұрын
How would I use render textures?
@voxelrifts
@voxelrifts Жыл бұрын
What do you mean by render textures? I cover rendering simple textures in the video
@Shadowblitz16
@Shadowblitz16 Жыл бұрын
@@voxelrifts like rendering a texture onto a texture
@voxelrifts
@voxelrifts Жыл бұрын
@@Shadowblitz16 That's something you would want to use a framebuffer for separately. That's not something the renderer itself is concerned with. You make a separate framebuffer with a texture attachment. If you want to render to the framebuffer, bind the framebuffer then use the renderer like normal (begin frame, push geometry, end frame) then swap over to the screen framebuffer and use the renderer again to render the framebuffer texture
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 93 М.
My 2 Year Journey of Learning C, in 9 minutes
8:42
VoxelRifts
Рет қаралды 657 М.
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 33 МЛН
Programmable Vertex Pulling // Intermediate OpenGL Series
16:27
Why Didn't He Get the Job? Let's Find Out! // Code Review
27:25
The Cherno
Рет қаралды 151 М.
I tried coding my own graphics engine
4:23
Garbaj
Рет қаралды 213 М.
Writing a Basic Renderer in OpenGL
14:43
The Cherno
Рет қаралды 122 М.
Why I Use C | Prime Reacts
13:00
ThePrimeTime
Рет қаралды 180 М.
I tried coding Minecraft from scratch
9:54
c6dy
Рет қаралды 20 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 734 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 837 М.
I Optimised My Game Engine Up To 12000 FPS
11:58
Vercidium
Рет қаралды 724 М.