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

  • SEARCH
  • Home
  • 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 7788965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:08:45+00:00 2026-06-01T21:08:45+00:00

I am using OpenGL with the LWJGL library in java. As I understand it,

  • 0

I am using OpenGL with the LWJGL library in java. As I understand it, you can use glFrustum to set up the top, bottom, left, right, near and far coordinates and you then use glViewport to relate those coordinates to the screen, is this correct ?
I assume this because nothing I have read has said otherwise and this is how it worked when I was using orthographic mode.
To expand on my question, I set up my application like this (in c syntax)

glFrustum(-100, 100, -100, 100, -100, 100);
glViewport(0, 0, 800, 600); // the screen size is 800 by 600

. . .

glBegin(GL_QUADS); //draw a rectangle
glVertex2f(-0.25f, -0.25f);
glVertex2f(0.25f, -0.25f);
glVertex2f(0.25f, 0.25f);
glVertex2f(-0.25f, 0.25f);
glEnd();

How is it possible that with a coordinates system of -100—–0—–100 on the x and y axis, that I get a rectangle of a size that looks like that the coordinates i supplied have been multiplied by 10 ?

  • 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-06-01T21:08:47+00:00Added an answer on June 1, 2026 at 9:08 pm

    As I understand it, you can use glFrustum to set up the top, bottom, left, right, near and far coordinates

    Not quite. glFrustum creates a affine perspective projection matrix, having the shape of a pyramid with the tip cut of – a frustum. If you’d extend that pyramid to the tip, the tip was at the coordinates (0,0,0), the near parameter defines the distance of the XY plane to the tip in Z direction as where to “cut” that pyramid. The far plane gives the distance to the pyramids base. The left, right, top and bottom parameters define, where the sides of the pyramid intersect with the near plane, which means, that the pyramid is not required to be symmetric. It can be shifted as well.

    and you then use glViewport to relate those coordinates to the screen, is this correct?

    OpenGL is a state machine. The order in which you call set those states doesn’t matter. You can change each state anytime, anyhow. The order is only important then, if the previous state contributes to the data/parameters setting the new state. The matrix operations are an example, because the operate on the previous state. But glViewport is independent of this.

    How is it possible that with a coordinates system of -100—–0—–100 on the x and y axis, that I get a rectangle of a size that looks like that the coordinates i supplied have been multiplied by 10?

    Because you’re not building a valid frustum. The near and far planes of a frustum projection must not have opposite signs. Usually you want them to be both positive. Also the near plane distance must be nonzero.

    The way you defined your “frustum” is is shaped like an hourglass. Also your vertices are at Z=0, so they’re in the singularity of that frustum and anything may happen there.

    I think you actually wanted a ortho projection.

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

Sidebar

Related Questions

I have a SWT app that opens a OpenGL window (using the LWJGL library)
I'm making a basic game in Java using the LWJGL Library via Netbeans. I've
I'm trying to make a copy of MineCraft in Java using OpenGL (LWJGL). The
I'm implementing a height map with GL_TRIANGLE_STRIPS and the LWJGL OpenGL Java Bindings. When
I'm trying to get a simple triangle drawn in Java using LWJGL. I'm trying
I am started to deal with OpenGL. My application is written in Java using
I'm using OpenGL ES 1.1 on the iPhone, and I'd like to use the
I have a problem with playing a sound using OpenAL in Java (LWJGL). Whats
When using OpenGL VBOs you can interleave your data You can even interleave vertex
Well, I'm trying to take a screenshot for a window in OpenGL using LWJGL.

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.