PDA

View Full Version : Different Scales / Units between 2 computers



JasonG
12-19-2016, 01:43 AM
Hi,

I'm getting started with OpenGL and I'm working between 2 computers. I have a small model that lies within -1.0 to 1.0 in all directions, however when I use glm::lookAt() to produce my ViewMatrix, I need to use quite different numbers between the 2 computers to obtain similar results.

On one computer I use a position vector of 4, 2, 4 to get a nicely framed 3/4 view on the model. On my other computer I have to use 80, 40, 80 to get something similar. I'm using the same model (same file from the git repo), so it must be something in OpenGL or glm.

Does anyone have any ideas?

Thanks
Jason

GClements
12-19-2016, 07:12 AM
Does anyone have any ideas?

Aspect ratio? That shouldn't have that much effect, but if the calculation is wrong, it might.

JasonG
12-19-2016, 05:43 PM
Aspect ratio? That shouldn't have that much effect, but if the calculation is wrong, it might.

Aspect ratio of the context is the same. 1280x720 fixed.

The monitor setup between the 2 systems is different. One is a single HD TV and the other is a 3 screen setup with a horizontal dimension over 5000px. I'd be surprised if that would affect it though.

I think i'll investigate glm. The glm::lookAt and glm::perspective functions are the only things i'm using that contribute to the MVP matrix i'm using.

Silence
12-19-2016, 11:27 PM
Aspect ratio of the context is the same. 1280x720 fixed.

The monitor setup between the 2 systems is different. One is a single HD TV and the other is a 3 screen setup with a horizontal dimension over 5000px. I'd be surprised if that would affect it though.

I think i'll investigate glm. The glm::lookAt and glm::perspective functions are the only things i'm using that contribute to the MVP matrix i'm using.

I don't personally use glm, but I highly doubt that these are the culprits. It is widely used now, so such bugs will have been quickly notified and fixed.

But if you really doubt in it, then just create yours. The lookAt matrix is quite easy to do. You have an explanation here (http://www.cs.virginia.edu/~gfx/Courses/1999/intro.fall99.html/lookat.html). For the perspective, the wikipedia page (https://en.wikipedia.org/wiki/3D_projection) looks interesting.

The monitors should not make any changes neither. Maybe something was wall initialized, whether in your GL code, or maybe in glm (ie. matrix not set to identity before performing any operation on it ?)

Another easy thing you can do is simply to dump your final mvp matrix on both your systems, and check for any differences.