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 5976465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:13:58+00:00 2026-05-22T21:13:58+00:00

I am trying to understand the basic concepts around the co-ordinates system in OpenGL

  • 0

I am trying to understand the basic concepts around the co-ordinates system in OpenGL so I have been making a test application from guides online.

Presently I have drawn a simple Square to the screen, using simple Co-ordinates of:

          -1.0f,  1.0f, 0.0f,  // 0, Top Left
          -1.0f, -1.0f, 0.0f,  // 1, Bottom Left
           1.0f, -1.0f, 0.0f,  // 2, Bottom Right
           1.0f,  1.0f, 0.0f,  // 3, Top Right

In my application I run the following code:

     GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f, 100.0f);

My basic understanding here is that the code is setting the viewing port angle to 45 degrees and the width to height ratio of the window size.

Another thing I am doing is setting the viewing position as -4 units on the Z axis:gl.glTranslatef(0, 0, -4);

This is what the result looks like in Landscape…

Landscape

And in Portrait…

Portrait


My questions are:

How does the co-ordinate system work, how many Pixels does one unit represent? How does changing the orientation and width to height ratio effect the equation?

If I wanted to draw a square the size of the screen, with a View Port of 45 degrees and a Viewing position of z-4… how does one figure out the required width and height in units?

  • 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-22T21:13:59+00:00Added an answer on May 22, 2026 at 9:13 pm

    I’ll try to answer the best I can.

    There wouldn’t be any reason to change the width to height ratio or 45 degree angle. Doing it the way you have it keeps the things from being stretched horizontally or vertically in an unusual way. Because you are using a perspective view, you have 3D space with depth as apposed to an Orthographic view where there is no depth. In doing glTranslatef(0,0,-4) what you’ve actually done is changed the MODELVIEW Matix, moving it 4 in the negative z direction, presumably before actually drawing the square. By default, the “camera” is sitting at 0,0,0 with Y (up) as the upward direction.

    You may be able to translate 3D space to pixels, but with a Perspective view type, I’m not at all sure you’d really want or need to. A 2D Orthographic view would be a different story, though, as many people use OpenGL for 2D games as well. Wanting a square exactly the size of the screen, Orthographic is probably the way to go, and you should be able to with a few Google searches be able to figure out your pixel density to 2d space comparison.

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

Sidebar

Related Questions

I am trying to better understand basic concepts in OOP. What are static and
I'm trying to wrap my head around the basic concepts of the R programming
I am trying to understand basic OS concepts Want to know if my understanding
I have a very basic question and need help. I am trying to understand
I am trying to understand Nokogiri. Does anyone have a link to a basic
I'm trying to understand the basic concepts of hazards in pipelines. I know how
I am trying to understand something very basic. If I have an object like
I am digging into LINQ--trying to understand basic models (it seems pretty cool to
I'm trying to understand the basic MVVM design approach, but I dont' understand where
I'm trying to understand why this does not work. (Basic example with no validation

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.