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

Author Topic: Get access to the cache_id in the Texture class and other attributes.  (Read 2391 times)

0 Members and 1 Guest are viewing this topic.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Hi,

SFML don't allow us to display 3D objects, so, I've re-create the classes RenderTarget, RenderWindow, Vertex, VertexArray, ..., which can display 3D objects.

And I didn't want to modify SFML. (because if the SFML version change I'll have to modify all again)

It's why I've recreate similar classes for the 3D.

But I had to modify a little thing in the sfml source code, this is the m_cacheId, in the sf::Texture class.

Because the m_cacheId and some other attributes are private, so, I've moved them into the public part of the sf::Texture class otherwise only the friend class sf::RenderTarget can access to them.

Otherwise this is very nice that the SFML classes encapsulate the opengl code.

Shaders and textures becomes very more simple to implement. (This is why I keep using sfml even for the 3D)





« Last Edit: March 02, 2014, 07:17:50 pm by Lolilolight »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Get access to the cache_id in the Texture class and other attributes.
« Reply #1 on: March 02, 2014, 07:48:02 pm »
The m_cacheId is an implementation detail used for an internal optimization (the render target cache). This member has no meaning in the public API and therefore won't be exposed.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Get access to the cache_id in the Texture class and other attributes.
« Reply #2 on: March 03, 2014, 09:56:10 am »
Ok I had to make another change to increment the cacheId of the Texture in my own class RenderTarget : (And put this into the sf namespace)
namespace sf
{
    static sf::Uint64 getUniqueId()
    {
        static sf::Uint64 id = 1; // start at 1, zero is "no texture"
        static sf::Mutex mutex;
        sf::Lock lock(mutex);
        return id++;
    }
 

Otherwise it doesn't increment the m_cacheId.

 

anything