RomanKositsyn's picture

Color triangles

Hello.
I have array of color triangles

After rotate, i have strange artefacts

AttachmentSize
1.png49.08 KB
2.png53.13 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
objarni's picture

I think you have to explain a little bit more ... maybe show us you GL initialization (GL.Ortho etc) code ..

the Fiddler's picture

I cannot say for sure, but these look like z-artifacts, i.e. there's not enough z-resolution to distinguish which triangle should go in front.

How close together are your triangles? What is your projection matrix?

RomanKositsyn's picture

triangles very close.
size of triangle around 100x100x1 meter
perspective projection (Z) 1...100000

objarni's picture

If you have a 16-bit z-buffer it means you have a total of 65536 different possible z values.

With near-far set to 1..100.000 (one hundred thousand) there are approx. 100/65 possible z-values - that is more than one meter between each z value. (Not entirely correct since z-value-spacing is not linearly spaced IIRC - but roughly.)

And with triangles in the size of one meter, the above screenshots is the expected (random) outcome.

Try changing near-far to 1..10 instead.

RomanKositsyn's picture

Yes,after change (near-far) to small value all okey.
Big thanks.

What good way for best perfomanse - use glList or VBO?

the Fiddler's picture

Display lists tend to be a little faster for static geometry, but it depends on the driver.

On the other hand, VBOs are more future proof (display lists have been deprecated in GL3+).

RomanKositsyn's picture

Okey.
How can I do it faster?
Part of code to prepeare
...
GL.NewList(numDisplayList, ListMode.Compile);
GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill);
GL.Begin(BeginMode.Triangles);
...(repeat for every triangle)
GL.Color3(...);
GL.Vertex3(...);
GL.Vertex3(...);
GL.Vertex3(...);
...
GL.End();
GL.EndList();

And part of code to render scene

...
public void Draw()
{
GL.CallList(numDisplayList);
}

Very slow render for ~10.000 triangles :(

P.S. Also i use GL.Enable(EnableCap.CullFace);

the Fiddler's picture

Your code looks fine, how slow is it?

Modern hardware should fly with only 10K triangles (100s if not 1000s of fps). Maybe you are not getting hardware acceleration? What does GL.GetString(StringName.Vendor) return?

RomanKositsyn's picture

"Microsoft corporation"
Try download and install new drivers pack.

RomanKositsyn's picture

Yes, you are right. Perfomanse significaly grow up. Cool.
And last quest. How can render only front face?
Now...

I think about two display list, but it look not very elegant.

AttachmentSize
t2.jpg40.5 KB
t1.jpg35.12 KB