PDA

View Full Version : Opengl & event on mac.



Claudio
06-18-2000, 10:21 PM
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 sourceforge.net) 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.

BANE
06-20-2000, 02:56 AM
Hi,

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 http://www.opengl.org/discussion_boards/ubb/smile.gif.

Dan.

Claudio
06-20-2000, 05:45 AM
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.

BANE
06-20-2000, 06:42 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif.

Good luck,
Dan.

06-20-2000, 02:59 PM
Hello

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 http://nehe.gamedev.net/

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

Greetings
Noel

Claudio
06-20-2000, 09:48 PM
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....

BANE
06-22-2000, 02:53 AM
Hi,

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.

Dan.

Claudio
06-22-2000, 05:55 AM
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?

Claudio

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

BANE
06-22-2000, 07:23 AM
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.

Dan.

Claudio
06-22-2000, 08:33 AM
Ok dan , you have right.
What mean, when you said that use cpu only for calculate frustum operation?

Claudio
06-22-2000, 12:24 PM
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!

BANE
06-23-2000, 05:36 AM
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.

Dan.

Claudio
06-23-2000, 08:55 AM
I have a 3dfx 2000 video card.
It work great.
How can be done bones animation in opengl.

Claudio
06-23-2000, 08:57 AM
I have a 3dfx 2000 video card.
It work great.
How can be done bones animation in opengl.

Morgan
06-25-2000, 05:30 PM
If you want to learn to do skeletal animations, check out motion (http://members.tripod.de/mspoerl/m_index.html). It seems to be fairly full of info.

Morgan

Claudio
06-25-2000, 09:52 PM
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?

BANE
06-26-2000, 05:25 AM
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 http://www.opengl.org/discussion_boards/ubb/frown.gif. And I think it is slower.

Dan.

Claudio
06-26-2000, 08:10 AM
Thanks bane!
What do you mean for alpha plane?

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

BANE
06-29-2000, 11:07 PM
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.

Dan.

Claudio
06-30-2000, 12:47 AM
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.

BANE
06-30-2000, 03:53 AM
You probably made a mistake when loading the textures and you are probably loading crap into it. Make sure that the external format information you give correspond to the way you have stored your textures outside OpenGL.

For example;
if my texture was an array textures[64][64][4] then I'd use GL_RGBA, GL_UNSIGNEDBYTE, textures.

Hope that helps,
Dan.