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 3 of 3

Thread: Visualization of Corner-point grids

  1. #1
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2

    Visualization of Corner-point grids

    Hi guys

    Sorry for a stupid question, first of all. I would like to visualize a "corner-point grids" (http://en.wikipedia.org/wiki/Corner-point_grid) model using OpenGL only, but looks like it's not so obvious as I thought before .
    Typical model looks like this :



    So, am I right in thinking, that OpenGL doesn't provide "hidden surface removal" solutions and I have to implement all that stuff on CPU (I mean all that terible words : BSP trees, z-buffers, painter's algoritms etc) instead of using my GPU?

    Or may be someone can give me advice how to visualize such models, that would be really cool

    Thanks,
    Maxim

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,190
    Quote Originally Posted by maximspb View Post
    So, am I right in thinking, that OpenGL doesn't provide "hidden surface removal" solutions and I have to implement all that stuff on CPU (I mean all that terible words : BSP trees, z-buffers, painter's algoritms etc) instead of using my GPU?
    No. OpenGL comes built-in with Z-buffer "hidden surface removal" support. To use it:


    • Allocate a depth buffer (aka Z buffer) with your render target
    • Each frame, clear the depth buffer (i.e. glClear( GL_DEPTH_BUFFER_BIT ))
    • Enable depth testing: glEnable( GL_DEPTH_TEST ) and set the depth comparison function you want -- by default it is glDepthFunc( GL_LESS ).
    • When you define your PROJECTION transform, set up your NEAR and FAR clip planes to sandwich the objects in your scene (e.g. gluPerspective or glFrustum for perspective projection, or glOrtho or gluOrtho2D for orthographic projection).
    • Now just draw stuff, and only the closest at each pixel (or sample) will be kept.


    For high quality, allocate a render target with multisampling (MSAA) or supersampling (SSAA) capability. This gives you multiple samples per pixel, which get downsampled into a nice antialiased result in the end.
    Last edited by Dark Photon; 09-29-2012 at 05:40 PM.

  3. #3
    Newbie Newbie
    Join Date
    Sep 2012
    Posts
    2
    Thanks a lot, Dark Photon!!!

Posting Permissions

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