Results 1 to 4 of 4

Thread: Problems with function glColor between glBegin and glEnd

  1. #1
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Problems with function glColor between glBegin and glEnd

    Hi everyone:

    I'm working with opengl interface in a comercial CAD system calles solid edge.

    Normally if I use the function glColor between glBegin and glEnf it should work attributing the indicated rgb to the actual color, but in the add-in I'm developing for solid edge this does not work.

    Does any one faced some similar problem?
    Is it something in my opengl code that is bat implemented or can it be of the solid edge interpreter?

    Thanks!!!

    Sofia Gameiro

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    292

    Re: Problems with function glColor between glBegin and glEnd

    Sofia, why dont you post some code?
    Does you program work as expected when you call glColor outside the glBegin and glEnd?

  3. #3
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Re: Problems with function glColor between glBegin and glEnd

    Yes, it does.

    Here is a simple exemple of a code that works and one that does not:

    this one works:


    pIGL->glColor3ub(r,g,b);

    // triangle 1
    pIGL->glBegin(GL_TRIANGLE_STRIP);

    v = v1;
    pIGL->glVertex3dv(v);
    v = v2;
    pIGL->glVertex3dv(v);
    v = v3;
    pIGL->glVertex3dv(v);

    pIGL->glEnd();

    this one does not work:


    // triangle 1
    pIGL->glBegin(GL_TRIANGLES);

    pIGL->glColor3ub(r,g,b);

    v = v1;
    pIGL->glVertex3dv(v);
    v = v2;
    pIGL->glVertex3dv(v);
    v = v3;
    pIGL->glVertex3dv(v);

    pIGL->glEnd();

    in the first one each triangle strip that a draw ( in this case each has only one triangle but that's not the matter) has is own color defined by the r,g,b values and in the second one no color is attributed to the triangles.

    Do you know why it may be?

    Originally posted by mancha:
    Sofia, why dont you post some code?
    Does you program work as expected when you call glColor outside the glBegin and glEnd?

  4. #4
    Junior Member Newbie
    Join Date
    May 2003
    Posts
    4

    Re: Problems with function glColor between glBegin and glEnd

    I'm sorry , in the second code, where it says GL_TRIANGLES should be GL_TRIANGLE_STRIP, that does not affect the problem i'm referring to.


    Originally posted by Sofia Gameiro:
    Yes, it does.

    Here is a simple exemple of a code that works and one that does not:

    this one works:


    pIGL->glColor3ub(r,g,b);

    // triangle 1
    pIGL->glBegin(GL_TRIANGLE_STRIP);

    v = v1;
    pIGL->glVertex3dv(v);
    v = v2;
    pIGL->glVertex3dv(v);
    v = v3;
    pIGL->glVertex3dv(v);

    pIGL->glEnd();

    this one does not work:


    // triangle 1
    pIGL->glBegin(GL_TRIANGLES);

    pIGL->glColor3ub(r,g,b);

    v = v1;
    pIGL->glVertex3dv(v);
    v = v2;
    pIGL->glVertex3dv(v);
    v = v3;
    pIGL->glVertex3dv(v);

    pIGL->glEnd();

    in the first one each triangle strip that a draw ( in this case each has only one triangle but that's not the matter) has is own color defined by the r,g,b values and in the second one no color is attributed to the triangles.

    Do you know why it may be?


Similar Threads

  1. glBegin/glEnd
    By GuitarFan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-22-2013, 03:15 PM
  2. glVertexAttrib() without glBegin()/glEnd()?
    By cort in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 09-28-2010, 12:06 AM
  3. glGetError() between glBegin() / glEnd() ...
    By Heriberto Delgado in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-03-2007, 03:22 PM
  4. Where is glBegin/glEnd ?
    By AlienKinetics in forum OpenGL ES
    Replies: 2
    Last Post: 01-08-2004, 06:23 PM
  5. why is there a glBegin/glEnd limitation?
    By imported_Theo in forum OpenGL: General
    Replies: 2
    Last Post: 12-23-2000, 09:12 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