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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:51:06+00:00 2026-05-24T22:51:06+00:00

I’m jumping back into the world game programming after a 2yr hiatus. Unfortunately, most

  • 0

I’m jumping back into the world game programming after a 2yr hiatus. Unfortunately, most of my knowledge pertaining to 3D math is rather rusty. So bear with me.

My engine and game were originally designed for DirectX, which is a left-handed system that uses a row-major Matrix structure. My math code is all home-brew and works perfectly within the confines of that system. I’m at a point where I want to give my game an OpenGL renderer. Since all my math uses a left-handed, row-major Matrix system (for example, to create a projection matrix), how hard would it be to port my math to OpenGL’s left-handed, column major system?

Is it a matter of transposing the matrix and sticking the values into a column-major struct? Or am I simplifying this too much.

  • 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-24T22:51:08+00:00Added an answer on May 24, 2026 at 10:51 pm

    It depends. Are we talking shader-based OpenGL or fixed-function (FF)?

    In FF land, what you need to do is use gluPerspective (or glFrustum) to generate your perspective matrix, using similar parameters that you would give to your code under D3D. Then, you need to transpose the matrices you would compute for D3D (leaving out the projection component of the computation) to make the column-major, the way that glLoad/MultMatrix wants.

    And then, you need to generate a matrix to flip your scene, which you put at the very bottom of the GL_MODELVIEW stack. The easiest way to figure out what to do is to just render everything and see how the world is inverted. Then stick a matrix there which negates along an axis; if that fixes it, you’re done.

    In pseudo-code, what you do is this:

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(/*Projection parameters here*/);
    
    glMatrixMode(GL_MODELVIEW);
    glLoadMatrixf(/*Your flip matrix here*/);
    glPushMatrix();
    
    //Render your stuff here.
    //When rendering an object:
    Matrix mat = ComputeD3DModelToCameraMatrixForObject();
    mat = Transpose(mat);
    glPushMatrix();
    glMultMatrixf(GetMatrixAsFloatArray(mat));
    //Draw the object.
    glPopMatrix();
    
    //When finished rendering stuff:
    glPopMatrix();
    

    In shaders, things are simpler. This assumes that you’re using your own uniforms to pass matrices to GLSL.

    Really, all you need to do is look at the differences between the clip-space that OpenGL uses and the clip-space that D3D uses. Clip-space is the space of the vertex positions output from the vertex shader. You can pass your matrices to GLSL as normal, since the glUniformMatrix functions have a parameter that allows you to specify if the matrix is transposed (row-major). Once you have computed the D3D clip-space positions as you would have for D3D, simply modify the results based on what OpenGL expects.

    I don’t recall the differences off-hand, but the OpenGL specification section 2.13 (in version 3.3, it may be a different section for other versions) very explicitly details the coordinate system expected, as well as the subsequent transformations to window-space.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.