Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: a tree of geom transforms  (Read 11768 times)

0 Members and 1 Guest are viewing this topic.

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
a tree of geom transforms
« Reply #30 on: November 03, 2010, 08:09:18 pm »
I understand this part, but what about sorting your objects by i.e. Textures or Shaders? Changing these assets often will decrease your performance significantly.

I was thinking about creating my own Matrix class. I want to avoid it, but this would allow me to:

1. Update all scene nodes
2. Gather all visible objects
3. Sort them by Texture or Shader
4. Draw in one single loop

Generally I need to create a scene graph and want to know if proposed earlier solution (with extended Drawable class) is OK and how complicated scene can be managed with it.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
a tree of geom transforms
« Reply #31 on: November 06, 2010, 02:19:53 am »
Quote from: "EatMyShorts"

Sort them by Texture or Shader

Why do you need this? By sorting you mean to change the drawing order of the children of a node?
Pluma - Plug-in Management Framework

EatMyShorts

  • Newbie
  • *
  • Posts: 10
    • View Profile
a tree of geom transforms
« Reply #32 on: November 08, 2010, 08:27:01 pm »
I have 3 objects (A, B, C)
Objects A and C are using same texture i.e. Wall.png and object B is using different texture i.e grass.png

Now, drawing objects like this: A->B->C will be inefficient (2 texture changes). To increase performance you will need to sort your objects by texture to have this drawing order A->C->B (1 texture change).

I do not know if the SFML 2.0 is using some internal batching mechanism to minimize device state changes.

I think I will run the test my self.