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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:32:27+00:00 2026-05-30T15:32:27+00:00

I was looking at examples of being able to represent transformations using a matrix

  • 0

I was looking at examples of being able to represent transformations using a matrix instead of the built in functions. I want to learn more about the low level functions WITHOUT using any of opengl’s matrix or transform functions

Say I have a matrix class:
class Matrix
{
public:
float data [ 3 ] [ 3 ];

Matrix ( void )
{
    int i, j;

    for ( i = 0; i < 3; i++ )
    {
        for ( j = 0; j < 3; j++ )
        {
            data [ i ] [ j ] = 0;
        }sa
    }
}
};

Example function:

Matrix scale ( Pt p, float alpha )
{
    Matrix rvalue;


        rvalue.data[0][0] = alpha;
        rvalue.data[0][1] = 0;
        rvalue.data[0][2] = (1-alpha)*p.x;

        rvalue.data[1][0] = 0;
        rvalue.data[1][1] = alpha;
        rvalue.data[1][2] = (1-alpha)*p.y;


        rvalue.data[2][0] = 0;
        rvalue.data[2][1] = 0;
        rvalue.data[2][2] = 1;


    return rvalue;
}

How would I apply those transformations using opengl? I’m not where where to start. Is there a function that cane take a 3×3 matrix and load it in?

  • 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-30T15:32:29+00:00Added an answer on May 30, 2026 at 3:32 pm

    You probably want one of glLoadMatrix or glMultMatrix. They take column-major 4×4 matrices so you’ll want to write a shim like:

    GLfloat matrix[16];
    
    matrix[0] = data[0][0];
    matrix[1] = data[0][1];
    matrix[2] = data[0][2];
    matrix[3] = 0.0f;
    
    matrix[4] = data[1][0];
    matrix[5] = data[1][1];
    matrix[6] = data[1][2];
    matrix[7] = 0.0f;
    
    matrix[8] = data[2][0];
    matrix[9] = data[2][1];
    matrix[10] = data[2][2];
    matrix[11] = 0.0f;
    
    matrix[12] = 0.0f;
    matrix[13] = 0.0f;
    matrix[14] = 0.0f;
    matrix[15] = 1.0f;
    
    glLoadMatrixf(matrix);
    

    So I’ve just padded out your data with the relevant parts of the identity matrix.

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

Sidebar

Related Questions

Looking at examples about socket programming, we can see that some people use AF_INET
I am looking for any examples or guides to using Linq over WCF (n-tier
Looking at examples and tutorials for some MVC libraries for web development on the
I'm looking for examples of specifying files in a tree structure, for example, for
I'm looking for examples of processing.js working in Internet Explorer via ExplorerCanvas or similar.
I've been looking at examples of REST API's like Netflix http://developer.netflix.com/docs/REST_API_Reference#0_59705 and Twitter and
I'm looking for examples where a human-based service replaced an automated one. For example,
I am looking for basic examples/tutorials on: How to write/compile libraries in C++ (
I'm looking for (simple) examples of problems for which JMS is a good solution,
I am looking for some examples of a .bat OR .wsh script that can

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.