Strange bugs when using glGetFixed()?

Post Reply
Senshi
Posts: 7
Joined: Wed Mar 16, 2011 2:29 am

Strange bugs when using glGetFixed()?

Post by Senshi » Wed May 21, 2014 10:14 pm

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

Senshi
Posts: 7
Joined: Wed Mar 16, 2011 2:29 am

Re: Strange bugs when using glGetFixed()?

Post by Senshi » Sat May 24, 2014 8:12 pm

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:

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]
I'll be sure to report back once I know more.

Cheers!

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Strange bugs when using glGetFixed()?

Post by elhobbs » Sun May 25, 2014 4:09 am

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.

Senshi
Posts: 7
Joined: Wed Mar 16, 2011 2:29 am

Re: Strange bugs when using glGetFixed()?

Post by Senshi » Wed May 28, 2014 7:59 pm

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.
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.

Thanks again; cheers!

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests