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: Help please!!!

  1. #1
    Guest

    Help please!!!

    Hi all,

    I am new in opengl so i need some help.
    I try to create an object using a list.
    I use this function(face_num is defined above-points needed to create the object)

    GLint object()
    {
    int i;
    int j;

    GLint lid=glGenLists(1);
    glNewList(lis, GL_COMPILE);

    glBegin (GL_TRIANGLES);
    for(i=0;i {
    for(j=0;j<3;j++)
    {
    int vi=face_num[j];
    glVertex3f (vertices[vi][0],vertices[vi][1],vertices[vi][2]);
    }
    }
    glEnd ();

    glEndList();
    glCallList(lis);
    return lis;
    };

    In my DrawGlscene i call the function like this

    glLoadIdentity();
    glTranslatef(0.0f,0.0f,-2.0f);
    object();


    Everything works fine and the object is drawn in the screen.
    Now i want to apply a texture to my object. Iknow how to load a texture and all this stuff but i have no idea how to get the coordinates of the object. I have read about automatically calculating the coordinates but i really do not understand that.
    I would really appreciate it if you could give me some code...

    I would also like to know what happens if your object needs two textures. Does it mean i have to split the object into the two parts and then apply the textures?


    Thanks

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Help please!!!

    It seems to me you don't really understand the purpose of display lists. As I understand your code, your display function builds a new display list and draws it each frame. This is not a good use of display lists. Build the display list once on program start up, and then just call it every frame instead.

    When it comes to texturing, I suggest you read the tutorials here .

Posting Permissions

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