Results 1 to 3 of 3

Thread: Modern OpenGL (3+) and state sorting

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2010
    Location
    Hungary
    Posts
    28

    Question Modern OpenGL (3+) and state sorting

    Dear All,


    let me have a general question, and confirmation:


    In my game engine, I have a state graph to minimize the state changes.
    Each mesh knows what ShaderProgram, and what Texture it uses,
    and based on this info all of them are inserted into a simple graph, like below:
    (sorry for the ascii art)





    Code :
                   ....
                    /
          ShaderProgram1
             /           \
            /             \
         Texture1     Texture2
           /    \                  \
          /      \                  \
       Mesh1   Mesh2       Mesh3






    My questions is:
    This is my simple (and maybe bad) solution for state sorting, but in general,
    is the state sorting stuff is still relevant on today's GPU?

    Should I still sort my meshes according to their Shader/Texture/Material whatever properties?

    Or should I just simply draw the meshes, and let each mesh bind the ShaderProgram, and Texture it uses.
    In that case a mesh would bind (glBindTexture) a texture which might be already bound,
    or maybe it was already bound before by another similar mesh.





    Thank You for sharing Your thoughts about this!
    A
    There must be some way outta here ...

  2. #2
    V-man
    Guest
    Yes, state sorting boosts performance. You can sort by shader, then texture (for example texture0).

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2010
    Location
    Hungary
    Posts
    28
    Quote Originally Posted by V-man View Post
    Yes, state sorting boosts performance. You can sort by shader, then texture (for example texture0).
    Thank You, V-man, yes I do that kind of sorting,
    I just wondered if this complication still needed,
    but it seems yes.

    Cheers
    A
    There must be some way outta here ...

Similar Threads

  1. State sorting performance questions.
    By lmagder in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-08-2006, 02:56 PM
  2. state sorting and multipass rendering
    By zen in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 03-02-2003, 04:19 PM
  3. State sorting
    By outRider in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 08-02-2002, 05:40 AM
  4. state sorting, fill efficiency...
    By Julien Cayzac in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-31-2002, 04:28 AM
  5. State sorting order
    By Succinct in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 05-27-2001, 07:39 AM

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