Now I’ll admit I’m completely ignorant (see also: not any good) at graphics programming, but I had an idea back in college of simplifying my programs by having what I call a universal render queue. Now I’ll fully admit this is a terrible idea in terms of getting objects on the screen quickly, but it should be fast enough for rendering 2d objects.
Basically everything you want to render gets pushed into this massive queue, and then that queue gets rendered in one pass. The reason I liked this idea so much is that it meant I didn’t have calls to OpenGL all over the place. The second reason is because everything is unified it allows me to easily modify everything that gets rendered from a single location. The third reason is probably the most important is that it allows me add OpenGL support to my programming language.
I didn’t know if I could actually get any of this work, but tonight I finally proved the concept on a tiny scale. The real test will be how quickly can it render multiple textured quads, but for now I’m just thrilled it works at all.
include "graphics.vh"
/*
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=–=-=–=-=–=-=–=-=-
RENDERING.VC
This program is a test of the universal render queue.
Developed by: Alex Ayers
AYERSLABS 2010
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=–=-=–=-=–=-=–=-=-
*/
function int Main(int argc, array argv)
{
while (1)
{
StartDraw();
Color(1.0,0.45,0.75);
Point(50,50,0);
Color(0.35,0.0,0.45);
Point(50,250,0);
Color(0.0,1.0,1.0);
Point(250,250,0);
Color(0.35,0.45,0.15);
Point(250,50,0);
EndDraw();
StartDraw();
Color(1.0,0.45,0.25);
Point(40,40,0);
Color(0.15,0.0,0.45);
Point(40,150,0);
Color(0.0,1.0,1.0);
Point(150,150,0);
Color(0.35,0.15,0.15);
Point(150,40,0);
EndDraw();
Render();
}
return 0;
}
