I am working on an example out of the OpenGL super bible and I am having some problems. I am trying to draw a rectangle/square on top of the background.
Here is my code:
This is not working however. The book suggests I should use GLUT for my interface, however I like Cocoa. Does anyone know why this code is not working?
Thanks
Blake
Here is my code:
Code:
- (void)drawRect:(NSRect)dirtyRect {
//Clear the view with the current clearing color
glClear(GL_COLOR_BUFFER_BIT);
//Set the current drawing color to red
// R G B
glColor3f(1.0f, 0.0f, 0.0f);
//Draw a filled rectangle with the current color
glRectf(-25.0f, 25.0f, 25.0f, -25.0f);
//Flush drawing commands
glFlush();
//Set up the rendering state
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
}
This is not working however. The book suggests I should use GLUT for my interface, however I like Cocoa. Does anyone know why this code is not working?
Thanks
Blake