Sign in to follow this  
P

lwjgl VBO´s

Recommended Posts

P    112

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
Chris528    186


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
P    112

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

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