Advertisement Jump to content
Sign in to follow this  
nsto119

OpenGL Really, really weird problem with glDrawElements

This topic is 3328 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm helping my cousin with this C#/OpenGL project he's doing, and he's encountered a weird problem. I'm sure he's loading and binding the index buffer correctly. glGetError returns 0 when I check it. The problem is that when I try to draw geometry with glDrawElements, I get 1 frame per second exactly. And when it DOES update, my whole screen flashes black for a split second. Nothing gets drawn to the screen. Drawing with glDrawArray works just fine and I get a few thousand FPS with no hiccups. After running some tests I've discovered that it's swapping the color buffer that is taking so much time. Does anyone have any idea of why glDrawElements could be causing this? EDIT: I've solved the problem. The project is in C# and glDrawElements takes either an IntPtr or object as a pointer to the indices (or offset if using VBOs). I was passing it "0" but apparently I needed to be passing it "IntPtr.Zero." I wonder why invalid data would cause such a strange symptom.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!