donjames
Topic Author
Posts: 25
Joined: 27 May 2013, 16:35

Adding Image to Canvas using a Texture Source

18 Feb 2014, 15:46

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
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Adding Image to Canvas using a Texture Source

18 Feb 2014, 19:13

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.
 
donjames
Topic Author
Posts: 25
Joined: 27 May 2013, 16:35

Re: Adding Image to Canvas using a Texture Source

20 Feb 2014, 05:28

That worked.
Thanks
Don

Who is online

Users browsing this forum: No registered users and 34 guests