Results 1 to 3 of 3

Thread: how to build a surface........(help......)

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    taiwan
    Posts
    17

    how to build a surface........(help......)

    i have a list of 3d points(in a array),i want to use these points to bulid a sruface,i have read some discussion about this subject, but i still don't know how to do....i am a new programmer,please help me!
    ps: i need a example.........

    thanks a lot!

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,595

    Re: how to build a surface........(help......)

    Hi !

    It all depends.....

    If the points are ordered nicely, either clockwise or counterclockwise it's pretty easy.

    Please notice that this example only works with convex surfaces, if you have more complex surfaces then you need to use the tesselator included with glu, it's pretty much the same thing as the example below you just feed to points through the teseelator that breaks it down into triangles.

    Convex means that if you have all the points in counterclockwise order, then the angle between any point and the next one must be turning "left", a triangle, quad, a circle and so on are convex, an L shaped surface is NOT convex.

    Lets make a rectangular surface (a quad):

    glBegin( GL_POLYGON);
    glVertex3d( 0,0,0);
    glVertex3d( 1,0,0);
    glVertex3d( 1,1,0);
    glVertex3d( 0,1,0);
    glEnd();

    This will render a rectangle in the X/Y plane, GL_POLYGON is used to create a convex polygon, if you know that you want to render a rectangle, then it's possible that GL_QUADS would be a little faster.

    The idea is that you feed it the first point of the surface, then the next one and so on, OpenGL will close it for you so you don't need to specify the first point at the end again.

    I hope that was what you was asking for ?

    Mikael

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2002
    Location
    taiwan
    Posts
    17

    Re: how to build a surface........(help......)

    yes...it is very useful for me........
    thank you very much!

Similar Threads

  1. Surface lost in release build?
    By .black in forum Vulkan
    Replies: 3
    Last Post: 03-02-2017, 11:24 AM
  2. Algorithm to build a surface out of points
    By Plyskeen in forum OpenGL: General
    Replies: 9
    Last Post: 03-08-2005, 12:05 PM
  3. Build surface using random points in space
    By Hari in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-21-2003, 07:49 PM
  4. how to build a surface........(help......)
    By randychou in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-26-2002, 01:27 AM
  5. using points build surface
    By shiyeye in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-20-2000, 01:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean