Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How to draw a quardratic surface?

  1. #1
    Newbie Newbie
    Join Date
    Apr 2014
    Posts
    1

    Question How to draw a quardratic surface?

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

  2. #2
    Junior Member Regular Contributor Agent D's Avatar
    Join Date
    Sep 2011
    Location
    Innsbruck, Austria
    Posts
    151
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •