Results 1 to 4 of 4

Thread: Rotating a Cube randomly - which side is on top?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    2

    Rotating a Cube randomly - which side is on top?

    I just modeled a cube and after rotating it randomly I wish to know which side is on top. I am kind of new to opengl and dont know which is the best way to do it. I thought it would be nice to get the height value of each side of the cube and look for the biggest value. But i dont know how to get this information. Any Suggestions?

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,931

    Re: Rotating a Cube randomly - which side is on top?

    Uhm, make the sides different color? Anyway, OpenGL can't do it for you... it is for drawing objects, not finding out how they interact with the environment. You could take the normal vector for each side and transform it with the current modelview matrix, thus finding out which normal "looks up".

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2008
    Posts
    2

    Re: Rotating a Cube randomly - which side is on top?

    thx, maybe i dont expressed myself clearly. The sides have diffent colors and I only want to get on the position information of the differnt sides. Your suggestions sounds good, but it does not solve my problem, I dont know how to get the normal or current position for a side. Maybe something like getNormal(rightSide) would be nice.

  4. #4
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,931

    Re: Rotating a Cube randomly - which side is on top?

    If you have made a cube, you ought to know it's normals and positions (because you have made it)! There is no way to get this information from OpenGL (aside from using the feedback mode, but I won't talk about it).

Similar Threads

  1. Lateral side of the cube being lit by specular light
    By YardenJ2R in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 06-16-2017, 05:59 PM
  2. smooth rotating cube
    By tvus_ogl in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 05-02-2017, 07:40 AM
  3. rotating a cube
    By Zork in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 11-15-2002, 10:12 AM
  4. Textured Cube: Diff tex. on each side
    By Blaqb0x in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 06-24-2002, 12:01 AM
  5. ROTATING CUBE
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-10-2001, 10:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean