PDA

View Full Version : Fairly small OpenGL GLUT example not running on OSX


WhatMeWorry
2007.01.06, 01:19 PM
Anyone up for a challenge. I've been hacking at this Gordian Knot
for some time -- it's probably not that hard. I'm just no Alexander.

There are two fire/water example source code projects at
www.mkp.com/opengl (water.c and particle.c)
that I'd like to get working on OSX so I can play with the code
and learn from it. The code comes from the book "Advanced Graphics
Programming Using OpenGL".

It seems to be written for windows/linux. I can get both to compile
and link in Xcode with trivial tweaking, but when I run them I get
just... well, nothing.

The book is quite advanced (at least for me) and these guys really
know their stuff. There code is quite good too except for their
glutReshapeFunc(reshape) function: there is none!? Instead they
put the functionality that one would expect to go there, in their initialization
function.

unknown
2007.01.06, 02:02 PM
chnge the makefile to somthing like
LIBS = -L/usr/X11R6/lib -framework GLUT -framework OpenGL -lX11

and the includes in the files frlm GL/glut.h to GLUT/glut.h
also, add #include <OpenGL/gl.h>


make -f Makefile.linux


PS the examples suck

WhatMeWorry
2007.01.06, 02:31 PM
I brought them over into Xcode. Yeah, I'm underwhelmed too :(

unknown
2007.01.06, 02:39 PM
hehe yeah
well nehe has good stuff but I dont know..
I dont see much inspirational 3D gfx these days :|

a lot of cool stuff from the demoscene though (sucks to have to run it all in windows)

spaceb
2007.04.22, 02:32 AM
It seems to be written for windows/linux. I can get both to compile
and link in Xcode with trivial tweaking, but when I run them I get
just... well, nothing.

The book is quite advanced (at least for me) and these guys really
know their stuff. There code is quite good too except for their
glutReshapeFunc(reshape) function: there is none!? Instead they
put the functionality that one would expect to go there, in their initialization
function.



That's one thing I've never liked about OpenGL - it's error handling. You basically have to hack away at most bugs until you find out you were doing something ridiculous like drawing everything behind you...

One thought - Are you using loaded images for texture mapping? Sometimes that causes problems going between systems.

OneSadCookie
2007.04.22, 04:42 AM
That's one thing I've never liked about OpenGL - it's error handling. You basically have to hack away at most bugs until you find out you were doing something ridiculous like drawing everything behind you...

That's not an OpenGL error, it's a user error... how could it know you meant to draw stuff somewhere else?

If you're using the OpenGL profiler, you can cause it to "break on error", which'll show you which functions cause OpenGL errors immediately they do.

One thought - Are you using loaded images for texture mapping? Sometimes that causes problems going between systems.

a) the problem's been solved, months ago... and b) only if the texture loading code is exceptionally poorly written...