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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:17:04+00:00 2026-06-10T19:17:04+00:00

I am using OpenGL ES 2.0 to display a 3-dimensional cube which I display

  • 0

I am using OpenGL ES 2.0 to display a 3-dimensional cube which I display in a certain perspective with rotations around the x,y,z axes.

@interface OpenGLView : UIView

OpenGLView *openGLRotate = [[OpenGLView alloc] initWithFrame:screenBounds];
[openGLRotate setupDisplayLink:NO Face:face Direction:direct];

- (void)setupDisplayLink:(BOOL)bFlag Face:(CubeFace)f Direction:(CubeDirection)d
{
    CADisplayLink* displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(renderRotate:)];
    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}

I would like to rotate the cube around an axis perpendicular to the face, which is NOT the x, y, or z axis.

Seeing as the default perspective of the cube has been rotated around the x,y,z axes, rotating around an axes relative to a specific face involves varying the x,y,z axes values at the same time to achieve the effect I am looking for.

// code in renderRotate
//[modelView rotateBy:CC3VectorMake(20, -45, -20)]; // default perspective
[modelView rotateBy:CC3VectorMake(20 + x, -45 + y, -20 + z)];

I’ve read about vectors and matrices and quaternions and euler angles and I feel more confused instead of less.

I’m not exactly sure how to determine the x,y,z values for the rotation. Any guidance on how to calculate these values would be appreciated, or is there another approach I should take?

  • 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-10T19:17:06+00:00Added an answer on June 10, 2026 at 7:17 pm

    It occurred to me I was trying to do two separate and different things in a single statement.

    [modelView rotateBy:CC3VectorMake(20 + x, -45 + y, -20 + z)];
    

    I am trying to rotate the cube to display in a certain perspective, and rotate the cube for a dynamic animation.

    Those are actually unrelated rotations and need to be done separately.

    First I apply the rotation to display the cube in the desired perspective;

    [modelView2 rotateBy:CC3VectorMake(20, -45, -20)];
    

    Then I apply the necessary rotation for the animation:

    [modelView2 rotateBy:CC3VectorMake(x, y, z)];
    

    I believe (and I may be wrong about the specifics here) that the actual rotations are applied in the reverse order (LIFO) so the animation rotation is applied in the standard xyz coordinate system first, followed by the rotation to display in the desired perspective.

    Works perfectly.

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

Sidebar

Related Questions

I am trying to display a texture on a square using opengl es 1
Using OpenGL ES I am rendering a simple cube class that draws it at
I am trying to display an image using OpenGL ES through android NDK.. What
I am trying to perform several image manipulations using OpenGL ES 2.0 and display
I'm currently developping an iPad app which is using OpenGL to draw some very
I'm using OpenGL ES to display some objects exported from Blender. Blender provides a
I am trying to display a simple triangle with OpenGL (I am using freeglut3-dev
I need to display 2d images in opengl using textures. The image dimensions are
I write a 3D model display program using OpenGL、Qt、C++.But I found something strange.That is
I am using the opengl es to display objects. when the object is near

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.