Giter VIP home page Giter VIP logo

textureupdateexample's People

Contributors

keijiro avatar wip- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

textureupdateexample's Issues

[Question] User data

Is there a way to pass a pointer to the callback? It would be more convenient, so that a pointer can holder the data to upload.

Tried casting to uint (which shouldn't be done in the first place) even if it worked on Android, it failed on iOS.

What about buffers?

This incredible project shows us how to use TextureUpdateCallback to move

textures from iOS native code -> Unity

In the "old days" you had to use a native plugin, such as explained in the famous example at the bottom of this page: https://docs.unity3d.com/Manual/NativePluginInterface.html

(Aside - Unfortunately, that demo has never worked for iOS; and I believe nobody has ever got that process working for iOS.)

So TextureUpdateCallback is a miracle for

textures from iOS native code -> Unity

But what about

buffers (like vertex buffers, matrices etc) from iOS native code -> Unity

Very often you want to load up buffers, in the native iOS code, and send that back to Unity (usually to use in a shader each frame).

Is there a way to do this?

[Question] How could I use this with gles commands?

Hi, many thanks for the repo!

I'm trying to update a unity texture from a framebuffer :

if (event == kUnityRenderingExtEventUpdateTextureBeginV2)
{
    glBindFramebuffer(GL_FRAMEBUFFER, static_cast<GLuint>(g_FBOPointer));
    checkGlError("glBindTexture2d");

    glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(g_TexturePointer));
    checkGlError("glbindTexture2D");
    glCopyTexSubImage2D(GL_TEXTURE_2D,0,0,0,0,0,params->width,params->height);
    checkGlError("glCopyTexImage2D");
}

but the texture remains black, (though I can see the framebuffer has images in it with an android imageview and glReadPixels).

Happen to have any tips? It's for this open source repo, Thanks!

Unfortunately not working in 2018.3.0f2 .. linker error

Thanks for this great example, but in Xcode

Undefined symbols for architecture arm64:
  "_GetTextureUpdateCallbackV2", referenced from:
      _Test_GetTextureUpdateCallbackV2_m3F68409646DD6E2A753FBD6D8277662808E892ED in Bulk_Assembly-CSharp_0.o
      _Test_Update_m51F75E0F25A98CAA4426F069A4E0EC7068A8C00E in Bulk_Assembly-CSharp_0.o
     (maybe you meant: _Test_GetTextureUpdateCallbackV2_m3F68409646DD6E2A753FBD6D8277662808E892ED)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thanks ...

Needs to render an image data or video data type to unity texture.

I am not able to send the texture to unity. It needs to render the texture in unity and we get data of texture in iOS.
How to return the texture from iOS to unity ? I have data in NSData format. I can as per suggestion convert to other format as well.
But I don't know how to return the texture from ios to unity using extern methods.

  if (event == kUnityRenderingExtEventUpdateTextureBeginV2)
  {
      // UpdateTextureBegin: Generate and return texture image data.
      auto params = reinterpret_cast<UnityRenderingExtTextureUpdateParamsV2*>(data);
      auto frame = params->userData;
     
      IOS_Class *shared = [IOS_Class sharedInstance];
      params->texData = (uint8_t *)(__bridge void*)[shared getData]; // Not able to rendered image to Unity texture.

  }
-(NSData*) getData {
    UIImage *logoImage = [UIImage imageNamed:@"logo.png"
                         inBundle:[NSBundle bundleForClass:self.class]
                            compatibleWithTraitCollection:nil];

    NSLog(@"Image -- %@",logoImage);
    NSData *imageData = UIImagePNGRepresentation(logoImage);
    return imageData;
}

how to mac plugin do

it's great i see your project, now I need to do a project with MacOS, do you use metal in mac? or opengl ES? I need to use metal. another problem is that how to copy texture in plugin in mac,looking forward to your reply

render api agnostic too?

hi
in the unity docs i see that usually you need some kind of
"OnGraphicsDeviceEvent" handler to register the graphics api

i see that in your code there is non..
is that because you didnt include your own graphics interface or because unity has done one "behind the scenes" and now we developers dont need all that boiler plate code in recent unity releases? :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.