Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: rotating faces to face the camera?

  1. #1
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40

    rotating faces to face the camera?

    Hello,

    I want to draw an antialised wireframe cube, with lines of a certain width (greater than 1). In OpenglES 2, on my devices at least, this isn't supported.

    I've had some success drawing 2D antialiased lines, by using the trick of drawing an extra rim of polygons along the edge, with the outermost vertices transparent.

    But if I were to do that in 3D, the polygons comprising a line would form a flat ruler shape, and it would change depending on the angle I looked at it. I was thinking I might be able to get it to work by rotating the polygons to face the camera. Has anyone done that? Will it work to achieve what I want?

    I think I would start with the 8 cube vertices. Then for each segment in the cube, I would create two more vertices at each endpoint, extending perpendicular to the segment on the plane facing the camera. Does that make sense? Anyone know how to compute those?

    Thanks
    Bob

  2. #2
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40
    Nobody? What do most people do if they want to draw antialiased lines in 3D space?

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Use multisampling and let the hardware do it for you.

  4. #4
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40
    But if the 'lines' are in 3D, you still have the problem of them becoming invisible when seen edge-on.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    Ah - you want wide lines - I have not used this but I think it is what you want
    http://sebastien.hillaire.free.fr/demos/simplevolumeline/



    EDIT
    better link

    http://sebastien.hillaire.free.fr/in...d=48&Itemid=30
    Last edited by tonyo_au; 02-06-2013 at 05:36 PM.

  6. #6
    Intern Newbie
    Join Date
    Nov 2010
    Posts
    40
    Yes I think that is what I want! Unfortunately OpenGLES2 doesn't do geometry shaders, but that article mentions an earlier technique that does not need them.

    Thanks,
    Bob

Posting Permissions

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