dvdking
dvdking

Reputation: 13

program ignores everything after function is called

I can't even explaing it properly.. So I have code like

printf_s("%s", "1");
glDrawElements(GL_TRIANGLES, model.IndCount, GL_UNSIGNED_INT, (void*)0); 
printf_s("%s", "2");
eglSwapBuffers ( esContext->eglDisplay, esContext->eglSurface);

And 2 is never printed .When i remove glDrawElements it's all ok

Upvotes: 1

Views: 118

Answers (3)

genpfault
genpfault

Reputation: 52166

glDrawElements(GL_TRIANGLES, model.IndCount, GL_UNSIGNED_INT, (void*)0);
                                             ^^^^^^^^^^^^^^^ whaaaaat?

OpenGL ES' glDrawElements() does not accept GL_UNSIGNED_INT for type, just GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT.

If you check glGetError() after that call you should get a GL_INVALID_ENUM.

Upvotes: 1

Jarod42
Jarod42

Reputation: 218090

glDrawElements(GL_TRIANGLES, model.IndCount, GL_UNSIGNED_INT, (void*)0);

crashes, so next statements are never executed.

give a correct 4th parameter to glDrawElements to fix your crash.

Upvotes: 0

Paul Evans
Paul Evans

Reputation: 27577

Try printf instead of printf_s (which will stop printing if any of it's constraints are violated -- which may very well be what glDrawElements is doing) and flush stdout after each print.

Upvotes: 0

Related Questions