Results 1 to 6 of 6

Thread: glFrustum and textures

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2001
    Location
    Yeovil, Somerset, UK
    Posts
    12

    glFrustum and textures

    This is really confusing me, can anyone help:

    having changed from gluPerspective to glFrustum, to stop my image distorting, the very pretty texture i had as the sky has disappeared, and now i'm just left with the background colour, which pretty much ruins the image.

    any ideas would be appreciated.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glFrustum and textures

    Did you convert the parameters from gluPErspective to glFrustum properly? How did you do, and what parameters are you passing to glFrustum?

    If nothing more than the backround shows up, you have certainly passing some strange parameters.

    By the way, what do you mean by distorted images? gluPerspective uses glFrustum to build the projection matrix, so there aren't any differences, apart form the arguments you pass.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2001
    Location
    Yeovil, Somerset, UK
    Posts
    12

    Re: glFrustum and textures

    As far as i know the parameters are correct. Originally the image was square, but i wanted to make it rectangular (roughly monitor shaped). the problem was that when i made the viewport rectangular, the image just stretched sideways.
    i tried altering the aspect, and the field of view to no avail, so when someone suggested glFrustum, i tried that.
    i pass the left, right, top and bottom parameters to glFrustum, as well as the near and far limits. the image now looks correct, the object in the centre of the screen appears correctly, and the ground terrain (which is textured) also appears correct

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glFrustum and textures

    When you changed the aspect ratio, did anything at all happened to your image, or did it remain unchanged?

    Give some more detail on what you did, like code, formulas.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2001
    Location
    Yeovil, Somerset, UK
    Posts
    12

    Re: glFrustum and textures

    Changing the aspect ratio made no difference to the image.

    the code while using gluPerspective was (it's written in fortran90 btw):

    aspect = real(632/450)
    call gluPerspective(75.0_gldouble, aspect, 0.1_gldouble, 100000.0_gldouble)

    the image was 632 pixels wide by 450 high.

    the glFrustum code is:

    call glFrustum(0.14_gldouble, -0.14_gldouble, -0.1_gldouble, 0.1_gldouble, 0.2_gldouble, 100000.0_gldouble)

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glFrustum and textures

    To me, it seems like the aspect ratio is constant, not depending on any variable holding the size of the viewport.

    And I strogly suggest you lower the near to far ratio a bit. The bigger the ratio far/near, the less percise is the depthbuffer. If you need your far plane at 100000, I suggest you move the near plane up to about 10, if not even 100.

Similar Threads

  1. glFrustum
    By Mukund in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-10-2010, 08:33 AM
  2. help about glFrustum
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-16-2005, 10:32 PM
  3. glFrustum
    By Vlasko in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-28-2003, 09:11 AM
  4. glFrustum
    By arieb in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-06-2001, 06:13 PM
  5. glFrustum
    By imported_Flavius in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-18-2001, 03:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean