Quick Links

Set texture from an image

I've got a problem to set texture from an image on a sphere. The problem is that texture.Load or texture.SetData always returns false. I did try different methods like SetData, Load, resize texture and image (to a power of 2 number) and ... but none of them worked. Here is my code:

@laheller
Can you please explain more about (put to my Assets/Data/Textures folder), because if image will be fetch from url then why we need to put the image into the folder also. Because I want to show the multiple images or we can say dynamically.

Sounds Cool.
Is the above solution working/executable for both means iOS & Android for you?
Because it's not working and shows the error like failed to add resource path 'Data', check the documentation. I already give the build action BundleResource for iOS & EmbededResource for Droid.

Actually I am working on Indoor Maps. I want to load the 2D Indoor Map images into 3D viewer with 360 degree movement. I am using Texture with Sphere shape. But It's not display into the full screen and light shade also come.

@laheller
No, I am working on shared forms for iOS & Android only. I already used ApplicationOptions-
public class MapPage : Urho.Application then creting a scene and all.
Now, my texture image loads like Image1 and I want to do display like Image2.

@puneetmahali
I am not familiar with Xamarin.iOS, never used.
I only develop on Xamarin.Android and WinForms platforms.

On Android if you want:
1. Fullscreen app in general, you have to specify a theme without ActionBar for your activity, for example @android:style/Theme.Holo.Light.NoActionBar or your custom style where you disable actionbar.
Then the whole device screen will be available for Activity layout(s) or other view.
2. For UrhoSharp you have to create the UrhoSurface within a fullscreen layout.

Sorry @puneetmahali, I never tried any Xamarin.IOS, but it works on Android without problem.

One more thing, in the sample project, if you want to load image from URL it's better to usevar mb = new MemoryBuffer(wc.DownloadData(new Uri(url)));
becausevar mb = new MemoryBuffer(wc.DownloadData(url));
didn't work for me.

@laheller
No, I am working on shared forms for iOS & Android only. I already used ApplicationOptions-
public class MapPage : Urho.Application then creting a scene and all.
Now, my texture image loads like Image1 and I want to do display like Image2.

@laheller@ShahramShobeiri
We have some Urho shapes(Urho.Shapes) like Box, Sphere, Plane, Cone, Cylinder, Dome.....etc etc.
So I need to create a Static Component and loads the models into the above shape like below-

That box provides the 3D view but now I want to load the image in a Square like a Simple ImageView through the texture. So, Which shapes will give me that shape also needs to think about Vector3 position who returns the view in the center.

Make it more Simple- I need to load an Image with texture in 2D view like a normal ImageView(square shape) in Xamarin.forms and It should work for both in iOS & Android.