I create a buffer with my buffer class:
[source lang="cpp"] Buffer::Buffer() { ext::glGenBuffers(1, &mBufferID); } Buffer::~Buffer() { ext::glDeleteBuffers(1, &mBufferID); } void Buffer::updateResource(const void* data, uint64 numBytes) { ext::glBindBuffer(GL_ARRAY_BUFFER, mBufferID); ext::glBufferData(GL_ARRAY_BUFFER, numBytes, data, GL_STATIC_DRAW); ext::glBindBuffer(GL_ARRAY_BUFFER, 0); }[/source]
The VertexBuffer class inherits from Buffer and for a test puts some floats to the buffer:
[source lang="cpp"] class VertexBuffer : Buffer { private: std::list<VertexElement> mElements; public: VertexBuffer() { float superAwesomePosition[] = { 0, 0, 0 }; updateResource(superAwesomePosition, sizeof(superAwesomePosition)); } void addElement(const VertexElement& elem); };[/source]
That VertexBuffer is as a test created after OpenGL is initialized.
Well, now i have the following problem:
glBufferData seems to corrupt my state, because the next time i use glFlush or glClear i get an exception from my graphics driver:
Unhandled exception at 0x68DC930D (atioglxx.dll) in OGL.exe: 0xC0000005: Access violation reading location 0xBAADF0ED.
Well, if they use the same convention as the microsoft compiler this means that there is uninitialized memory on the heap used. From "heap" i thought, well, maybe it has to be on the heap and changed superAwesomePosition to be allocated by new and sizeof to 12. Still the same result.
Fun fact: When glBufferData is used with size = 0 and data = nullptr to reset it there is no problem, only when i supply data.
Greetings
Plerion






