PDA

View Full Version : Visualization of Corner-point grids



maximspb
09-29-2012, 08:56 AM
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 :
http://www.halliburton.com/public/landmark/contents/Overview/images/nexus3.jpg?SRC=NexusReservoirSimulationSoftwareIma ge3
http://brcgranier.pagesperso-orange.fr/gmeop/Esg2001/adipec_1998/Fig-17.gif

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

Dark Photon
09-29-2012, 05:29 PM
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.

maximspb
10-01-2012, 11:09 PM
Thanks a lot, Dark Photon!!!