Hello everyone,
I’m trying to create a simple cube with a texture2D from HTML5:
The idea is to bind a texture from JS (a video texture in particular) and read it from unit 0 in my technique ( uniform sampler2D sVideo0; )
URHO3D code:
boxNode_=scene_->CreateChild("Box");
boxNode_->SetPosition(Vector3(0,2,15));
boxNode_->SetScale(Vector3(3,3,3));
StaticModel* boxObject=boxNode_->CreateComponent<StaticModel>();
boxObject->SetModel(cache->GetResource<Model>("Models/Box.mdl"));
Urho3D::SharedPtr<Urho3D::Material> material(new Urho3D::Material(context_));
cubetexture_ = SharedPtr<Texture2D>( new Texture2D(context_));
cubetexture_->SetSize(128, 128, Graphics::GetRGBAFormat(), TEXTURE_DYNAMIC);
material->SetTexture(TextureUnit(), cubetexture_);
material->SetTechnique(0, cache->GetResource<Technique>("Techniques/VideoWebGL.xml"));
boxObject->SetMaterial(material);
How can I pass “cubetexture_” to javascript, or viceversa create it with gl.createTexture(); and use that one on URHO3D instead?
I’m quite lost on how can the 2 system communicate through emscripten except EM_ASM() to call JS from C++