-
Notifications
You must be signed in to change notification settings - Fork 5
Renderer2D class
Vlod edited this page Nov 28, 2023
·
4 revisions
The Renderer2D is the class that allows you to render your stuff.
Initialization:
gl2d::Renderer2D renderer;
renderer.create();
It is every important to set your window size every frame:
renderer.updateWindowMetrics(w, h);
The create method also has 2 optional parameters: the OpenGL FBO to write into and the quadCount. The quad count is how many quads you estimate to draw at one time but it is only to reserve the memory as an optimization, you can exceed it at any time.
Whenever you render something, the renderer will store its geometry into an internal buffer and it will draw it all at once when you call flush or flushFBO. There is also the clearDrawData method that will clear the geometry but not draw it and you can also render your geometry and not clear the draw data by using the optional parameter in the flush methods!