Handmade Hero»Forums»Code
Jason
202 posts
Help understanding render commands
Edited by Jason on Reason: Initial post
So I've jumped a head a bit through handmade hero to see how Casey starts implementing opengl and in the series of videos he starts describing his 'three tiered architecture' which involves the game passing 'render commands' to a buffer which can then be rendered. I understand that this helps separate game code from any specific rendering code thus avoiding round trips through the platform layer. However, I'm a little stuck on what exactly constitutes a render command. I tried looking through the code but since I haven't watched all the videos leading up to it I'm having trouble grasping it. What exactly is an individual render command? What sort of data is stored in it?
Mārtiņš Možeiko
2238 posts / 1 project
Help understanding render commands
Example of render commands:
1) clear current framebuffer with color C
2) clear current depth buffer
2) set current framebuffer to specific FB
3) draw quad with following vertices V1,V2,V3,V4 - that includes position, texcoord, and color and other info related to lighting

Render command can be whatever you want - its just an information you want to pass render API like OpenGL, D3D or other.
Jason
202 posts
Help understanding render commands
Okay so basically it's just like opengl or directx instead its your own, platform independent commands that you can then pass to your renderer for it to figure out what to do with it? So if say your renderer is built using opengl commands then your own 'clear_buffer()' function/command would get sent to the renderer and the renderer would call the opengl specific glclearbuffer() within? Am I understanding this correctly?
Mārtiņš Možeiko
2238 posts / 1 project
Help understanding render commands
Yes, that's exactly what clear command should do - call glClear or similar function.