PDA

View Full Version : 'stepped' contour plots ?



joolz
07-15-2005, 01:28 AM
Guys

I want to include 'stepped' contour plots like the one shown here

http://www.cadfem.com/ogl6.gif

You can see there are distinct colour bands across the polygons as opposed to the 'default' linearly interpolated 'smooth' type of plot that you would get if you set a colour per vertex.

I have no idea how the stepped plots are done.

Any ideas on what to check out?

Thanks as always

Julian

Relic
07-15-2005, 03:13 AM
Per vertex glTexCoord1f(stress) with stress normalized to [0.0, 1.0] range and 1D texture mapping using GL_NEAREST filtering.

joolz
07-17-2005, 11:29 PM
Many thanks for taking the time to reply Relic

>>Per vertex glTexCoord1f(stress) with stress normalized to [0.0, 1.0] range and 1D texture mapping using GL_NEAREST filtering

I am working on texture mapping to normalized results at the moment (based on previous advice) but I assumed that this would produce an interpolated smooth plot across a polygon and not a steped plot?

So its the GL_NEAREST filtering that does the stepped display - yes?

Julian

RigidBody
07-18-2005, 12:20 AM
So its the GL_NEAREST filtering that does the
stepped display - yes?

exactly. GL_NEAREST means that the texture colors
are not interpolated.

one more thing: you may want to have a scale for
example from 500 to 1000. this means that a function
value of 0 would have a normalized texture
coordinate of -1.0; a value of 1500 would have
a texture coordinate of +2.0. you should therefore
use the texture parameter

glTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

all texture coordinate values below 0.0 are
automatically set to 0.0, and all values above
1.0 are set to 1.0

07-18-2005, 01:04 PM
all texture coordinate values below 0.0 are automatically set to 0.0, and all values above 1.0 are set to 1.0is that for GL_CLAMP_TO_EDGE or GL_CLAMP?

RigidBody
07-18-2005, 09:48 PM
it seems that with GL_CLAMP you get texture
coordinates from 0.0...1.0, with GL_CLAMP_TO_EDGE
the range depends on the texture size and is clamped
to 1/(2N)...1-1/(2N) with the texture having N
pixels. this means that for 32-pixel texture the
coordinates are between 1/64 and 1-1/64 (=63/64).

anyway, i tried both parameters and didn't see a
big difference...