PDA

View Full Version : Problem with Texture map & GL_POINTS



vijaykiran
08-06-2003, 08:11 AM
Hi all,

I have been doing some terrain visualization with physical mass flows running over the terrain. I have developed my own
routines to visualize the terrain with texture mapping using GL_TRIANGLES. I was successful until that point seamlessly.
Depending upon the massflow data files I have been given, I would just need to display the points over the terrain.

For example, I have a static terrain texture map rendering properly. I have say 10 data files containing the x,y,z location of say
5000 points in each data file. I had this necessity of reading first datafile set, display it. Then read the second datafile, display it,
so on until the 10th file is read in and displayed over the terrain.

The mass flow datasets are so pre-calculated so that they run either on the surface or slightly above, but they dont reach below
the surface at any cost.

I would need to build this application in SGIs, Solaris, Windows and Linux platforms. I am successful in getting outputs in
these platforms, but each one of them shows a different kind of outputs when it comes to the massflows over the terrain.
I get a perfectly correct simulation that I wanted and expected on SGI Octane, SGI Octane2 and SGI Fuel. All these massflow
points from the datafiles flow above the terrain. But in all other machines - SGI O2, Windows(VC ++ executable), and Linux, I
can see points diving under the terrain, which should not happen.

I use OpenGL API using C for coding. I enable lighting when terrain is displayed, and disable it when I display the mass flow
over the terrain. I use GL_POINTS for points(mass flow) flowing over the terrain. When I read the datafiles to obtain the x,y,z
location of points, I first read them as strings, and using atof, I convert them to doubles. I double checked that the x,y,z values in
the data files are the same precision numbers when I display them too.

I have no clue as to whether its a problem with the code or a hardware issue. I am sure many people might have encountered
such issues. Could anyone throw me some light on this issue. It is very important that the massflow points shouldnt go under the
terrain.

Thanks in advance,
Vijay.

Relic
08-07-2003, 12:52 AM
I suspect depth buffer precision differences.
Check what number of depth bits you got in the different implementations.
PC based solutions normally provide 16, 24, or 32 bits. Hardware accelerated are 16 and 24 normally. Try to request 24 and check if you got it.
Make your zFar/zNear ratio in the frustum as small as possible to increase depth buffer precision.
Converting data to double precision is not affecting OpenGL internal handling. Most implementations are using floats (IEEE 32 bits). Using float can improve performance over using doubles.