Loading textures from memory?
#1
I'm in need of a widget which can display a texture which is stored in a memory buffer. I was looking at CGUIImage but it can only handle image files. As my buffer changes frequently I wanted to write my own CGUI widget which would handle all buffer updates and display them on the screen.

I see that the CBaseTexture class does have a method LoadFromMemory(). Unfortunately this method is not made available by CGUITextureBase. Instead CGUITextureBase relies on the texture manager to load textures from file. I could however create a derived class of CGUITexture and manually add my CTexture object to CGUITextureBase::m_texture. This of course does not seem to be the way CGUITextureBase was intended to be used. So what is the correct way of using a CTexture object which was loaded from memory within GUI elements? Do I have to write my own CGUITextureBase class or should I modify CGUITextureBase to allow textures being loaded from memory?

Which format does CBaseTexture::LoadFromMemory() expect? RGBA?
Reply
#2
(2010-11-11, 20:38)Temar Wrote: I'm in need of a widget which can display a texture which is stored in a memory buffer. I was looking at CGUIImage but it can only handle image files. As my buffer changes frequently I wanted to write my own CGUI widget which would handle all buffer updates and display them on the screen.

I see that the CBaseTexture class does have a method LoadFromMemory(). Unfortunately this method is not made available by CGUITextureBase. Instead CGUITextureBase relies on the texture manager to load textures from file. I could however create a derived class of CGUITexture and manually add my CTexture object to CGUITextureBase::m_texture. This of course does not seem to be the way CGUITextureBase was intended to be used. So what is the correct way of using a CTexture object which was loaded from memory within GUI elements? Do I have to write my own CGUITextureBase class or should I modify CGUITextureBase to allow textures being loaded from memory?

Which format does CBaseTexture::LoadFromMemory() expect? RGBA?

Hi Temar

Do you have fixed this? Currently I'm working on a PDF viewer using MUPdf and then got the page loaded on memory and want to create automatically the texture from memory.

Best regards
Reply
#3
see defines on top of XBTF.h. as for getting pixels on the screen, this is too damn complicated in the kodi gui engine. you have to do the modification of GUITextureBase.
Reply
#4
Thumbs Up 
(2017-02-01, 11:38)ironic_monkey Wrote: see defines on top of XBTF.h. as for getting pixels on the screen, this is too damn complicated in the kodi gui engine. you have to do the modification of GUITextureBase.

Thanks for your answer . I have solved it using the CTexture class and then loading the PDF page image from memory. It's more faster than storing it on filesystem and then load to the texture

Code:
CTexture *texture = new CTexture();
texture->LoadFromMemory(m_pix->w, m_pix->h, 0, XB_FMT_A8R8G8B8, true, m_pix->samples));

Best regards
Reply
#5
Ah missed that one hope i didnt waste much of your time..
Reply

Logout Mark Read Team Forum Stats Members Help
Loading textures from memory?0