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

Author Topic: Support for OpenGL Array Texture in future SFML2.x  (Read 3279 times)

0 Members and 1 Guest are viewing this topic.

ZenonSeth

  • Newbie
  • *
  • Posts: 19
    • View Profile
Support for OpenGL Array Texture in future SFML2.x
« on: January 18, 2013, 01:54:26 pm »
I don't think this will be the easiest thing to integrate with the current setup of image/texture/sprite - but I think it may be beneficial to add support for http://www.opengl.org/wiki/Array_Texture - or at least, support for the array of 2D textures (the 1D variant has its uses, but i think is not nearly as commonly used)

By support, I mean allowing the creation of something like sf::ArrayTexture and allowing sprites/shapes to have their texture set in the form of  Sprite::SetTexture ( ArrayTexture &arrayTexture, unsigned int level )
This, as far as I know, would also require that all drawing be done with a custom shader.

The main reason for this request is that it would provide possibilities for speed optimizations in certain, though not very common, cases.

For example, and what caused me to think of this request:
I currently have a tile-based game, where there are 34 different tile types. Each tile type has its own texture, for a specific 'theme' - i.e. dirt tiles, concrete tiles, glass tiles, metal tiles etc.
Currently, each theme is stored 1536x1536px texture atlas, and drawing a variety of tile types that all have the same 'theme' (i.e. they're all dirt tiles) is quick.
However, drawing tiles that all have different themes still requires a number of texture switching between the texture atlas for each theme. (a workaround to minimize this would be to sort the tiles by type when drawing, but it's still not as efficient as using a array texture)

Since all of my texture atlases are the same size, it would ideal to stick them in an Array Texture - and I would, except there's no easy way to supply this information to the sf::Sprite class.

Thanks!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Support for OpenGL Array Texture in future SFML2.x
« Reply #1 on: January 18, 2013, 02:46:23 pm »
Maybe in a far future ;D
Laurent Gomila - SFML developer

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Support for OpenGL Array Texture in future SFML2.x
« Reply #2 on: January 18, 2013, 03:30:56 pm »
Correct me if I am wrong.

I think the main reason for the "not yet" is the fact that it's OGL 3.0. As an owner of a crappy GPU (and now computer in general) I would not be able to use this feature at all because my GPU supports up to OGL 2.0. And while I may know the reason why, most new users in similar circumstances would wonder why would there be a feature that can't be used unless you have X hardware and up. Mostly the reason why SFML uses the deprecated (but still supported) OGL 1.x.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Support for OpenGL Array Texture in future SFML2.x
« Reply #3 on: January 18, 2013, 03:32:56 pm »
The main reason for the "not yet" is that there's a huge amount of important tasks to be done before ;)
Laurent Gomila - SFML developer