Technolithic's picture

Geometric Objects, spheres etc.

I believe OpenTK has yet to support this, but I was looking into implementing spheres with OpenGL.
I found this method: Glu.Sphere(), that takes the parameters, int quad, double radius, int slices, int stacks). I'm only using the OpenTK framework for graphics in my project and I know that setting the perspective calls for Glu.Perspective(), so I'm curious as to what this sphere method does or rather is supposed to do, since it doesn't like anything that I've tried to plug in for the integer "quad" parameter.

Anyhow, I don't suppose OpenTK will support preset geometric solids for a while, so I'm in the search of a good tutorial on spheres. Does anyone know of a good, gentle, tutorial on this topic?


Comment viewing options

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

You should probably bookmark this link to an online version of the red book: ..or pay [this space for an ebookshop is for sale] a visit ...or your local bookstore for a print.

Chapter 11 "Quadrics: Rendering Spheres, Cylinders, and Disks". Chapter 12 might be of interest aswell as a modeling aid.

Technolithic's picture

Glu.QuadricDrawStyle seems to take an integer as it's first parameter, using C#. C specification calls for a pointer to a user-defined quadric struct or something. There's nothing I can find to help me clarify what is happening. The quadric object can't be cast as an int into the QuadricDrawStyles method.

Technolithic's picture

To clarify my previous post, when I type in the method call: Glu.QuadraticDrawStyle, the 1st parameter hint (I'm using Visual Studio) says that it requires an integer type. Unless a quadric contains a value of an enumerator or is some kind of bitmask, I'm failing to see how this works.

The available examples are using different frameworks, which use a quadric object or struct pointer to handle the 1st parameter; however, OpenTK (which there are no examples of this that I can see) uses an integer as the 1st parameter. In fact, OpenTK seems to use integers for the 1st parameter of several other methods; for example, Glu.QuadricNormal(), and Glu.Sphere().

If standard OpenGL uses either objects or structs for this, it seems to make sense that this functionality has not yet been implemented with OpenTK and the methods showing up in my preview list of Visual Studio when I begin to type in Glu. yadda, are really just method stubs to be filled in later.

Technolithic's picture

This post is what I'm talking about.

Sorry for creating an unnecessary thread.

teichgraf's picture

Maybe you should use the latest OpenTK version from the Subversion repository (SVN). See how it works:
And then you can check the code from my picking example, which uses Glu spheres for rendering / picking:

flopoloco's picture

This could look handy as well