1
\$\begingroup\$

I setup my OpenGL viewport via

    ViewPort( 0,0,WindowW, WindowH )
    MatrixMode( Projection )
    LoadIdentity()
    MaxY = ClipNear * Tan(FieldOfView * 0.00872664626)
    MaxX = MaxY * Ratio
    Frustrum(-MaxX ,MaxX ,-MaxY ,MaxY ,ClipNear ,ClipFar)
    MatrixMode(ModelView)

Then I add rotation and move the Camera accordingly

    LoadIdentity()
    Rotated(ry,1,0,0)
    Rotated(rx,0,1,0)
    Translated(z,y,x)

However the center of the frustrum is not the middle of the Window. It is slightly right and up in the window.

I'm sure there is a bug in my code but I can't seem to find it. I have checked every place I could think of.

The bug could be caused by setting a wrong viewport however that doesn't seem to be the case as a similar Project (however not using modular code) works fine with the same viewport settings.

The bug could also be caused by setting a wrong Frustrum. However that also works in the other project.

Aside from that I do not know of anything that could cause this.

As my Code is written in a rather weird language posting it here wouldn't do any good.

So my question is what kind of mistake/bug can cause a behaviour like that.

\$\endgroup\$
1
\$\begingroup\$

It turns out that my Window had the wrong size. Background: I use a full screen Window that simply has no border. I set the size of that Window to the Screen Resolution. Now the problematic part: While the size of the Window is respecting DPI the resolution returned doesn't which lead to a window thats too large.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.