Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Orienting myself in OpenGL

  1. #1

    Orienting myself in OpenGL

    I seem to be having some trouble orienting myself in 3d world, im drawing single objects to get myself use to OpenGL. Though im sure my object are fine and should be drawing, im having trouble to figure where im facing in the world, if you know what im saying. I am fairly new to it all.

    Does anyone got any tips?

  2. #2
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Have you taken a look at Nehe's tutorials? if you're coming from the 2d world take a look at http://freepascal-meets-sdl.net/ and their 8th lesson since it covers 3d and opengl with opengl.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  3. #3
    yeah i had read through some of the nehe tutorials, i also got the red book 7th edition.
    I just remembered that the red book refers to nate robins suite, that has help me some what.

    Am i right when describing glutLookAt function like this:
    the first 3 cords(eye) define the angle the camera is look at. The next 3 cords(center) define a point that the camera is looking at, and last cords(up) define which way is up?

    Can i assume that you must only use one of:
    glFrustum
    gluPerspective
    glOrtho

    so not to use them in conjunction with each other?

  4. #4
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    the glutLookAt bit sounds a tad precarious to me, since from what I have heard glut is quite badly deprecated. Also, I do not see why you cannot use those together... Might I propose a slightly different approach, I would recommend an approach more where you have a program that does something, perhaps in sdl, and then try to break it down and port it to OpenGl so that you understand the program and then how to do it in OpenGl. That way you don't learn a hypothetical understanding of OpenGl but a practical one solving real programming problems...

    Just a thought. I am no OpenGl expert, so I can only suggest not really recommend strongly.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  5. #5
    I meant GluLookAt

    i think thats a good idea on learning the practical side, because the theory stuff is kicking my ass.

  6. #6
    @Code_glitch gluLookAt doesn't belong to glut library It belongs to OpenGL extentions defined in glu unit
    I was confusing that too and started to implement my own camera cause I wanted to get rid of this glut dependancy which turned out to be non-existant

    @MuteClown: The thing with gluLookAt is a bit different compared to your understanding of it. The first 3 parameters in the procedure are defining the position of the "camera" in space. Not the angle. The angle is calculated by procedure based on the position of the camera and point on which the camera is looking.

    You can mix gluOrtho with gluPerspective and even you should in some cases For example, to draw a menu, all the windows and so on, you should switch to gluOrtho, to render 3d objects you switch back to gluPerspective.

    I am beginner with OpenGL but feel free to ask any further questions. Maybe we could help each other

  7. #7
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Well, looks like I made the same mistake as wodzu here... Just a testament to show how little on the topic I know. I am familiar with glu, but if I might interject into this topic, what is glu? I just realized I include this but don't actually know what it is/does 8-} so yay for opengl and double yay for wodzu for pointing that out... And yes, ask me anything and I will see if I know anything useful... Who knows, my limited knowledge may be of some use yet (evil laugh)

    cheers,
    code_glitch
    Last edited by code_glitch; 16-03-2011 at 10:30 PM.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  8. #8
    cheers all

    Yeah Wodzu, i just read the section in the red book about the perspective matrix, and how you can draw 2d menus using the glOrtho. Since the perspective matrix is 2 deep, you can switch to glortho just to draw the menus etc...

    Glu(OpenGL Utility Library) is like another layer on top of OpenGL. So commonly used routines would be included, to extend from OpenGL. I think thats right describing it like that.
    Does anyone have a camera class that i could take a look at? I want to try to implement my own, so i can get a better understanding.
    Last edited by MuteClown; 17-03-2011 at 10:31 AM.

  9. #9
    I have a camera class which doesn't work to well Honestly this transformation of matricies and the order in which you transform objects is making me crazy I've spent two days thinking about why the cube is rotating in a particular way and still I am confused.

    And the red book doesn't make it any easier telling you that you can think about the order of transofrmation in two ways (top to bottom or bottom to top).

    Anyway, you can start to analyze camera things by looking at NeHe tutorial, the one in which you are moving like in a first person shoter.

  10. #10
    Quote Originally Posted by wodzu View Post
    I have a camera class which doesn't work to well Honestly this transformation of matricies and the order in which you transform objects is making me crazy I've spent two days thinking about why the cube is rotating in a particular way and still I am confused.

    And the red book doesn't make it any easier telling you that you can think about the order of transofrmation in two ways (top to bottom or bottom to top).

    Anyway, you can start to analyze camera things by looking at NeHe tutorial, the one in which you are moving like in a first person shoter.
    I know exactly what you mean by that, im still pondering the same in my head =/

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •