OpenGLES, fixed point and black objects...
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.
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
sorry I couldnt be of more help
-Dan
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?
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.
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.
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
Popular Topics
Advertisement