Noob question : setting up opengl

Started by
5 comments, last by MARS_999 19 years, 7 months ago
Im just starting OpenGL, and ive looked at some tutorials and it all seems easy. The hardest part im having is getting it to work with my system. Im on a Mac with OS x 10.3. Now I DONT want to use project builder or xcode stuff. I CAN get opengl to work with these, but i need it to work just as an include in my code. Do I have to set links in my directory to the header files? Or is there a special path I have to add to my enviroment variables? It just gives me the undefined function errors, though it doesnt say it cannot find the .h files. What should I do?
Advertisement
I have a Mac also, and have OpenGL working with OSX. Not sure what you are looking to do, but you need to either setup OpenGL in Cocoa or Carbon. If you use SDL it setups OpenGL through Cocoa. But you need to use this preprocessor directive to include gl

#include <GL/OpenGL.h>
#include <GL/gl.h>
#include <GL/glext.h>

and make sure you have included the opengl.framework into your project. Not sure thats what you're looking for....
I was looking for a way to avoid using the frameworks, and just have those include statements in my code. I mean, I want to be able to code using VI and use a makefile to compile, not using codewarrior or any sort of project management. It doesnt find those .h files, so I think its a path problem, but what should I do.

I guess I can start a new project (it DOES work using XCode) but its a lot of hassle because the code is done, im just working on an output interface.
Well, let me just explain exactly what I want.

I have code writtin in C/C++. I want to add an openGL window that does very simple drawing. It is on a MacOSx system. I currently build by makefile/gcc and have never used XCode or Codewarrior, though it doesnt seem too hard. I want to be able to, in the end, build just an executable that when built on most systems it works. Right now it works on any platform, but I DONT want to build a .app file(which is what XCode makes me build).
Then you want to use SDL to set up OpenGL. There are SDL ports available for Linux, Windows and Mac OS X (and probably some other OSes too).
XCode doesn't make you build a .app, just choose the project type for Tool or whatever. And you can build with a makefile, you just need to add -framework OpenGL or something like that to gcc.

It seems that GLUT would be the easiest way to do this, SDL for OSX requires an obj-c project ( which is kind of dumb, unless you used the UNIX installation. )

BTW you can always build xcode projects from the command line anyways, it's xcodebuild or something similar, I'm not sure what is exactly but you can find out by reading the documentation ( I don't have a mac at work so I can't tell you exactly. )
If you want cross platform and are making games which I assume you are doing based on you are on gamedev.net. You have to use SDL on the Mac. Why not use SDL? You can code it once and the recompile it for PC/Linux ect... and it will work on the other OS's/hardware without having to recode it. Look into SDL and you can use SDL from a command line compiler also. I think the example comes with a make file if I remember right...

This topic is closed to new replies.

Advertisement