Posted Tuesday, 2 December, 2008 - 14:49 by objarni
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.
Posted Tuesday, 2 December, 2008 - 19:50 by RomanKositsyn
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);
}
Posted Tuesday, 2 December, 2008 - 20:09 by the Fiddler
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?
Comments
Re: Color triangles
I think you have to explain a little bit more ... maybe show us you GL initialization (GL.Ortho etc) code ..
Re: Color triangles
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?
Re: Color triangles
triangles very close.
size of triangle around 100x100x1 meter
perspective projection (Z) 1...100000
Re: Color triangles
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.
Re: Color triangles
Yes,after change (near-far) to small value all okey.
Big thanks.
What good way for best perfomanse - use glList or VBO?
Re: Color triangles
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+).
Re: Color triangles
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);
Re: Color triangles
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?Re: Color triangles
"Microsoft corporation"
Try download and install new drivers pack.
Re: Color triangles
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.