glGetIntegerv / glGetFloatv Android NDK
I am currently porting a game using the NDK. I am using native OpenGL, and am having problems using the glGet* functions.
Here is a code snippet:
m_camera.SetViewMatrix(); //just to make sure nothings left from the last render
int viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
float proj[16];
glGetFloatv(GL_PROJECTION_MATRIX, proj);
float model[16];
glGetFloatv(GL_MODELVIEW_MATRIX, model);
m_currentRay.Create(x, y, 0.0f, 1.0f, model, proj, 开发者_开发知识库viewport);
Everything looks ok, but it seems like the glGet* functions are simply not working, and are not returning any values.
I have even tried initialising the variables to certain values, but when the glGet* functions are called, the variables are unchanged. For example:
int viewport[4];
viewport[0] = 1;
viewport[1] = 2;
viewport[2] = 3;
viewport[3] = 4;
and when glGetIntegerv(GL_VIEWPORT, viewport); is called, viewport is still the same. The same applies to all the variables.
A few notes:
- I am debugging on a HTC Wildfire
- Using GLES 1.0
- Android SDK version 2.2 (API version 8)
Any help would be appreciated.
Thanks!
AFAIK, the wildfire uses the PixelFlinger software GL implementation. I know for a fact that PixelFlinger 1.2 does not implement glGetFloat, but have no information if later versions have corrected this. Is there any logging info when you call make the call? On 1.2 at least, there's a non-specific "unimplemented function" warning.
As to a solution - you'll just have to create the matrices in your own code and then upload them to GL.
精彩评论