Results 1 to 2 of 2

Thread: objects

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2002
    Posts
    1

    objects

    Hey i'm trying to export objects from anim8or to c code so i can use them in my openGL program (written in C). Only problem is I get a huge array of vertices and i just don't know how to use it to display the object on the screen. Anyone know how to do this?
    Also, is there any place online where there are source code for objects written in c so that i can just include the header file and call the object with a function? (i would then do a scale and translation to put the objects where i want them on the screen).

    Thanks.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: objects

    I haven't looked at the C code that Anim8or exports, but there are a couple of likely possibilities. Is there also an array of indices? If so, to draw the model, simply walk through the indicies, and use glVertex on the vertex that is at each of those indices. (Using GL_TRIANGLES most likely)

    Code for this would look something like so...
    Code :
    glBegin(GL_TRIANGLES);
    for (c=0;c<numIndices;c++)
    {
        glVertex3fv(vertices[indices[c]]);
    }
    glEnd();
    If there is no index array, and it's just an array of vertices, then you'd wanna do something like so...

    Code :
    glBegin(GL_TRIANGLES);
    for (c=0;c<numIndices;c++)
    {
        glVertex3fv(vertices[c]);
    }
    glEnd();
    That may vary a bit depending on exactly how vertices is stored. (i.e. a flat array vs. 2 dimensional array)
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. depth buffer: far objects bleed through closer objects
    By geohoffman49431 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-15-2004, 10:47 AM
  2. Replies: 4
    Last Post: 12-30-2003, 10:49 AM
  3. GLslang: no reuse of shader objects in other program objects?
    By Ostsol in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-29-2003, 11:22 PM
  4. Can nurbs objects and curves be used as b-spline objects?
    By BigShooter in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-04-2003, 09:42 AM
  5. Replies: 2
    Last Post: 05-24-2002, 06:21 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