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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:10:19+00:00 2026-05-30T03:10:19+00:00

I do realize that glPush/Pop matrix functions are not supported by many platforms (so

  • 0

I do realize that glPush/Pop matrix functions are not supported by many platforms (so don’t shoot me) but does anyone knows how should I replace them without breaking my existing code base?

  • 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-30T03:10:20+00:00Added an answer on May 30, 2026 at 3:10 am

    Since these funcs are deprecated along with fixed function on many platforms and new core versions, you have to supply the matrices to your own shader (mandatory) as uniforms.
    gl_ModelViewMatrix, gl_ModelViewProjectionMatrix and other builtin uniforms are removed from GLSL along with fixed function in all new OpenGL (core) versions aswell, regardless the platform.

    Therefore, the decision should not be based on platforms, since all new core profiles don’t have those functions anymore. Replacing this requires some effort, but will improve portability to all platforms and more importantly, (forward) compatibility to the new ones.
    Implementing a client side matrix stack is not that hard either.

    EDIT: See this C++ example template, which mimicks the OpenGL matrix stack. It lacks the matrix math implementations, does not use the STL stack due to reasons not visible here, but shows the math operations to be done:

    EDIT 2: added error check (1 element is the minimum stack size)

    template<typename T>
    class MatrixStack
    {
    public:
        typedef T matrix_type;
    
    private:
        std::vector<matrix_type> stack;
    
    public:
        MatrixStack(void)
        {
            stack.push_back(matrix_type::identity());
        }
    
        void clear(void)
        {
            stack.clear();
            stack.push_back(matrix_type::identity());
        }
    
        size_t size(void) const
        {
            return stack.size();
        }
    
        void push(void)
        {
            matrix_type tmp = stack.back(); //required in case the stack's storage gets reallocated
            stack.push_back(tmp);
        }
    
        bool pop(void)
        {
            if (size() > 1)
            {
                stack.pop_back();
                return true;
            }
            else
            {
                return false;
            }
        }
    
        void load(const matrix_type& matrix)
        {
            stack.back() = matrix;
        }
    
        void loadIdentity(void)
        {
            load(matrix_type::identity());
        }
    
        void loadTransposed(const matrix_type& matrix)
        {
            load(transpose(matrix));
        }
    
        void mult(const matrix_type& matrix)
        {
            load(stack.back() * matrix);
        }
    
        void multTransposed(const matrix_type& matrix)
        {
            load(stack.back() * transpose(matrix));
        }
    
        const matrix_type& get(void) const
        {
            return stack.back();
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that Go does not have classes but pushes the idea of structs
I realize that PHP does not support unsigned integers, but I'm wondering how to
I realize that GWt doesn't compile the classes not in the Client package. But
I realize that it's been asked and answered that Visual Studio does not support
I realize that this question might not make sense to some, but I was
I realize that these might not necessarily be a huge performance issue, but I'd
I realize that there are many questions similar to this one, but having looked
I realize that this question spans many technologies, but I am only looking for
I realize that this is not possible since Android doesnt have a JVM but
I do realize that this question seems very well known, but since I don't

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.