SFML community forums

General => Feature requests => Topic started by: Lee R on March 08, 2012, 11:56:08 pm

Title: Add CoordinateType member to RenderStates class
Post by: Lee R on March 08, 2012, 11:56:08 pm
Hi,

sf::RenderStates should have a 'CoordinateType' data member (of type sf::Texture::CoordinateType) to enable the use of normalized texture coordinates in vertex arrays rendered by sf::RenderTarget::Draw.
Title: Add CoordinateType member to RenderStates class
Post by: Laurent on March 09, 2012, 12:14:36 am
SFML is made to work with pixel texture coordinates. Normalized coordinates mode is only meant for interaction with OpenGL code.

Can you explain why you need to use normalized coordinates within the graphics module of SFML?
Title: Add CoordinateType member to RenderStates class
Post by: Lee R on March 09, 2012, 01:05:39 am
I don't "need" to work with normalized coordinates any more than SFML needs to work with pixel coordinates ;)

It came to mind while implementing Gwen GUI's renderer class. In Gwen, texture coords are normalized, so having to access the texture's width and height members, then scaling the coords before handing them off to SFML seemed somewhat pointless and wasteful, given the existence of sf::Texture::CoordinateType.
Title: Add CoordinateType member to RenderStates class
Post by: Laurent on March 09, 2012, 02:54:22 am
I understand.

But I won't implement this feature, sorry. It's too specific.

By the way, how did the renderer work before the new graphics API (and its vertex arrays)?
Title: Add CoordinateType member to RenderStates class
Post by: Lee R on March 09, 2012, 03:33:19 am
Alrighty.

Quote from: "Laurent"
By the way, how did the renderer work before the new graphics API (and its vertex arrays)?

Raw OpenGL calls.

It still doesn't use vertex arrays directly, yet (it creates a RectangleShape and gives it a texture), but I'm working on a patch for that.

EDIT: I'm not the author of the original Gwen SFML renderer, btw.