Results 1 to 4 of 4

Thread: How do I reset to original state?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    25

    How do I reset to original state?

    I have a 3D model which I load using glTextImage3d. I do lots of manipulation commands. At some point I want to reset to the original (default) position. How do I do this?

    I tried glLoadIdentity but it makes the screen go blank.

    I tried glLoadMatrix with matrices of 16 1's or 2's but that did not work.

    I know about push and pop but I don't want to save the state. I just want a command that will reset the opengl to default settings.

  2. #2
    V-man
    Guest

    Re: How do I reset to original state?

    The default modelview matrix is the identity matrix. What exactly is your question?

    What the heck is this
    I tried glLoadMatrix with matrices of 16 1's or 2's but that did not work.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    25

    Re: How do I reset to original state?

    There are examples on the internet where someone loads 16 1's or 2's into a float array and passes it to glLoadMatrix. That does nothing for me.

    My question is pretty clear. I have a 3D object. I move it around: roll, pitch, yaw, up/down, zoom in/out. I want to press reset and return it to its original location.

    glLoadIdentity blanks the screen out.

  4. #4
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    Re: How do I reset to original state?

    There are examples on the internet where someone loads 16 1's or 2's into a float array and passes it to glLoadMatrix.
    Where? I'd love to see that code.

    I have a 3D object. I move it around: roll, pitch, yaw, up/down, zoom in/out. I want to press reset and return it to its original location.
    Then reset it.

    OpenGL should not be used to store the position and orientation of an object. It should not hold on to it for any length of time. The way you render a frame with OpenGL is generally as follows:

    1: Set up transform to move object A to where you want it.
    2: Render object A.
    3: Set up transform to move object B to where you want it.
    4: Render object B.
    ...

    You should not have OpenGL's transformation matrices store the position of your object. You should store your rotations, translations, etc yourself, in your own data structures. And every frame, you apply these matrices to OpenGL, and then render your object.

    So to reset your transforms, you simply set your internal data back to whatever the "original location" is.

Similar Threads

  1. Separate sampler state from texture state
    By The Fiddler in forum OpenGL: General
    Replies: 79
    Last Post: 03-15-2010, 05:12 PM
  2. Transformation from current or original
    By jos_t_tarigan in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-10-2008, 03:45 AM
  3. How to reset all OpenGL state
    By anime.igala.net in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 08-20-2008, 10:59 PM
  4. rotation about the original Y and Z-axis
    By kampretz in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-17-2008, 08:40 PM
  5. Original depth values.
    By weber_ofir in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 09-07-2000, 09:41 AM

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