Results 1 to 4 of 4

Thread: Always Point to Camera

  1. #1
    Guest

    Always Point to Camera

    Hello,

    How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I'm kinda inexperienced with matrix operation/information.

    Thanks.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Always Point to Camera

    Are you talking about billboarding?
    Or sort of like an overlay, like a space ship's control's or user stat's.

    In billboarding you just rotate the object in reference to the camera position, look at vector math, sin/cos.

    Like an overlay would work like this...
    Just draw it before using gluLookAt or glRotate or gltranslate.
    Only thing drawn after will be moved.


    Originally posted by JohnnyM:
    Hello,

    How do I make a polygon (quad, or sprite-like polygon) always be pointing to the camera? I believe this has something to do with matrices and getting vectors from the modelview matrix, but I'm kinda inexperienced with matrix operation/information.

    Thanks.

  3. #3

    Re: Always Point to Camera

    i think he meant billboarding...anyway, if it's billboarding, search around the net for it, there're lots of sites about it (and codes too! =) ).

    if it's overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode...i think there's a tutorial on this at gametutorials.com (not sure though)...i thought of this method myself after needing a mouse cursor... .

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,068

    Re: Always Point to Camera

    I also do that switching between ortho and perspective, when using bitmap text.



    Originally posted by nomad82:
    i think he meant billboarding...anyway, if it's billboarding, search around the net for it, there're lots of sites about it (and codes too! =) ).

    if it's overlay, well, i have a diff. way of creating an overlay than nexusone, i push my matrices and then switch to ortho mode, then draw whatever i want to draw in 2d (like mouse cursor =) ), then switch back to perspective mode...i think there's a tutorial on this at gametutorials.com (not sure though)...i thought of this method myself after needing a mouse cursor... .

Similar Threads

  1. Point lighting and camera moving
    By congard in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-30-2018, 05:22 AM
  2. Convert 3d point to 2d always flat to camera
    By ax2638 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-13-2016, 11:19 AM
  3. rotating a camera around a point.
    By seckley in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-03-2007, 11:33 AM
  4. Camera rotation about a point.
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-08-2005, 12:27 PM
  5. how to project a 3D point in 2D Camera
    By andriuha in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 04-01-2003, 04:55 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