# Curved surface

Hi again people!

I was trying to draw a curved surface. Initially I thought it would be easy, that there would be a proper and easy function to do the work. But it is not. To draw a curved surface is really a hell of work. I’m trying to understand the GLU Nurbs function to do that, but I can’t figure out what gluNurbsSurface’s parameters is and how it works. I search in all the web but nobody explain it detailed, not even the red book. I don’t want to start to read a book about Bezier cubic curves now, I just want to know how the hell the control points is defined (whether it is world coordinates or is pixel coordinates, the array formatting, etc), what is U and V, U parametric direction, V parametric direction, etc. I would like to know the detailed description and functionality about all the parameters in this function and the way they influences the surface.

1. Where in the space stay the control points? It is just like a normal vertex, but invisible? It uses worlds coordinates, like vertex?

2. How much control points I have to do in order to draw a montain (cubic surface)?

3. What is the correct way to arrange the control points in a vector? I checked a example and I see that the guy uses a 4x4x3 dimensioned array, someone knows how the coordinates is arranged in that way?

Someone can help? I’m almost giving up of curved surfaces, it’s really a shame OpenGL does not have a ready and easier function to draw such surfaces. I’m quite disappointed. This is the cause Direct3D is vast used, OpenGL has a lot of extensions, patchs and stuff and there is not a [censored] function to draw a curved surface.

I never realy used this things myself, but I would try to explain why you don’t find much info on them. The problem of curved surfaces is that are not supported in hardware (it is not entirely true, but for our discussion, it is). While OpenGL has some functions to draw bezier curves and surfaces (google for opengl evaluators) and GLU has some nurbs functions, they all will be slow as hell, as they will convert the surface into triangles and submit them using the immediate mode (slowest way to draw things). Therefore, as far as GL goes, such things are basically deprecated (like the selection/feedback mode), because no one more or less serious uses them and driver writers don’t care about them. I do not believe Direct3D even has anything like this! The way to go, if you want them, is to code your own surface evaluation functions (probably on GPU) that will convert the surface into triangles (accelerated format). Of course, if you just want to play around, the GLU functions may be useful at first. Maybe someone else can give you some hints on how to use them…

Hmm…my god. This is the cause ATI put Tessalation unit on hardware since R600 (HD 2000 series).

Ok, I got it. I did notice it is slow as hell.

So, you are telling me the only way to do a curved surface, running in decent performance is to do via Vertex Shaders?

So, why drawing a cylinder (glucylinder) is not too slow, since a cylinder is a curved surface?

thanks anyway!

ATI tesselation unit AFIK is not exposed via any mechanisms, neither to GL nor to D3D.

I would pre-evaluate the surfaces and store them as a triangle list (and render as VBO). If you want to have them in real-time, some shader tricks with good hardware would be required (check the suggestions forum, there was a thread on it recently). Of course, for smaller objects, software evaluators work fine (like your teapot), because there isn’t much to process… but it is not enough for real-world applications.

I tried to render a curved surface in a display list using nurbs but it does not work well, the curvature rendered all wrong, but if I render in real time it works normally. Do you know why?