Results 1 to 3 of 3

Thread: not working

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2009

    not working

    please tell me what is wrong with the following algorithm.i am trying to draw a triangle on the screen using the 3 vertices of the array...

    GLfloat vertices[]={10,0,20,0,20,10,20,20,10,20,0,20,0,10};
    GLubyte coord[]={1,2,3};
    void RenderScene(void)

    glDrawElements(GL_TRIANGLES,3,GL_UNSIGNED_BYTE,coo rd);


  2. #2
    Senior Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008

    Re: not working

    You must set correctly your projection & model view matrix in order to set the camera properly.
    google for glOrtho, glPerspective and glutLookAt

    Another error, you are picking the vertex number 1 2 and 3 of your vector.
    x y
    20, 0
    20, 10
    20, 20
    The three vertex have the same X coordinate, nothing will be drawn.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2009

    Re: not working

    the problem was , as you said, the fact that the three vertices had the same x coordinate.thank you for your help

Similar Threads

  1. Replies: 0
    Last Post: 04-27-2018, 08:20 PM
  2. GL_SMOOTH not working (was working before...)
    By paulg568 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-06-2012, 05:11 PM
  3. Replies: 1
    Last Post: 11-18-2011, 08:13 AM
  4. working with OGL 3.x
    By Pswin in forum OpenGL: Basic Coding
    Replies: 13
    Last Post: 08-31-2009, 08:37 AM
  5. VBO not working
    By Dice1 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-29-2009, 06:35 PM

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