[vtkusers] Modifications to vtkOpenGLPolyDataMapper.cxx vtkOpenGLProperty.cxx

Goodwin Lawlor goodwin.lawlor at ucd.ie
Tue Oct 29 08:23:24 EST 2002


Hi All,

I've made some change to my vtk src that may be of interest:

1. Allows backface/frontface culling in wireframe and points representation.
2. Allows a backface property to be set in wireframe and points
representation.
3. Speeds up wireframe rendering by 20% with BackfaceCullingOff and by 110%
with BackfaceCullingOn (SB's bench-sphere.tcl on Dell Inspiron 3800- ATI
Rage Mobility graphics card). Probably speeds up points rendering too
(haven't tested it though). Other representation are unaffected- triangle
strips are still the fastest primitive to render.
4. EdgeVisibilty could now be enabled when rendering surfaces in vtk (would
take some more hacking). It seems EdgeVisibility is only used in the
GeomView exporter.

In a nutshell, the changes are that vtkOpenGLPolyDataMapper.cxx always draws
triangles and vtkOpenGLProperty.cxx switches the representation using
glPolygonMode( )

John Biddiscombe inquired about this back in Oct 1999... here's the thread:
http://public.kitware.com/pipermail/vtkusers/1999-October/002446.html. Maybe
there should be a feature wish-list or bug-ín page on the website?

Here are the diffs (compared to nightly 10/10) and the files are attached:

Diff for vtkOpenGLPolyDataMapper.cxx:

2487a2488,2509
>   switch (rep)
>     {
>     case VTK_POINTS:
>       glFunction[0]  = GL_POINTS;
>       glFunction[1]  = GL_POINTS;
>       glFunction[2]  = GL_POINTS;
>       glFunction[3]  = GL_POINTS;
>       break;
>     case VTK_WIREFRAME:
>       glFunction[0] = GL_POINTS;
>       glFunction[1] = GL_LINE_STRIP;
>       glFunction[2] = GL_LINE_STRIP;
>       glFunction[3] = GL_LINE_LOOP;
>       break;
>     case VTK_SURFACE:
>       glFunction[0] = GL_POINTS;
>       glFunction[1] = GL_LINE_STRIP;
>       glFunction[2] = GL_TRIANGLE_STRIP;
>       glFunction[3] = GL_POLYGON;
>       break;
>     default:
>       vtkErrorMacro(<< "Bad representation sent\n");
2491a2514,2515
>       break;
>     }
2647c2671
< /*
---
>
2704c2728
< */
---
>
2804,2805c2828
<   draw3(aPrim, aGlFunction, cellNum, p, n, c, t, ren, noAbort);
< /*
---
>   draw2(aPrim, aGlFunction, cellNum, p, n, c, t, ren, noAbort);
2810c2833
< */
---
>

Diff for vtkOpenGLProperty.cxx:

65,70d64
<       if (this->GetRepresentation() == VTK_WIREFRAME)
<               glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
<       else if (this->GetRepresentation() == VTK_SURFACE)
<               glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
<       else
<               glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
76,81d69
<       if (this->GetRepresentation() == VTK_WIREFRAME)
<               glPolygonMode(GL_FRONT, GL_LINE);
<       else if (this->GetRepresentation() == VTK_SURFACE)
<               glPolygonMode(GL_FRONT, GL_FILL);
<       else
<               glPolygonMode(GL_FRONT, GL_POINT);
87,92d74
<       if (this->GetRepresentation() == VTK_WIREFRAME)
<               glPolygonMode(GL_BACK, GL_LINE);
<       else if (this->GetRepresentation() == VTK_SURFACE)
<               glPolygonMode(GL_BACK, GL_FILL);
<       else
<               glPolygonMode(GL_BACK, GL_POINT);




-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkOpenGLxxxx.zip
Type: application/x-zip-compressed
Size: 9471 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021029/f1e938b7/attachment.bin>


More information about the vtkusers mailing list