Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 31 Aug 2012
Offline Last Active Sep 03 2012 02:16 PM

Posts I've Made

In Topic: GLDrawElements Access Violation Issue

01 September 2012 - 08:04 PM

I only had time for a quick glance, but it looks like you're assuming floats are 4 bytes, and unsigned chars are 1 byte. Seems reasonable but are you sure?

Yes, I checked.

Also, the order in which you're calling bindBuffer and bufferData makes me uncomfortable. Maybe try:

bindBuffer( ... buffer 1 parameters)
bufferData( ... buffer 1 parameters)
bindBuffer( ... buffer 2 parameters)
bufferData( ... buffer 2 parameters)

because I think you are supposed to bind a given buffer immediately before calling bufferData. I don't know for sure since they're element, and vertex_array buffers, but it might be worht a shot.

didnt' work :[

I also think its weird that you are creating the buffers, filling them, rendering them, and then deleting the buffers all in one function. I assume this is some sort of test code to get things working but that kind defeats the point of having VBOs. You should have one function initVBOs() that puts the data in the bufffers and then leaves them there. And your draw() function should just bind the buffers, setup the attribute pointers, and then call glDrawElements. I think it would make debugging a bit easier.

Yeah, i'm doing that in the project code. But the error seems heap corruption somewhere in the code above.
The problem also goes away if I use shorts instead of chars for indices...?

Tested the code here on Linux and seems to run just fine.

Cool thanks