diff --git a/packages/embedder_texture/aurora/embedder_texture_plugin.cpp b/packages/embedder_texture/aurora/embedder_texture_plugin.cpp index 9749bb5..882d36a 100644 --- a/packages/embedder_texture/aurora/embedder_texture_plugin.cpp +++ b/packages/embedder_texture/aurora/embedder_texture_plugin.cpp @@ -43,12 +43,41 @@ void EmbedderTexturePlugin::onMethodCall(const MethodCall &call) void EmbedderTexturePlugin::onCreate(const MethodCall &call) { - unsigned int texture_id = 0; + auto width = call.GetArgument("width"); + auto height = call.GetArgument("height"); + static GLfloat pixels[] = + { + 1, 0, 0, + 0, 1, 0, + 0, 0, 1, + 1, 1, 1 + }; + + glEnable(GL_TEXTURE_2D); + + GLuint texture_id; glGenTextures(1, &texture_id); + glBindTexture(GL_TEXTURE_2D, texture_id); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels); + std::cout << "--------------------" << std::endl; + std::cout << glGetError() << std::endl; + std::cout << texture_id << std::endl; + std::cout << width << std::endl; + std::cout << height << std::endl; + std::cout << "++++++++++++++++++++" << std::endl; + + if (texture_id != 0) { +// call.TextureRegister(texture_id); + } + call.SendSuccessResponse(texture_id); }