Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

129 Neutral

About Blips

  • Rank
  1. I've been wracking my head trying to figure this out for some time now and it's clear that I need some outside help.   I have some VBOs/IBOs that I render through the following method. Batch objects just group data based on common textures: - (void)render { // if the buffer is empty, don't waste time if ([indexBuffer getCurrentSize] <= 0) return; //binding shared buffer objects glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, [indexBuffer getID]); glBindBuffer(GL_ARRAY_BUFFER, [vertexBuffer getID]); glVertexPointer(3, GL_FLOAT, sizeof(struct Vertex), (char *)NULL + 0); glTexCoordPointer(2, GL_FLOAT, sizeof(struct Vertex), (char *)NULL + 12); glNormalPointer(GL_FLOAT, sizeof(struct Vertex), (char *)NULL + 20); glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(struct Vertex), (char *)NULL + 32); DynamicArray *renderBatches = [indexBuffer getRenderBatches]; RenderBatch *batch; for (int i = 0; i < [indexBuffer getActiveBatchCount]; i++) { batch = (RenderBatch *)[renderBatches get:i]; [BufferManager setTextureID:[batch getTextureID]]; // render the subset batch of geometry glDrawElements(GL_TRIANGLES, [batch getIndexCount], GL_UNSIGNED_SHORT, (GLvoid *)[batch getIndexBatchOffset]); } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); } IBOs are setup via: - (void)build { glGenBuffers(1, &bufferID); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferID); glBufferData(GL_ELEMENT_ARRAY_BUFFER, bufferSize, NULL, GL_DYNAMIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); curBufferSize = bufferSize; } While VBOs are setup via: - (void)build { glGenBuffers(1, &bufferID); glBindBuffer(GL_ARRAY_BUFFER, bufferID); glBufferData(GL_ARRAY_BUFFER, bufferSize, NULL, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); curBufferSize = bufferSize; } IBOs get data with: - (void)updateData:(GraphicElement *)ge_ { RenderBatch *batch; GLuint textureID; //updating the index offset of the ge [ge_ setIndexOffset:curBufferSize / sizeof(unsigned short)]; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferID); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, curBufferSize, [ge_ getIndexCount] * sizeof(unsigned short), [ge_ getIndices]); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // working with render batches textureID = [[[ge_ getElement] getParent] getOpenGLTextureID]; // if first graphic element if (activeBatchCount == 0) { // pseudocode: create first batch } // otherwise try and match new graphic element's texture id with batch already in use else { // pseudocode: find batch with matching texture id, or create new batch } curBufferSize += [ge_ getIndexCount] * sizeof(unsigned short); } VBOs get data from: - (void)updateData:(GraphicElement *)ge_ { glBindBuffer(GL_ARRAY_BUFFER, bufferID); glBufferSubData(GL_ARRAY_BUFFER, curBufferSize, [ge_ getVertexCount] * sizeof(struct Vertex), [ge_ getVertices]); glBindBuffer(GL_ARRAY_BUFFER, 0); curBufferSize += [ge_ getVertexCount] * sizeof(struct Vertex); } Now, for the actual problem: Visually, there are no issues at all. The game renders perfectly and is 100% stable. However, when running the OpenGL ES Analyzer, I get thousands of the following warning: "Your application made a drawing call using a buffer that contains uninitialized data. If a draw call uses uninitialized data, the rendering results are incorrect and unpredictable. One way to fix this issue is to provide the buffer data to any BufferData calls instead of a NULL pointer." Example of Responsible Command column: glDrawElements(GL_TRIANGLES, 1056, GL_UNSIGNED_SHORT, NULL) I'm working with OpenGL ES 1.1 (I plan on moving on to 2.0 or 3.0 for my next game) and the OpenGL instrument was running on an iPad Air with iOS 7.x.   If anyone has any insight into how to correct these warnings, that would be amazingly helpful!
  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!