Opengl & event on mac

Thanks in advanced to all, i’am a mac developer. Now i have insert in my app framework ( from a while i put it in open source in but i have a little problem. There is anyone, that can explain me the right way to manage event in a mac enviroment for get maximun performance, on nullevent, to manage all the opengl 3d engine?
My goal is to make a good, easy, framework in opengl to do game.
If anyone can help me is good thing.

Thanks to all.


I think you can use GetNextEvent or GetNextOSEvent to speed up your application event processing. Just call this functions in a loop until there are no more messages and all the tiem left in your loop can be devoted to rendering, processing input and so on…

I hope that kind of answer you question .


Thanks BANE,
Now i have set the time waith in WaitNexEvent to 1 so, nullevent messege came regularly.
Sorry for english.
I’m novice in 3d bu i have a discrete experience how mac programmer.
I hope to became a good 3d programmer for 3d app.
Do you know i can make a texture trasparecly, from a file jpeg in memory?
Thanks in advanced BANE.

I cannot tell you how to load it from a jpeg file but once you have loaded it in memory, you need to convert it to a RGBA format and you set the alpha value to what you want across the texture and store as RGBA as well. When using it, you need to enable blending and then define a blending function like glFunc( src_alpha, one_minus_src_alpha ).
That should work .

Good luck,


I think GetNextEvent is faster than WaitNextEvent. And by setting the eventMask to only these events you’ll need its maybe even faster abit (not so sure about that and do this only in fullscreen apps)

For blending: there are great tutorials about specific techniques like blending, lightning, texturing and much more on

they use the tk library to load textures and glut to display, but they work on the OpenGL_DrawSprocket-example too


Thanks BANE and NOEL.
Yesterday i have prepared my app framework to be a game framework.
It can be initialized for be used to make app and game (windowed and multiwindowed mode or fullscreen).
I thinks that what i’ll do is to use open gl only for drawing poligon and texture.
Other computatiol purpose, new postition of object in scene evre new frame, ar coòputed by cpu (only vertex position) then printed on Opengl buffer.
NOEL and BANE, what do you think about that?

For NOEL: I have tryed getnextevent and it work better. thanks.

NOTE: I’ll put my framework project on sourceforge site. if any one can help me to do this…


Correct me if I am wrong as I am not sure I understood what you meant but I think you only want to use OpenGL to display polygons after you calculated the vertex outside OpenGL.

Well that’s one way to go about it. But my view on this is let OpenGL handle the transform. You have less chance of mistake that way but of course you have less control about what is happenning.

What I do at the moment is to clip the polygon in world coordinates and then send what polygons are left to OpenGL.


Yes Dan,
It is an carmack idea. Calculating the position by 3d engine ,this is not simple but very powerfool,the game can use a big power of new cpu. If we can do all to video hardware what must do the cpu?
On Macitosh, all game that use opengl go bad, using 3dfx 2000.
Quake 3, work with opengl but go faster than unreal…
Carmack use only one point, in cycle event, where call Opengl api. This point is the redraw of enteire scene.
Try unreal in opengl and quake3.
A question:
You use macintosh for develop your app?


[This message has been edited by Claudio (edited 06-22-2000).]

I think you have it wrong. John Carmack on a Mac dev list said it is genarally OK to let OpenGL handle the geometry and the 3D world. You only use the CPU to calculate the new frustrum at every step and clip the world with it. Plus with the advent of hardware transform and Lighting, it is going to be a load off the CPU soon. And anyway, at the moment on the Mac, using OpenGL to do the transform probably use the CPU. So it is better to use an old but verified system or to roll up your own function which might not be as optimised ??? It’s your call.

I develop with OpenGL on the Mac and frankly before I updated my Mac, the Voodoo2 card I had looked much better the ATI 128 card I have to use now.
And on the plus side, I can learn Glide too on the Voodoo2. Not used very much though.

My take on this is test the OpenGL path and your path and select whichever is faster for you.


Ok dan , you have right.
What mean, when you said that use cpu only for calculate frustum operation?

Wath realy fustrum do?

Know i develop on my old mac 7500.
Know i have use my framework to do 3d dev, i have to optimize it very much.
Know i’m doing a 3dcpumeter for testing my in 3d develop!

What I meant by using the CPU was just “do the calculations yourself in your code without using any API”. I did not express myself very well I must admit.

You seem to have a very old Mac to work on OpenGL programs. I hope you have a 3D card.


I have a 3dfx 2000 video card.
It work great.
How can be done bones animation in opengl.

I have a 3dfx 2000 video card.
It work great.
How can be done bones animation in opengl.

If you want to learn to do skeletal animations, check out motion (Build a Free Website with Web Hosting | Tripod). It seems to be fairly full of info.


Thanks morgan, i’ll try.
A question:
I have read around, that for make a good transparence in openGL i must first draw the scene, than draw all transparent triangle.
What do you think about that?

That’s the usal way to do it. Remember to draw transparent polygons back to front as the image is not the same and you have to render transparent polygons without writing to the z buffer (usually). You need of course to have an alpha plane and to define/load/store your textures with an alpha component(GL_RGBA internal format).

You can also achieve transparency by using material and light property in OpenGL but I did not manage to get it working yet . And I think it is slower.


Thanks bane!
What do you mean for alpha plane?

[This message has been edited by Claudio (edited 06-27-2000).]

I meant did you create the OpenGL window with an AGL_RGBA or AGL_ALPHABIT 8 or GLUT_RGBA setting ??? Is that clearer ??
I think you need those settings for alpha blending to work.


I have initiated opengl with these value.
Know i am able to se transparency by glColor4f and set the level of blending from 0 and 1.0f but when i try to create a texture with gl_rgba int the function glGenTexture i had a corrupted image for texture.