tags:

views:

36

answers:

1

Hi,

I have this problem that when there is an OpenGL application I am working on. When I try drawing this particular piece of code:

for (float i = 0; i < 100; i++)
{
    glBegin(GL_LINE_LOOP);
    glVertex3f(cos(i), i, -10.0f);
}
glEnd();

I get this problem where the program crashes and returns:

“SIGTERM”

Any suggestions to help me around this problem or any insight as to why this is happening would be greatly appreciated.

+2  A: 

Per the docs, you need one glBegin per glEnd -- not the 10,000 or so you're doing! So yank that glBegin to before the loop...

Alex Martelli
Words cannot describe how stupid I feel right now. Thanks!
thyrgle
@thyrgle, you're welcome -- and, cheer up, oversights can and do happen to every single one of us!-)
Alex Martelli
That fixes the problem, but we got to wonder why it SIGTERMs... it should just trigger a GL error. (GL_INVALID_OPERATION is generated if glBegin is executed between a glBegin and the corresponding execution of glEnd.)
Bahbar