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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:25:38+00:00 2026-06-09T10:25:38+00:00

I have a cube in my OpenGL view which I can rotate when I

  • 0

I have a cube in my OpenGL view which I can rotate when I touch outside of the cube. Now I can detect which side of the cube I touch and now I’m trying to find out towards what side the touch movement is going. So if I touch the top side, the movement can go towards LEFT, RIGHT, FRONT or BACK side of the cube. The cube’s orientation can be anything when doing this.

so after figuring that out I’d make it rotate around the correct axis.

I just need an idea of how to implement this.

EDIT:
Here’s a crude example of what I’m trying to do. Sorry, I’m bad at explaining.

the green thing is a finger touching the red side. The arrow shows the direction the finger is moving. Since it’s moving towards the blue side (2), it should return 2. If it moved towards the green side (1), it would return 1 and so on.

  • 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-09T10:25:39+00:00Added an answer on June 9, 2026 at 10:25 am

    Here is an approach:

    When you swipe and lift your finger up, you get two 2D points in screen space: ptBegin and ptEnd. Convert these to 3D (you will need to do an equivalent of gluUnproject to get the 3D coords) and you will get the 3D coordinates ptBegin3D and ptEnd3D in the cube’s coordinate system.

    Calculate the vector D = ptEnd3D – ptBegin3D.

    Now, if you do a dot product of above with the cube face normals (0, 0, 1), (1, 0, 0), etc., you will know from the value which cube face you are moving towards.

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

Sidebar

Related Questions

I have a cube which I want to rotate. I also have a light
I have created a rotating CUBE with the help of OPENGL in Android now
I have spent about 2 Days trying to find out how to make 3d
I have a ball moving inside a cube, and I detect when it goes
Right now I'm drawing a cube with OpenGL, I'm using Windows and WGL context.
I am new to OpenGL programming.I have made a rotating cube with different images
I am a beginner at using openGL. I have used a program which I
OpenGL: no light for a simple glut cube Hi, i'm trying to study lights
If I have a cube mesh in OpenGL ES and I want to have
I am new to OpenGL and am currently trying to render a cube with

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.