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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:48:23+00:00 2026-05-22T00:48:23+00:00

How do I change default cord system and units in OpenGL? Right now it’s

  • 0

How do I change default cord system and units in OpenGL?

Right now it’s using the default, meaning it goes from -1.0 (left) to 1.0 (right) with 0 being the origin (same with Y, -1.0 being top, 1.0 being bottom).

Optimally I would 1) want to change units to roughly same number of pixels. For example, on an 800×600 display have it go from -400 to 400 (on x) and -300 to 300 (on y). Seems like it would be easier to work with than -1.0 to 1.0

2) Bonus points: how do I change the x/y? One game engine had I seen had it go from 0 to maxWidth and 0 to maxHeight.

That is, 0,0 was top left and 800,600 was bottom right. (0, 600 would be left bottom and 800,0 would be top right)

I think these both have to do with the viewpoint command, but don’t know if I fully understand it.

  • 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-22T00:48:23+00:00Added an answer on May 22, 2026 at 12:48 am

    First answering your last point: There is no “viewpo i nt” commant. There is glViewport which defines the mapping from so called clip space [-1,1]×[-1,1]×[-1,1] into window/screen space — important: glViewport doesn’t set some clipping, so if your viewport only covers some smaller, middle part of your window, things that exceed the viewport in rendering may/will cause artifacts outside the viewport. Scissor testing (enabled and set with *glEnable(GL_SCISSOR_TEST)* and glScissor) does this kind of clipping, which also works within the viewport (nice for implementing selection rubber bands!).

    Now to cover your first question: OpenGL’s coordinate system is whatever you want it to be; in OpenGL-3.1 and OpenGL-4 there’s no default coordinate system at all! In OpenGL-2 and below there are a number of so called transformation matrices, most importantly modelview and projection.

    You can think projection to be some kind of a camera’s lens (although it works entirely differently). What is does is, it transforms the world (or modelview) space into the aforementioned clip space. It is this projection matrix, that allows you map any affine coordinate system into clip space. OpenGL before version 3 provides you helper functions glFrustum and glOrtho for the most oftenly used projections: Perspective and Ortho.

    Let’s construct some projection ourself (it’s an ortho, but I’d like to show how things work on the math side). Say you’d like to map x in [0; 200], y in [0; 100] to [-1; 1] (left to right), [-1,1] (top to bottom), and leave z as it is. Then

    x_clip = -1 + x*(1-(-1))*(200-0) = -1 + x*2/200
    y_clip =  1 + y*(-1  1 )*(100-0) =   1 + x*(-2)/100
    z_clip = z
    

    This translates into the following matrix:

    2/200      0     0    -1
        0 -2/100     0     1
        0      0     1     0
        0      0     0     1
    

    You could now put this into the projection matrix using glLoadMatrix.

    The modelview matrix is used for moving stuff around in the world space. It’s also used to define the viewpoint: OpenGL has no camera. Instead we just move the whole world in an opposite way to how we’d moved a camera within the world to the desired viewpoint (this time …point, not …port!)

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

Sidebar

Related Questions

I'm trying to change default firstDayOfWeek for java.util.Calendar from SUNDAY to MONDAY. Is it
Is it possible to change default formatting of Date object in JSP pages? Now
How can I change default Generate Method Stub behavior in Visaul Studio to generate
how I can change default font to Monaco with antialiasing on Emacs 23. Where
I want to change the default margins of Browser through JavaScript because I want
I want to Change default installation path which is Program Files in windows application
How to change default shortcuts? For example, I want to try Caps+S instead of
Is there any way to change default font of controls in winforms. I must
In WPF I want to change default close behaviour of some window, so that
How do I change default Directory and index File for Apache (installed via XAMPP)

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.