Help with <GL/glut.h> problems please.

Anything else
Post Reply
DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Help with <GL/glut.h> problems please.

Post by DudetheCreator » Tue Feb 15, 2005 7:26 pm

I am having some trouble with the code from the Red Book (OpenGL Programming guide, fourth edition) It uses GLUT to set up all the windows in it's code. It also says, that because of this, i should always use this:

#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:

#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);
}
Thanks!

Jeff
Evil Twin
Posts: 2892
Joined: Wed Nov 19, 2003 10:48 pm
Location: San Francisco, CA
Contact:

Post by Jeff » Tue Feb 15, 2005 9:42 pm

I like how you come here and insult all of Wolfire's software and then expect David to help you with your programming.

redboot
Posts: 4
Joined: Tue Feb 01, 2005 10:06 pm

Post by redboot » Tue Feb 15, 2005 11:50 pm

try <GLUT/glut.h>

User avatar
leDoOd
What custom title?
Posts: 777
Joined: Fri Feb 11, 2005 10:25 am
Location: The Q Continuum
Contact:

Post by leDoOd » Wed Feb 16, 2005 2:49 am

Jeff wrote:I like how you come here and insult all of Wolfire's software and then expect David to help you with your programming.
If you don't have anything nice to say, don't say it at all. :roll:

zip
lugaruguru
Posts: 1820
Joined: Mon Jan 26, 2004 12:39 pm
Location: USA, Missouri
Contact:

Post by zip » Wed Feb 16, 2005 12:01 pm

leDoOd wrote:
Jeff wrote:I like how you come here and insult all of Wolfire's software and then expect David to help you with your programming.
If you don't have anything nice to say, don't say it at all. :roll:
That could be applied to DtC as well you know; Jeff is right.

DudetheCreator
Posts: 226
Joined: Thu Sep 23, 2004 10:06 pm
Location: Lost in the 404 errors...
Contact:

Post by DudetheCreator » Wed Feb 16, 2005 12:47 pm

Nvm, i figured out the GLUT/glut.h thing. Thanks anyway.

Post Reply