Jump to content
  • Advertisement
Sign in to follow this  
P

lwjgl VBO´s

This topic is 2093 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 everyone,

 I need help. I use VBO for loading object. When it´s loading one object, it´s all right. But when I want loading more object it´s a problem. The first object is rendering well but second object is rendering as first. Could you tell me how rendering multiple objects ? How update VBO?

Edited by pornosaur

Share this post


Link to post
Share on other sites
Advertisement


Hi everyone,

 I need help. I use VBO for loading object. When it´s loading one object, it´s all right. But when I want loading more object it´s a problem. The first object is rendering well but second object is rendering as first. Could you tell me how rendering multiple objects ? How update VBO?

Why not create a simple mesh class with its own vbo and render function?. That way you could create multiple instances of the class using different geometry and put them in a std::vector. When it comes to rendering, just create a loop that goes through the std::vector and calls the render functions.

void init()
{
    ...
    meshes.push_back(new mesh("triangleList1.txt"));
    meshes.push_back(new mesh("triangleList2.txt"));
    meshes.push_back(new mesh("triangleList3.txt"));
    ...
}

void Render(...)
{
    ...
    for (int i = 0; i < meshes.size(); i++)
    {
        meshes[i]->render();
    }
    ...
}
Edited by Chris528

Share this post


Link to post
Share on other sites

Thank you Chris, I understood it. I am a beginner so I probably wrote wrong. Do you have any examples ?

Share this post


Link to post
Share on other sites

Once more thank you! I found my mistake and it is all right - SOLVED.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!