#include <GL/glut.h>
I do, but it comes up with errors. I know that 5/6 of them are because it can't find <GL/glut.h>. Perhaps this is a more windows type file reference? Is the mac version different? I have included OpenGL and GLUT in my "Other Frameworks". Just in case, here is the code:
Thanks!
#import <Cocoa/Cocoa.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
void display(void)
{
/* clear all pixels */
glClear(GL_COLOR_BUFFER_BIT);
/* draw white polygon (in this case it's a rectangle...) */
glcolor3f(1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
/* start processing buffered OpenGL routines */
glFlush();
}
void init(void)
{
/* select clearing (background) color, in this case, it's black */
glClearColor(0.0, 0.0, 0.0, 0.0);
/* initialize viewing variables */
gl_MatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/*
Declare initial window size, position, and display mode
(single buffer and RGBA). Open with "hello" in its
title bar. Call initialization routines. Register
callback function to display graphics. Enter the main
loop and process events.
*/
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return NSApplicationMain(argc, (const char **) argv);
}