GL_FILL and GL_LINE at once?

I need some way to draw wireframe and shaded at once.

I have a list of triangles made up from a couple of hundred thousand points, so it really slows performance down having to draw the list twice in the 2 different modes.

Anybody got any suggestions?

Hi

Perhaps you can use 1 1D texture with lets say 512 width. There you set all texels to your shading color and only the first texel to black, your grid color. Set the filtering mode to GL_NEAREST. You subdivide your triangles so that you get an additiional center vertex. This vertex gets texture coordinate 1. All other vertices (the original) get the texture coordinate 0. So you get a only a black texel at you corners.
Issues:
-increasing amount of triangles
-need of preprocessing
-high resolution texture

Perhaps this is not a solution for your problem, but perhaps it can give you some hint

Oh I think you can use also a 2D Texture without the need of subdividing the triangle.
Draw in a white 2D texture a black triangle from (0,0)-(0,1)-(1,0). Assign each triangles vertex the texture coordinates (0,0)-(0,1)-(1,0). The higher the texture resolution is the finer is the grid line. Use GL_NEAREST filter to get a sharp line on the corners. Use Wrap mode GL_CLAMP_EDGE
With correct setting of the texture environment you can use your original shade

When you did it perhaps you can post a screen shoot ?

Bye
ScottManDeath

P.S.
Welcome to the OpenGL.org forums. Hopefully you’ll get helped and help

[This message has been edited by ScottManDeath (edited 08-01-2002).]

It would work brillaintly, except for one little problem… I dont use texture mapping. Any use of textures really kills the performance. Eventually i will need in excess of 1,000,000 points

I have to stick to wireframe and flat/smooth shaded polygons unfortunetly.

cheers for the suggestion though

Interesting idea – it would not only save performance, but also allow one to get rid of glPolygonOffset (at least in this application) as presumably the Z’s from the triangle rasterization could be used to draw the lines… Funky we have extensions for everything, but not this… probably means there’s a good reason it can’t be done :^)
Maybe it’s just something silly, such as how to specify the different fragment coloring setup for the tri’s and the lines (assuming they need to be different to see anything at all).

Otoh maybe you can improve performance by removing shared edges for the wireframe pass – on a close model, that could double throughput ?

Originally posted by cunny:
It would work brillaintly, except for one little problem… I dont use texture mapping. Any use of textures really kills the performance. Eventually i will need in excess of 1,000,000 points

Hi

what platform do you use ? If you cant use texturing you have indeed a problem. But what about making some performance test 2 passes vs 1 pass with texturing? Then you see wether the texturing is slower. Does your graphics card have hardware T&L. If so it could be that double rendering isnt so slow, but you should tryit.

I have to agree. 2 passes is almost always slower. Even with T&L the performance killer is the 2 bus transfers and T&L over the same data set. Especially at a large number of vertices. If you want 1,000,000 vertices (or primitives or whatever) you need to do only one pass. Even the slowest of one passes will be faster than multiple passes.

Devulon

use of textures could still be faster than running through the list of filled and outlined triangles? i have only even found textures to be a very large drain indeed!

Originally posted by cunny:
use of textures could still be faster than running through the list of filled and outlined triangles? i have only even found textures to be a very large drain indeed!

Hi

do you have hardware acceleration or do you use Win32 software implementation ? Have you directly compared the performance or do you judge just over the thumb (no harm intended ), sometimes you compare performance but in reality the relations are just in the other way.

Bye
ScottManDeath

i use a rage 128 on a 2gig p4, and i certainly hope i use the gfx card to do some of the processing. my rule of thumb is:
do i actually get more than 1 frame every second. its looks to be a 3fps using 150,000 points