Page 1 of 1

Adding Image to Canvas using a Texture Source

Posted: 18 Feb 2014, 15:46
by donjames
I would like to add Images objects to my canvas using the C++ API. My application already has those source images uploaded to the GPU. Rather than downloading them to system memory and then having noesis upload, is it possible to create an image by passing in a texture source? (My textures are GL_TEXTURE_2D format)

I did see this comment in the release notes:

[Unity] Added support for changing Image.Source at runtime by creating a TextureSource from a UnityEngine.Texture2D.

If you have a code snippet that would be most ideal

Thanks
Don

Re: Adding Image to Canvas using a Texture Source

Posted: 18 Feb 2014, 19:13
by jsantos
Yes, it is described at the end of the tutorial about images.

In your case you need to use a TextureSource whose ITexture2D is created this way:
Ptr<ITexture2D> texture = *new GLTexture2D(width, height, levels, handle);
where handle is the texture you have created.

Re: Adding Image to Canvas using a Texture Source

Posted: 20 Feb 2014, 05:28
by donjames
That worked.
Thanks
Don