Results 1 to 6 of 6

Thread: 'stepped' contour plots ?

  1. #1
    Member Newbie
    Join Date
    Mar 2005
    Posts
    47

    'stepped' contour plots ?

    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

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: 'stepped' contour plots ?

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

  3. #3
    Member Newbie
    Join Date
    Mar 2005
    Posts
    47

    Re: 'stepped' contour plots ?

    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

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    659

    Re: 'stepped' contour plots ?

    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

  5. #5
    Guest

    Re: 'stepped' contour plots ?

    all texture coordinate values below 0.0 are automatically set to 0.0, and all values above 1.0 are set to 1.0
    is that for GL_CLAMP_TO_EDGE or GL_CLAMP?

  6. #6
    Senior Member Frequent Contributor
    Join Date
    Aug 2004
    Location
    munich, germany
    Posts
    659

    Re: 'stepped' contour plots ?

    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...

Similar Threads

  1. Vector plots and contour lines..????
    By rakesh_thp in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-08-2009, 11:03 AM
  2. making 3d plots
    By genericforms in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-18-2007, 11:34 AM
  3. xy plots
    By Jefft in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-15-2005, 12:54 AM
  4. CAE Coloured Stress Contour Plots - Efficient, Faster Way
    By cellox in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-09-2003, 11:42 AM
  5. CAE Coloured Stress Contour Plots - Efficient, Faster Way
    By cellox in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-07-2003, 09:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean