You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.
Hi i want to add VBO support for type GL_ARRAY_BUFFER and after analyzing the code i have a couple of points i want to discuss. I found that is Stage3D the equivalent of a VBO of type GL_ARRAY_BUFFER is VertexBuffer3D.
There is two places where VertexBuffer3D are used:
GLS3D.as defines glEndVertexData() which is used by the older glEnd() mechanism to build a VertexBuffer3D. I can't reuse it since its assuming a structure of Positions, Color, Normals and Tex coords. We cannot assume anything when creating a VBO since the structure is defined by the user.
There is also a VertexBufferPool class, also assuming the same vertex data structure.
My problem:
I am in the process of adding support for glGenBuffer(), glBufferData().
glGenBuffer(GLsizei n, GLuint *buffers)
This function creates an id (or many if size > 1) and assign it to buffers. The id will be used later on by the user to bind to a specific VBO. I thought it would be ideal to create a list of VertexBuffer3D and the id created by glGenBuffer() would be the index position in the vector, I would also flag it as "Created". When deleting a VBO we will set the it to null in the vector and flag it as "recycled" for the next glGenBuffer() call.
glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
Here is my main issue, this function only accepts an simple pointer to data and the data size. We don't know anything on the actual data array. This is a problem with Stage3D since the VertexBuffer3D constructor requires that we specify the number of vertex provided and the stride of each vertex data. I would see to solutions to this :
-> Create glBufferData() with 2 new params but that will break the OpenGL API and will require the user to add #ifdef FLASCC to add 2 extra params...its kinda bad
-> Lazy create the VertexBuffer3D at render time, when we specify the glVertexAttribPointer(). This is actually where we specify to opengl how the VBO is constructed...
Keeping track of the vbos :
My idea would be to add a new structure for storing VBO allocated by glGenBuffer().
I would create a Dictionnary keyed on the VBO type , for now i will add only GL_ARRAY_BUFFER but GL_ELEMENT_ARRAY_BUFFER will be another one to add in a near future.
The value of the dictionnary will be a vector containing VertexBuffer3D and a flag to specify its current state (Ex: Created, Uploaded, Recycled)
So this is it...if someone started to work on this or think there is a better solution let me know. Thx!
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi i want to add VBO support for type GL_ARRAY_BUFFER and after analyzing the code i have a couple of points i want to discuss. I found that is Stage3D the equivalent of a VBO of type GL_ARRAY_BUFFER is VertexBuffer3D.
There is two places where VertexBuffer3D are used:
My problem:
I am in the process of adding support for glGenBuffer(), glBufferData().
glGenBuffer(GLsizei n, GLuint *buffers)
This function creates an id (or many if size > 1) and assign it to buffers. The id will be used later on by the user to bind to a specific VBO. I thought it would be ideal to create a list of VertexBuffer3D and the id created by glGenBuffer() would be the index position in the vector, I would also flag it as "Created". When deleting a VBO we will set the it to null in the vector and flag it as "recycled" for the next glGenBuffer() call.
glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
Here is my main issue, this function only accepts an simple pointer to data and the data size. We don't know anything on the actual data array. This is a problem with Stage3D since the VertexBuffer3D constructor requires that we specify the number of vertex provided and the stride of each vertex data. I would see to solutions to this :
-> Create glBufferData() with 2 new params but that will break the OpenGL API and will require the user to add #ifdef FLASCC to add 2 extra params...its kinda bad
-> Lazy create the VertexBuffer3D at render time, when we specify the glVertexAttribPointer(). This is actually where we specify to opengl how the VBO is constructed...
Keeping track of the vbos :
My idea would be to add a new structure for storing VBO allocated by glGenBuffer().
I would create a Dictionnary keyed on the VBO type , for now i will add only GL_ARRAY_BUFFER but GL_ELEMENT_ARRAY_BUFFER will be another one to add in a near future.
The value of the dictionnary will be a vector containing VertexBuffer3D and a flag to specify its current state (Ex: Created, Uploaded, Recycled)
So this is it...if someone started to work on this or think there is a better solution let me know. Thx!
The text was updated successfully, but these errors were encountered: