I've noticed some strange behaviour with glGetFixed() before when using it to fetch the view direction matrix. Feeding it a regular int* n or int* n =nullptr seems to cause a change of state in a completely unrelated member in an unrelated class. "Whatever", I thought. Initializing an int[] to {0,0,0,0,0,0,0,0,0} did the trick.
However, today I also needed the world coordinates of the camera, so I figured I'd try my luck using GL_GET_MATRIX_POSITION. This, however, causes a serious grahical bug; almost as if Vblank/ Hblank is suddenly very confused. Printing the results also doesn't give me the appropriate values. The entire matrix is filled with zeroes, except the first element which is 1000. (My camera's position is definitely not at the origin.)
Does anyone have any clues as to what could be going on here? I'm thoroughly confused at this.
Thanks in advance,
Patrick
Strange bugs when using glGetFixed()?
Re: Strange bugs when using glGetFixed()?
Quick update: It seems requesting the position or projection sets the current matrix mode, but does not restore it. Adding "glMatrixMode(GL_MODELVIEW);" after the call to glGetFixed() fixes the graphical bugs at least.
However, I am still not getting the values I expect. Here is a snippet I've tried, and the results it gives:
I'll be sure to report back once I know more.
Cheers!
However, I am still not getting the values I expect. Here is a snippet I've tried, and the results it gives:
Code: Select all
gluLookAtf32(0, 17200, 10240, //camera position
0, 10650, 0, //look at
0, 4096, 0); //up
int pos[16];
glGetFixed(GL_GET_MATRIX_POSITION, pos);
//pos contents (alternating each frame):
[4098, 0, 0, 0,
0, 1716, 3717, 0,
0, -3718, 1716, 0,
0, -6883, -37795, 4096]
and
[4097, 0, 0, 0,
0, 3450, 2207, 0,
0, -2207, 3450, 0,
0, -8969, -17892, 4096]
Cheers!
Re: Strange bugs when using glGetFixed()?
I want to say that the projection and model view matrices cannot be retrieved without setting the other to identity first. I do not remember exactly. But there are a lot of areas where the ds 3d is quirky and does not behave in a manner that maps to OpenGL convention.
Edit: yes. This is the case according to gbatek.
Edit: yes. This is the case according to gbatek.
Re: Strange bugs when using glGetFixed()?
I think quirky is a pretty accurate description. =P Thanks for the info! Unfortunately I haven't gotten it to work yet, but for now it's "good enough". If I do end up finding a solution in the future I'll be sure to post it here, but for now I think I'll just leave this part be.But there are a lot of areas where the ds 3d is quirky and does not behave in a manner that maps to OpenGL convention.
Thanks again; cheers!
Who is online
Users browsing this forum: No registered users and 1 guest