Results 1 to 2 of 2

Thread: Rotate view with mouse

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2007
    Location
    Netherlands
    Posts
    3

    Rotate view with mouse

    Hi all,

    I have currently made a basic OpenGL 3D cube in a scene. I now want to rotate this cube by mouse dragging it? How can I do this. "glRotate" doesn't seem to work very correct....

    Greets,

    Ralf

  2. #2
    Junior Member Newbie
    Join Date
    May 2007
    Posts
    21

    Re: Rotate view with mouse

    It probably won't if you're only trying to do it with one line of code. Have you tried it like:

    // rotate around the x axis
    glRotatef(rot_x,1.0f,0.0f,0.0f);
    // rotate around the y axis
    glRotatef(rot_y,0.0f,1.0f,0.0f);
    // rotate around the z axis
    glRotatef(rot_z,0.0f,0.0f,1.0f);

    Where rot_x, rot_y, rot_z are floats indicating how much you want to rotate around each axis?

    If this doesn't work, you'll need to post your code to show us what's going wrong.

    Daz.

Similar Threads

  1. Trying to Pivote/Rotate matrix/view?
    By ReturnVoid in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 05-10-2013, 08:53 PM
  2. 3d rotate in 2d ortho view h.u.d., hmmm?
    By RobertEd in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 01-31-2010, 07:36 PM
  3. rotate on mouse click and drag in the direction of the mouse cursor
    By vamsee kanth in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-02-2005, 09:54 PM
  4. Rotate A View
    By Swift in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 11-20-2003, 10:19 PM
  5. How to rotate a view point in the scene ?
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-14-2001, 02:17 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