Results 1 to 3 of 3

Thread: Billboarding

  1. #1
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Billboarding

    Hi, i want to use billboarding for a particle-system. I know how to do billboarding, but i am not sure if it is the only and best way. I read it in a book:

    // get the modelview matrix
    float mat[16];
    glGetFloatv(GL_MODELVIEW_MATRIX, mat);

    // get the right and up vectors
    VECTOR right(mat[0], mat[4], mat[8]);
    VECTOR up(mat[1], mat[5], mat[9]);

    float size = 2.0f;

    // bottom left corner
    glVertex3fv((pos + (right + up) * -size).v ());
    // bottom right corner
    glVertex3fv((pos + (right - up) * size).v ());
    // top right corner
    glVertex3fv((pos + (right + up) * size).v ());
    // top left corner
    glVertex3fv((pos + (up - right) * size).v ());


    This would create a 4*4 quad. However this is a bit much of work to do, i think. It means many calculations for every single sprite. Do you know, if one could do this easier? I thought it might be possible to rotate the camera in a way so that every quad i draw in the xy-plane should be parallel to the screeen.

    I hope you understand what i mean.

    Thanks,
    Jan.
    GLIM - Immediate Mode Emulation for GL3

  2. #2
    Senior Member Regular Contributor
    Join Date
    Dec 2001
    Location
    Belmont, CA, USA
    Posts
    216

    Re: Billboarding

    If all the quads are the same size, you can precompute the vertex offets

  3. #3
    Member Contributor
    Join Date
    Oct 2000
    Location
    Pittsburgh, PA
    Posts
    52

    Re: Billboarding

    hmm...

    what storing in bitmap format in an array of GLubytes, then using

    glRasterPos3f(x, y, z);
    glBitmap(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bits);

    I know this will always draw the sprite with the orientation you want, but I have not tried it. So I don't know how tough it would be to load or if it's any more or less optimal.

    If anybody has any thoughts on this please let me know.

Similar Threads

  1. billboarding
    By Alessandro_dup1 in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 06-15-2003, 08:21 AM
  2. billboarding
    By dmsy in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-21-2000, 03:33 PM
  3. Billboarding???
    By imported_Dan in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-10-2000, 06:22 AM
  4. Billboarding???
    By imported_Dan in forum OpenGL: User Software
    Replies: 1
    Last Post: 03-07-2000, 10:10 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