Do not know why this piece of code doesnt work

This piece of code used to work before in introduced vertex buffers. But now i have introduced vertex buffers for other drawing( previously only immediate mode was used). Now i dont see this symbols buffer. Any help would be appreciated as to why this doesnt work. I call this function before drawing the vbo’s.

This looks like client arrays code.

Do mSymbolBuffer.Vertices() and mSymbolBuffer.Colors() evaluate to CPU-side pointers? If so, then yes.

You’ve probably left a vertex array buffer object bound. Try preceding this code with this:

glBindBuffer( GL_ARRAY_BUFFER, 0 );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 );    // Not needed here, but for cases where you 
                                               // use glDrawElements() with client arrays

@Dark_Photon Yes, you are correct in your assumption that the pointer are CPU-side.
I tried unbinding the array and element buffer as you mentioned but i couldnt set the symbols still.
I have tried to wrap this in a vbo and now it works. But still dont know why it didnt work in the existing way.

Show your VBO setup+drawing code. You’re likely leaving something else bound or enabled.

Also, disable all VBO-related drawing and verify that the above still works at all. If so, then you know the clue is in something you just disabled.

@Dark_Photon This is my setup and render call function

Intially the symbols buffer was drawn after the immediate drawing of models.
Now the data for models are pushed to a vbo and thus they are drawn all at once( at the end).
So the structure is something like this.

1.IntialiseBuffer and Put data in buffer
2.Draw the symbols( the above code for symbols drawing)
3. Draw the VBO and EAO’s

Also i disabled the vbo’s and still couldnt see them.

Please don’t post code as images. It’s easy enough to copy-and-paste, and then it’s searchable.

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.