I recently profiled my game (using LWJGL) using the NetBeans profiler and to my surprise, the initial pixel clear function was taking LONGER to execute than rendering 10 thousand sprites a frame.
This really baffles me and I wanted to ask if anyone has any idea why?
Its not just a slight difference either, the glClear and glClearColor methods are taking over 2x the time that doRender() is, and doRender actually renders about 10k-20k sprites per frame, setting up buffers, binding shaders, calculating tex coords and finally calling glDrawElements.
Now i’m just super confused and I’d like to see if anyone has any clues as to why this is.
The function looks like this:
@Override
public void begin() {
GL11.glClearColor(0, 0, 0, 1);
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
a = r = g = b = (byte)0xff;
scissorRect = null;
}