the Fiddler's picture

0.9.1 progress report: GLU Tesselation

The OpenTK.OpenGL.Glu has been updated with preliminary tesselation support. Anyone interested, please download the attached zip and test it (the source is availble through SVN) and try using the code. A small example will be added to the OpenTK manual soon.

I am afraid that without feedback, no further updates will be done to this code. I strongly recommend to avoid using the GLU tesselation functions and prefer a managed triangulation solution instead.

As always, you may check progress in the Roadmap section and join our development discussions on on IRC (de.quakenet.org:6669, #opentk).

Update 1: OpenTK.OpenGL.Glu now works correctly. For now, only low-level access is provided to the tessellator functions (which may require the use of pointers in some cases). If you wish to help develop a safe managed wrapper over these functions, please make a post.

AttachmentSize
opentk-0.9.1-wip2.7z1.27 MB

Comments

Comment viewing options

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

Thus far this is the only working version of the Glu Tessellator I've used with C#, even though I'm still having some trouble with it.

The Tao framework has Glu bindings for it, but their implementation fails out right.

It should be mentioned that the OpenTK implementation of the tessellator requires a valid OpenGl context to work, which is not the case with the regular Glu library, or even Tao.

If, like me, you are not using the full OpenTK environment, you can prevent null reference exceptions by adding a line like this before you call the tessellator functions:

OpenTK.GLControl glControl = new OpenTK.GLControl();

That will take care of behind-the-scenes initialization.

I still can't get the tessellator to function properly, even though it doesn't crash now. Presently it is calling my vertex callback too few times, and I can't figure out why.

Anonymous's picture

I've got it! The OpenTK implementation of the tesselator works perfectly!

Here's what I have learned so others will know:

1) OpenTK requires an active context to use the tesselator. (See above post).

2) The tesselator by default outputs indices as for a GL_TRIANGLE_STRIP. If you want indices in terms of GL_TRIANGLES (a triangle list for D3D users) you must specify an edge flag callback. Even if the function does nothing, OpenGL will force the tesselator to use triangle lists.

Thanks for the effort on this. I now have a fully functional triangulator in .NET.

the Fiddler's picture

Thanks, I'll write a short article on the tesselator and this information is very useful.

I'm planning to fix Tao's tesselator, but I haven't figured out how to do that without exposing unsafe code (which Tao doesn't allow).