View Full Version : How to draw a quardratic surface?

04-19-2014, 09:11 PM
For example, I have a surface defined like: z = ax^2 + bxy + cy^2.
How can I draw it using openGL?
Thanks a lot.

Agent D
04-20-2014, 09:23 AM
Lagacy or core only? AFAIK legacy OpenGL(R) has functions for drawing quadrics. (I have never used them myself)

Personally, I would stick to core profile OpenGL(R), create a vertex buffer by subdividing a square (e.g. 10*10 sub patches -> 200 triangles -> 100 vertices + 600 indices. Can be easily generated in a for loop). For each vertex, map the 2D coordinates on the square surface to the range you are interested in and compute the resulting third coordinate.

The resulting vbo/ibo combination can be rendered like any other object.