Results 1 to 3 of 3

Thread: Bezier surface obtained by rotation

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2012
    Location
    Bulgaria
    Posts
    2

    Bezier surface obtained by rotation

    Hello. I can make points interactively in my project by mouse clicking. I make bezier curve from 4 of this points. This all happens in 2d scene. I want to make rotational surface from this curve in 3d. Here is my code for 2d curve and from moving from 2d to 3d (in my glutDisplayFunc) :

    glClearColor(0,0,0,0.f);
    if (!_3d_flag)
    {
    glDisable(GL_DEPTH_TEST);
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0,g_sx,g_sy,0,-1,1);
    glViewport(0,0,g_sx,g_sy);
    glShadeModel(GL_FLAT);
    glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &bpts[0][0]);//bpts is array of control points for bez curve
    glEnable(GL_MAP1_VERTEX_3);
    glBegin(GL_LINE_STRIP);
    for (int k = 0; k <= 50; k++)
    glEvalCoord1f((GLfloat) k / 50);
    glEnd();
    }
    else
    {
    glClearDepth(10);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    glShadeModel(GL_FLAT);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(60,1,2,200);
    gluLookAt(LOOKATX,LOOKATY,LOOKATZ,0,0,0,0,1,0);
    }

    _3d_flag is flag for moving to 3D. Can I do it like this and make 3d rotational surface from my bezier curve? How can I make rotational surface from glMap2 and glMapGrid2 and glEvalMesh2?

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2012
    Location
    Bulgaria
    Posts
    2

    Re: Bezier surface obtained by rotation

    I want to create surface of revolution.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: Bezier surface obtained by rotation

    I would suggest to multiply every control point of the curve with a rotation matrix and record the transformed vertices.

    This way you will generate a list of transformed vertices. Use this list to get your 3D surface.

    Ex: 4 points on your curve would give you four arrays. Each array may have number of points equal to the number of times you transform (rotate). If your rotation is discreet, then intermediate control points can get generated using Bezier interpolation.

    Draw and shade them to get your result.

Similar Threads

  1. Two Bezier Surface
    By Raul26 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-21-2016, 01:09 AM
  2. convert four interconnected bezier curves into bezier surface patch
    By pat1il in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 07-08-2015, 09:33 AM
  3. Surface Bezier - Collisions
    By imported_Pierre in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 02-01-2010, 05:30 PM
  4. bezier surface
    By curonia in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-15-2004, 02:09 PM
  5. Bezier-Surface == terrain?
    By aBeginner in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 01-27-2002, 06:44 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