Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

evilxsystems

macrumors newbie
Original poster
May 11, 2006
4
0
Hi-

I'm having an issue with OpenGL/GLUT. I have a command line application that I'm trying to add some graphics to in a separate window. I'm using GLUT and I can open the window fine, can draw to it just fine. I'm using a pthread to run GLUT in it's own thread so I don't have to rewrite my whole app to use GLUTs event based model...but I would like to use GLUT generated events to do things in the GLUT window, however I can't seem to get the window to respond to input...I can pass the GLUT thread commands generated in the terminal window, but when I click on the GLUT window I get the spinning ball mouse cursor and my GLUT input event handlers never get called...is this a problem with running GLUT in a pthread? or am I missing something simple?

Also I'd like to do away with GLUT if possible and use OpenGL directly, is there a tutorial on how to launch a separate window and do OpenGL in it from a terminal app?....also I really want to avoid X11 if possible.

-thanks
jason
 
Hi-

I'm having an issue with OpenGL/GLUT. I have a command line application that I'm trying to add some graphics to in a separate window. I'm using GLUT and I can open the window fine, can draw to it just fine. I'm using a pthread to run GLUT in it's own thread so I don't have to rewrite my whole app to use GLUTs event based model...but I would like to use GLUT generated events to do things in the GLUT window, however I can't seem to get the window to respond to input...I can pass the GLUT thread commands generated in the terminal window, but when I click on the GLUT window I get the spinning ball mouse cursor and my GLUT input event handlers never get called...is this a problem with running GLUT in a pthread? or am I missing something simple?

Also I'd like to do away with GLUT if possible and use OpenGL directly, is there a tutorial on how to launch a separate window and do OpenGL in it from a terminal app?....also I really want to avoid X11 if possible.

-thanks
jason

Look into SDL, it may well provide a solution for all the things that you have mentioned and has the added advantage of being cross platform compatible too if you ever want to deploy your application on Windows or Linux.
 
:)
I was using SDL1.2, but I had to switch to x86_64 mode to deal with some memory issues. Tried using SDL1.3 in 64bit mode on the mac...can't get the framework to compile and from the sounds of it it won't be stable for a while.
 
this approach works fine if the GLUTmainloop is called from the main thread of the application and main code of the original application is then run on in a pthread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.