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

Author Topic: Direct texture rendering  (Read 1328 times)

0 Members and 1 Guest are viewing this topic.

Osccon

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Direct texture rendering
« on: December 23, 2015, 10:52:53 pm »
Hi,
I am new to SFML and came from plain OpenGL.
At the moment, I get known to SFML.
I am wondering whether there is some way to draw a texture directly to a RenderWindow.

For example:
myRenderWindow.draw(myTexture, myTextureSource, myTextureTargetSize);

So I dont have to create first for example a RectangleShape object or Sprite obejct, edit the properties like size and position, and finally draw it to the window.
This would also add some more efficiency to for example particle rendering, or in general short living dynamic objects.
Is there already something like this implemented or have I to implement such a texture renderer myself ?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Direct texture rendering
« Reply #1 on: December 23, 2015, 11:00:14 pm »
And why would using a sf::Sprite be less efficient? It's just a wrapper, the same things happen internally.

But if you insist, you can still use the low-level draw function where you provide the list of vertices to be drawn. With vertex position, texture coordinate and color you can dynamically choose the "texture source" and "target size". But again, the exact same things happen in sf::Sprite, with a much simpler interface.
Laurent Gomila - SFML developer