Jump to content
  • Advertisement
Sign in to follow this  
masterbubu

OpenGL VBO deprecation

This topic is 2454 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

Hi,

I'm trying to change my working code with old opengl old style, to the new one.




if (GL_VERTEX_ARRAY == m_eAttributeType )
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, m_pBufferOffsetPointer);
}
else if(GL_NORMAL_ARRAY == m_eAttributeType )
{
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer( GL_FLOAT, 0, m_pBufferOffsetPointer);
}
else if (GL_TEXTURE_COORD_ARRAY == m_eAttributeType )
{
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, m_pBufferOffsetPointer);
}



To:


// each attribute has its own handle (vert = 0, norm = 1, tex = 2 ), the offset on the VBO stays the same.


glEnableVertexAttribArrayARB( m_ArrayHandle );
glVertexAttribPointerARB( m_ArrayHandle ,m_usNumOfCoords, GL_FLOAT ,GL_FALSE ,0 ,m_pBufferOffsetPointer );



Well its not working.

what am I missing ?

Share this post


Link to post
Share on other sites
Advertisement
did u make sure the attribute handle is correct? e.g. did u use glGetAttribLocation or glBindAttribLocation, if the latter, did u relink the shader program after setting them?

Share this post


Link to post
Share on other sites
Hi,

Sorry, I was not clear.

I want to use VBOs without shaders.



So the handles are predefine number. ( 0 for vertices, 2 for normal, 8 for UV’s ).



I Google around and find that, if you are not using shaders, those values are not so important, as long as you

Remember to bind the buffer, enable the handle and bind it.



If I’m changing the code back to the legacy functions, all works fine.



Still I cannot figure out . what am I missing ?

Share this post


Link to post
Share on other sites
Try checking if there are any errors after each of the gl function call.

eg:

std::cout << gluErrorString(glGetError()) << std::endl;


It should tell you if you've missed something.

Share this post


Link to post
Share on other sites

I want to use VBOs without shaders.


That's not VBO. That is just the array setup.
I'm not sure why anyone would not use shaders these days since not using shaders, is deprecated.

Share this post


Link to post
Share on other sites
This really depends on your hardware. I've found some drivers (helloooo Intel!) that will simply refuse to accept some configurations of vertex attrib arrays (e.g. a second set of texcoords) without error, even if you're using shaders.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!