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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:57:17+00:00 2026-06-15T07:57:17+00:00

I just read this: OpenGL provided support for managing coordinate transformations and projections using

  • 0

I just read this:

“OpenGL provided support
for managing coordinate transformations and projections using the standard matrix stacks
(GL_MODELVIEW and GL_PROJECTION). In core OpenGL 4.0, however, all of the functionality
supporting the matrix stacks has been removed. Therefore, it is up to us to provide our own
support for the usual transformation and projection matrices, and then to pass them into our
shaders.”

This is strange, so how do I set the modelview and projection matrices now? I should create
them in the opengl app and then multiply the vertices in the vertex shader with the matrices?

  • 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-15T07:57:18+00:00Added an answer on June 15, 2026 at 7:57 am

    This is strange

    Nope. Fixed function was replaced by programmable pipeline that lets you design your transformations however you want.

    I should create them in the opengl app and then multiply the vertices in the vertex shader with the matrices?

    If you want to have something that would work just like the old OpenGL pair of matrix stacks, then you’d want to make your vertex shader look, for instance, like:

    in vec4 vertexPosition; 
    // ...
    
    uniform mat4 ModelView, Projection;
    
    void main() {
        gl_Position = Projection * ModelView * vertexPosition;
        // ...
    }
    

    (You can optimise that a bit, of course)

    And the corresponding client-size code (shown as C++ here) would be like:

    std::stack<Matrix4x4> modelViewStack;
    std::stack<Matrix4x4> projectionStack;
    
    // Initialize them by
    modelViewStack.push(Matrix4x4.Identity());
    projectionStack.push(Matrix4x4.Identity());
    
    // glPushMatrix:
    stack.push(stack.top());
        // `stack` is either one stack or the other;
        // in old OpenGL you switched the affected stack by glMatrixMode
    
    // glPopMatrix:
    stack.pop();
    
    // glTranslate and family:
    stack.top().translate(1,0,0);
    
    // And in order to pass the topmost ModelView matrix to a shader program:
    GLint modelViewLocation = glGetUniformLocation(aLinkedProgramObject,
                                                   "ModelView");
    glUniformMatrix4fv(modelViewLocation, 1, false, &modelViewStack.top());
    

    I’ve assumed here that you have a Matrix4x4 class that supports operations like .translate(). A library like GLM can provide you with client-side implementations of matrices and vectors that behave like corresponding GLSL types, as well as implementations of functions like gluPerspective.


    You can also keep using the OpenGL 1 functionality through the OpenGL compatibility profile, but that’s not recommended (you won’t be using OpenGL’s full potential then).

    OpenGL 3 (and 4)’s interface is more low level than OpenGL 1; If you consider the above to be too much code, then chances are you’re better off with a rendering engine, like Irrlicht.

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

Sidebar

Related Questions

I've just read this description of the Android Support Package / Compatibility Library... http://developer.android.com/sdk/compatibility-library.html
I just read this great answer from BalusC about how to upload files with
I just read this requirement on a job listing: Aware of the pitfalls of
I just read this: http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx I was under the impression that overwriting Object or
I just read this article: http://www.acunetix.com/websitesecurity/upload-forms-threat.htm which discusses some of the security risks involved
I just read this question and stumbled upon the following quote: Scala treats ==
I have just read this in the book OpenCV 2 Computer Vision Application Programming
I've just read this snippet from another answer : When you create a block
I just read on this answer (answer has since been removed) and I'm sure
I just read two articles over this topic which provide infomration inconsistent, so I

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.