I've been reading up on OpenGL, but I'm particularly interested in swapping out bitmaps from a buffer onto a screen and visa versa.
My main function is as follows:
int main(int argc, char** argv)
{
init_font();
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Griddle");
glutDisplayFunc(renderFunction);
glutMainLoop();
return 0;
}
void renderFunction()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glFlush();
}
This opens a window with a black backgound.
My understanding is that I should define a Framebuffer:
glGenFramebuffers(1, &frameBufferID);
and then bind it:
glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);
Am I correct in thinking that anything drawn on the FBO is rendered on the screen?
How can I assign a 2D array to a buffer and then render it to the screen?