Jump to content
  • Advertisement
Sign in to follow this  
giugio

glBufferData

This topic is 1163 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
Advertisement
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
Sign in to follow this  

  • 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!