OpenGLES, fixed point and black objects...

Started by
4 comments, last by S41NT 18 years, 10 months ago
Hi! I'm part of the development team of a game engine for PDAs. Recently, we decided to change all math to fixed point (to use wMMX instructions), opengles functions included. After all the work, the geometry works fine, but all objects are black. At first, I thought it could be a texture problem, but even if I don't use textures and tell opengles to use an arbitrary color, everything is black. When using floating point, however, everything works just fine, including texture mapping. I'm sorta new to OpenGL, so I'm having a hard time figuring out where the problem could be. Maybe you could give me a hint or a debugging procedure to solve this. I just don't know where to look. Thanks very much.
Advertisement
Hrm, well generally when you dont assign a color AND you have no texture bound, you usually get white primitives, which makes your case interesting. Are you positive that they're even there? (ie your clear color is black and you see nothing so you assume your objects are black?) Maybe it has somethign to do with the depth buffer precision going so out of whack that every depth test is failing. Or maybe precision is dying somewhere else in your math, and your objects are ending up where you dont expect them. Change your clear color to red or something (if you havent already) and see if your objects are still there. However I've never heard of this problem before.

sorry I couldnt be of more help
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
I had done exactly what you said: changed the clear color to red... the objects are there, in black :(

When no texture is found, the objects are painted in white (which I changed to blue just to check, its working), but I only get those colors using floating point math. With fixed point, it's all black, sadly.

You think it might have something to do with the depth buffer? I don't think so... I can see the objects appearing when I move the camera closer to them, for example... I realize this problem must be very specific, I'm desperately looking for a hint on how to solve it. What could be causing this?
What's the range of the values of your colors and texture coordinates? Are you representing them using GL_FIXED, or something else? Are you setting the texenv to GL_MODULATE? If so, try GL_REPLACE and see if that makes a difference.
just a suspicion, but you just switched to fixed point so you may want to rule this out. a couple of months ago i had a simular problem when passing doubles to a floating point opengl function. just make sure you aren't confusing the two without typecasting.
As your leader, I encourage you from time to time, and always in a respectful manner, to question my logic. If you're unconvinced that a particular plan of action I've decided is the wisest, tell me so, but allow me to convince you and I promise you right here and now, no subject will ever be taboo. Except, of course, the subject that was just under discussion. The price you pay for bringing up either my Chinese or American heritage as a negative is - I collect your f***ing head.
SOLVED!

Hi! I wanted to thank you for the help and to inform the problem, just in case anyone goes through this again. It's really annoying to waste time with this kind of thing...

My problem was with fixed point representation. I created a Fixed32 class and, for float compatibility, i have many constructors and cast operators. GLfixed is defined as int and the compiler calls the (int) cast operator when the function requires the type GLfixed (I thought it would consider GLfixed as a different type). Because of that, all values were being divided by 2^16.

The geometry was working because when the function received a pointer, the cast operator was not called.

Anyway, thanks again.

This topic is closed to new replies.

Advertisement