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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:38:32+00:00 2026-05-29T21:38:32+00:00

I am doing some work with opengl es on the iPhone and I am

  • 0

I am doing some work with opengl es on the iPhone and I am stuck at a particular point. All the code samples on the internet show you how a matrix can be rotated about the x axis, y axis or the z axis but no one talks about how a matrix can be rotated about an arbitrary point?

I am using open gl es 2.0. Any help would be appreciated.

Regards,

  • 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-29T21:38:33+00:00Added an answer on May 29, 2026 at 9:38 pm

    It sounds like you’re asking how to construct a matrix that rotates around one of those axes, but at a different point. The way you do that is to first translate to that point, and then apply the rotation for the axis you want. The order of multiplication of matrixes depends on whether you think of it as the axes moving or the geometry.

    If you also want to be able to do a rotation of arbitrary x, y, z angle at the same time, you can use the matrix discussed in this article:

    static inline void Matrix3DSetRotationByRadians(Matrix3D matrix, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
    {
        GLfloat mag = sqrtf((x*x) + (y*y) + (z*z));
        if (mag == 0.0)
        {
            x = 1.0;
            y = 0.0;
            z = 0.0;
        }
        else if (mag != 1.0)
        {
            x /= mag;
            y /= mag;
            z /= mag;
        }
    
        GLfloat c = cosf(angle);
        GLfloat s = fastSinf(angle);
        matrix[3] = matrix[7] = matrix[11] = matrix[12] = matrix[13] = matrix[14] = 0.0;
        matrix[15] = 1.0;
    
    
        matrix[0] = (x*x)*(1-c) + c;
        matrix[1] = (y*x)*(1-c) + (z*s);
        matrix[2] = (x*z)*(1-c) - (y*s);
        matrix[4] = (x*y)*(1-c)-(z*s);
        matrix[5] = (y*y)*(1-c)+c;
        matrix[6] = (y*z)*(1-c)+(x*s);
        matrix[8] = (x*z)*(1-c)+(y*s);
        matrix[9] = (y*z)*(1-c)-(x*s);
        matrix[10] = (z*z)*(1-c)+c;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some work with the Parser API in Spidermonkey. The docs show that
I have an OpenGL program in which I am doing some augmented reality work.
After doing some work with Ruby, Rails, and RSpec last summer and I learned
I'm looking at doing some work (for fun) in a compiled language to run
I am doing some work on a web site that has a secure area
I am doing some work on an asp website that uses Access as its
I am doing some work to track down a perceived bug in a git
I'm doing some work with Ukkonen's algorithm for building suffix trees, but I'm not
I'm doing some work with registry hives, and I need to know if the
I am doing some work on an inbound call demand capture system where each

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.