PDA

View Full Version : Problem with Texture mapping & GL_POINTS



vijaykiran
08-06-2003, 09:50 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.

Brian Paul
08-06-2003, 10:35 AM
Are you using Z buffering? If so, are you requesting a GLX visual with a Z/depth buffer?

-Brian

JanHH
08-09-2003, 09:24 PM
I think you have to assure that your points do indeed not lie under the surface, for this you have to find out the surface height at any given point. I could imagine the following to be the problem:

the terrain data is not "exact", you only have a limited number of height values, out of which triangles are constructed (at least, I understand it that way). the surface of a triange is planar, while in reality, there might be a bump right there. So it could be that a massflow point is below the rendered terrain surface, but NOt below the _real_ surface. do you get what I mean?