Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7657903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:07:31+00:00 2026-05-31T13:07:31+00:00

I have an init() method, and I am trying to create a Perspective rendering.

  • 0

I have an init() method, and I am trying to create a Perspective rendering. Below is the code I have so far, but the numbers that I’m passing to gluPerspective(fovy, aspect, zNear, zFar) are wrong. I think fovy is the field of view (60 degrees), and aspect is the aspect ratio (width / height), but I don’t know what zNear and zFar are.

public void init(GLAutoDrawable gld) {
    //We will  use the default ViewPort

    GL gl = gld.getGL();
    glu = new GLU();

    gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);


    glu.gluLookAt(
            25, 15, 0, // eye
            25, 15, 30, // at
            0, 1, 0 // up
            );



    // Set up camera for Orthographic projection:
    gl.glMatrixMode(GL.GL_PROJECTION);
    gl.glLoadIdentity();
    glu.gluPerspective(60, 500/300, 0.0, 60.0);

    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:07:32+00:00Added an answer on May 31, 2026 at 1:07 pm

    Near and far values specify the range in which objects are visible (they define the near and far clipping planes). Indeed objects more far than 60.0 will not be visible using that perspective.

    As Tim as already commented, it’s bettere to explicitly write floating point values (i.e. 500.0f/300.0f).

    But worse, you setup the look-at matrix before setting it to identity (assuming that at the beginning of the method the matrix mode is GL.GL_MODELVIEW). Probably it is better the following sequence:

    gl.glMatrixMode(GL.GL_MODELVIEW);
    gl.glLoadIdentity();
    glu.gluLookAt(...);
    

    Maybe you need to investigate more about the camera abstraction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an init method that takes an (id) argument: -(id) initWithObject:(id) obj; I'm
I have been trying to create a decorator that can be used with both
I have a method which runs this: Track* track = [[Track alloc] init:[obj objectForKey:@PersistentID]
I have a web service (ASMX) and in it, a web method that does
I am trying to create a upload form using servlets, and so far i
i have done this in c++ but i am trying it to python and
I have a problem with the init() method of a standard NSObject. I wrote
Hi I am trying to create a packet that I want to send over
I'm trying to create a database that contains mock objects for testing purposes. I'd
I have implement the following code to create a SSL server socket. public void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.