Results 1 to 3 of 3

Thread: Multiple Mesh

  1. #1
    Newbie Newbie
    Join Date
    Dec 2013

    Multiple Mesh

    Hey everyone,

    Recently I have been following some OpenGL tutorials that use freeglut and glew on windows and I've managed to get them all working and understand the basic steps you need to do to get a mesh onto the screen. However I am a little bit in the dark when it comes to getting multiple meshes on the screen. At this point in time I have not tried it yet, since I felt like asking someone who has done it before will prevent me from making the 'newb' mistakes someone else maybe ran into a bit further down the road when he/she started using OpenGL.

    The current steps I follow for a single mesh are (not showing all parameters for every function) :
    Code :
    GLuint vao;
    GLuint vbo;
    GLuint indexBufferID;
    GLuint textureBufferID;
    GLuint textureCoordID;
    glGenVertexArrays(1, &vao);
    glGenBuffers(1, &vbo);
    glBindBuffers(GL_ARRAY_BUFFER, vbo);
    glBufferSubData(..., vertices);
    glBufferSubData(..., normals);
    glBufferSubData(..., uvs);
    glGenBuffers(1, &indexBufferID);
    glBindBuffer(GL_ELEMENT_ARRAY, indexBufferID);
    glBufferData(..., indices, ...);
    // Texture stuff...

    I left out the texturing stuff, since I feel when I know the other steps I should be able to work with textures as well. However advise is always appreciated! So my question is: What is the best way to render multiple meshes and what trade-offs are there to keep in mind?

    Kind regards,


  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    In the first instance just make a VAO for each object.

    To render clear your render buffer, bind and render the first object then bind and render the second object then do the swap buffer.

    Long term your can improve on this but baby steps are a good thing.

  3. #3
    Newbie Newbie
    Join Date
    Dec 2013
    Hey tonyo_au,

    Thank you for the reply, I was thinking in that direction already glad to see its a good way to start out!

    Kind regards,


Similar Threads

  1. one mesh, multiple texture
    By Ruggero Visitnin in forum OpenGL: Advanced Coding
    Replies: 9
    Last Post: 08-29-2014, 11:27 AM
  2. How to draw a mesh with multiple textures
    By stilianos in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-18-2013, 06:23 AM
  3. Multiple materials in a mesh don't work
    By injik in forum COLLADA
    Replies: 2
    Last Post: 08-25-2012, 06:45 AM
  4. Multiple Textures in One scene, One per mesh?
    By Snow_56767 in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 08-22-2011, 03:32 AM
  5. Multiple convex meshes per mesh?
    By sheepferretbadger in forum COLLADA
    Replies: 4
    Last Post: 06-27-2007, 07:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean