Author Topic: Wrong Dimension  (Read 2188 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Wrong Dimension
« on: July 05, 2011, 02:14:36 PM »
Hi Charles,

Do you have an idea why this happens ?
gluPerspective makes trouble with Dimensions.  >:(

At first, I thought that is a driver problem and installed the driver new.
Now runs gluPerspective, but with weird dimensions   :o



[attachment deleted by admin]

Charles Pegge

  • Guest
Re: Wrong Dimension
« Reply #1 on: July 05, 2011, 03:41:44 PM »

Hi Peter,
I have not had a chance to try your direct Frustum perspective yet but gluperspective is what I have always used.

In portViewer1 and PortViewer2 I use both orthographic (for wire frame) and perspective projections.

The matrix mode must be in GL_PROJECTION and glLoadIdentity is used to initialise the matrix before applying perspective.

Your "aspect" is not working. I refresh mine from the viewport or client rect before each  frame.

Code: OxygenBasic
  1.  
  2.   '---------------------
  3.  sub orthopersp(long p)
  4.   '=====================
  5.  '
  6.  double m,n
  7.   n=orthosize
  8.   m=n*aspect
  9.   '
  10.  if p then
  11.     glOrtho  -m, m, -n, n, 1.0, 100.0 'left right bottom top near far
  12.  else
  13.     gluPerspective 45.0, aspect, 1, 100.0 'viewAngle,aspect,near,far
  14.  end if
  15.   end sub
  16.   '
  17.  '------------------------
  18.  sub SetProjection(long p)
  19.   '========================
  20.  '
  21.  glMatrixMode GL_PROJECTION
  22.   glLoadIdentity
  23.   orthopersp(p)
  24.   glMatrixMode GL_MODELVIEW
  25.   glLoadIdentity
  26.   end sub
  27.  

Charles

Peter

  • Guest
Re: Wrong Dimension
« Reply #2 on: July 06, 2011, 03:19:03 AM »
Hi Charles,

No changes here.

I ask me why my hWnd have got a single value instead of a long value.
hWnd = 59082.0000000016

Aspect works.  A direct value has the same effect .  [1.3333333]

Now I am trying an ATI card.

Charles Pegge

  • Guest
Re: Wrong Dimension
« Reply #3 on: July 06, 2011, 03:47:57 AM »

Ah that is interesting!. After initialising the screen / opengl pixel and also fonts, it is usually necessary to do finit, since some of these OS functions leave the FPU in a mess. The fpu is used for converting all numbers to Ascii. And this shows up when using print.

Charles