Results 1 to 6 of 6

Thread: Need help with rendering several models

  1. #1
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Need help with rendering several models

    Hello Everybody.
    I'm actually trying to render a scene containing several models. Each model has his own modelview matrix, so I cannot just specify one modelview matrix and use it for all the geometry, it will lead to undesired results.
    Now the problem is that I simply do not now what is the procedure of rendering several models with different modeling transformations. Should I specify the geometry several times and call drawTriangles several times before swapping the buffers?
    Thank you,
    sorry for the silly question.

  2. #2
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Need help with rendering several models

    Yes of course.

  3. #3
    Senior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214

    Re: Need help with rendering several models

    I suppose you are using the Fixed function pipeline. If you need better performance, it may be an advantage to use your own shaders with vertex buffers.

    That way, you define the geometry and download it to the graphic card only once, then only have to update the model+view matrix between every draw() call.

  4. #4
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Re: Need help with rendering several models

    Thank you for the answer.

    Actually yes, I am using shaders with quite big models.
    I guess I will need to figure out what's the maximum capacity of a vertex array befure uploading all the data to the card...

    Thanks!

  5. #5
    Senior Member Regular Contributor Kopelrativ's Avatar
    Join Date
    Apr 2011
    Posts
    214

    Re: Need help with rendering several models

    Just a notice: I have a similar situation, with big models and lots of data. At first, I was greedy and defined the data of the type GL_BYTE instead of GL_FLOAT. While it saved GPU memory, it is not the "native format", and there was a performance penalty. I suppose the penalty will vary for different graphic cards.

    Using indexed drawing (with glDrawElements) can allow you to use fewer vertices. With some luck, every vertex is used 6 times in a mesh. It also speeds up rendering, as the graphic card will use the cache and only execute the fragment shader once.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,135

    Re: Need help with rendering several models

    [quite] It also speeds up rendering, as the graphic card will use the cache and only execute the fragment shader once. [/QUOTE]

    I think you mean "it can caches already processed vertices so it doesn't have to run the vertex shader again".

    heinz: How big are we talking here?

Similar Threads

  1. C loading and rendering models (SDL2, glew, OpenGL 3.3)
    By Picpenguin in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-11-2017, 11:57 PM
  2. Some models do not rendering correctly
    By GLGangster in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 12-18-2014, 07:36 PM
  3. Nice models and free models,new site!
    By 3d4ya in forum COLLADA
    Replies: 0
    Last Post: 09-24-2008, 02:04 AM
  4. Rendering 3D models. data and math?
    By 9ine in forum OpenGL: General
    Replies: 4
    Last Post: 08-24-2004, 07:23 AM
  5. rendering models
    By the_doobs in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 09-28-2003, 07:13 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