Getting started in OpenGL programming?
Getting started in OpenGL programming?
- Subject: Getting started in OpenGL programming?
- From: John Kundert-Gibbs <email@hidden>
- Date: Mon, 3 Jun 2002 16:33:10 -0400
Hi, all,
This summer I am working with someone to learn some basic OpenGL
programming. My trouble right now is that this other person uses Linux
to do his programming and I'm (obviously) using a Mac. I am currently
trying to get a dirt-simple OpenGL program (included below, if you care)
to work on my Mac, but I'm not having much luck. The basic problem I'm
having is one of setting the correct switches, I believe. For Linux the
command to compile this code is:
cc -L/usr/X11R6/lib -O2 program.c -lX11 -lGL -lGLU -lglut -lm
Trouble is, the Mac has no X11 libraries by default, and when I use the
other switches, the compiler still tells me the gl and glut commands are
undefined. I stuck the whole program into a project builder shell and
added the GLUT.framework headers to the project, so now it compiles
properly, but I only get a blank window, not the black-on-red squares I
should see inside them.
So... if anyone knows either how to set up the switches properly so that
the regular cc compiler can see the GL and glut header information, or
how to build a basic project builder shell to stick this program into,
I'd much appreciate it (especially the latter, as that allows me to
create prettier applications right out of the box). I figure once I can
get this basic program to work, I can stick the later, more complex
ones, into the same skeleton and be off and running.
Thanks very much for any help you can give me!
John
***program***
#include <stdio.h>
#include
</System/Library/Frameworks/OpenGL.framework/Versions/A/Headers/gl.h>
#include <GLUT/glut.h>
void drawstuff ();
main()
{
glutInitDisplayMode (GLUT_RGBA);
glutInitWindowSize (512, 512);
glutInitWindowPosition (100, 50);
glutCreateWindow ("hurricane");
glutDisplayFunc (drawstuff);
glutMainLoop ();
}
void drawstuff()
{
glClearColor (1.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (0.0, 0.0, 0.0);
glBegin (GL_POLYGON);
glVertex2f (-0.5, -0.5);
glVertex2f (-0.5, 0.5);
glVertex2f (0.5, 0.5);
glVertex2f (0.5, -0.5);
glEnd();
}
John Kundert-Gibbs, Director
Digital Production Arts
404 Edwards Hall
Clemson University
Clemson, SC 29634
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.