1
Graphics / How to reduce two draw calls into one
« on: May 10, 2017, 06:56:34 pm »
Hello everyone,
I have created my own class called SFMLButton which is supposed to, as the name implies function as a button.
Now an SFMLButton contains both a RectangleShape and a Text for the respective purposes.
The issue is, to draw this Button now I would have to call two separate draw calls.
window.draw(SFMLButton.shape) and window.draw(SFMLButton.text)
now I could override the draw function as SFMLButton is derived from Drawable.
Though I would still perform two draw calls per Button.
Is there a way to maybe create a texture which will contain both the shape and the text?
thanks in Advance
Folling
I have created my own class called SFMLButton which is supposed to, as the name implies function as a button.
Now an SFMLButton contains both a RectangleShape and a Text for the respective purposes.
The issue is, to draw this Button now I would have to call two separate draw calls.
window.draw(SFMLButton.shape) and window.draw(SFMLButton.text)
now I could override the draw function as SFMLButton is derived from Drawable.
Though I would still perform two draw calls per Button.
Is there a way to maybe create a texture which will contain both the shape and the text?
thanks in Advance
Folling