Sign in to follow this  

glBufferData

This topic is 823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem with glBufferData:

glBufferData(GL_ARRAY_BUFFER, xxxxx, (GLvoid*)glm::value_ptr(*m_pBuffer->getAllData()), m_pOptions->GetDynamics());

i use a wrapper around a vector for manage the vertexes, i don't have a struct with the vertex composition but a list of these wrapper for position , normal eccc...

then the vector in the wrapper is a glm::vec3 and i see that the sizeof of a glm::vec3 is 12.

I don't know how calculate the xxxxxx i see that for 3 vertexes ( 3 glm:vec3) the correct value is 18 but i don't understand why and how calculate the correct value for bigger vbo.

can you help me?
and what is this param?
thanks.

Share this post


Link to post
Share on other sites
XXxX refers to the size of the buffer in bytes. If your vertex is a vec3, use sizeof(vec3) * number of your vertices for that parameter. a single element in vec3 is a float which is 4 bytes, so 3 floats is 12.

Share this post


Link to post
Share on other sites

XXxX refers to the size of the buffer in bytes. If your vertex is a vec3, use sizeof(vec3) * number of your vertices for that parameter. a single element in vec3 is a float which is 4 bytes, so 3 floats is 12.

indeed is what i think but i don't know where i wrong because with nsight i see that 9 vec3 have the correct value at 18 for the correct alignment of vertices.
but for my computation does have 9 * 4 = 21 and not 18.
where it come this 18 that works, i can wrong some other parameter?
I dont know.

 

 

sorry 3 vec3= 4*3*3= 36 and not 18!

Edited by giugio

Share this post


Link to post
Share on other sites

This topic is 823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this