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

Author Topic: Render something directly without using Drawable  (Read 1310 times)

0 Members and 1 Guest are viewing this topic.

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Render something directly without using Drawable
« on: October 15, 2011, 02:17:12 pm »
Is it possible to render just using prepared coordinates without creation of Sprites. State data comes from external source.

Like: Render(texture, x, y) - so don't have to create a sprite with lots of useless information.

But without using OpenGL is preferable.

Like

Renderer.SetTexture(texture);
Renderer.AddRect(..)
Renderer.AddRect(..)
...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Render something directly without using Drawable
« Reply #1 on: October 15, 2011, 02:34:37 pm »
First... what's your problem? Why does creating a sprite is a problem for you?
Laurent Gomila - SFML developer

dydya-stepa

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
Render something directly without using Drawable
« Reply #2 on: October 15, 2011, 03:12:50 pm »
i'm using external particle system - sprite is too heavy to copy everything from external data structures into a sprite. They have all the data i need to render. otherwise i'll have to create 1000 sprites every frame.

I'm thinking currently to have one sprite and change coordinates every time. I'm not sure if that will work. But i still think the engine design is very cumbersome. Sprite shouldn't store position information - it should be within the game entity. The whole Drawable thing - i don't like it. Moreover resource manager get more complicated on top of it.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Render something directly without using Drawable
« Reply #3 on: October 15, 2011, 03:39:40 pm »
The new graphics API of SFML 2 will allow more low-level access, then you don't necessarily need sf::Sprite anymore.

Currently, there is no other option to display a texture than via sf::Sprite or direct OpenGL. I have chosen the second option in Thor's particle system, also for performance reasons. The library is open-source, so you can take a look at the sources (ParticleSystem.cpp) if you want. Or directly use it ;)
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: