|
|
|
@ -5,10 +5,6 @@
|
|
|
|
|
#include <embedder_texture/embedder_texture_plugin.h> |
|
|
|
|
#include <flutter/method-channel.h> |
|
|
|
|
#include <flutter/platform-methods.h> |
|
|
|
|
#include <sys/utsname.h> |
|
|
|
|
|
|
|
|
|
#include <GLES2/gl2.h> |
|
|
|
|
#include <GLES2/gl2ext.h> |
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
|
|
|
|
{ |
|
|
|
@ -36,42 +32,10 @@ void EmbedderTexturePlugin::onMethodCall(const MethodCall &call)
|
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::onCreate(const MethodCall &call) |
|
|
|
|
{ |
|
|
|
|
auto width = call.GetArgument<Encodable::Float>("width"); |
|
|
|
|
auto height = call.GetArgument<Encodable::Float>("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); |
|
|
|
|
} |
|
|
|
|
// auto width = call.GetArgument<Encodable::Float>("width");
|
|
|
|
|
// auto height = call.GetArgument<Encodable::Float>("height");
|
|
|
|
|
|
|
|
|
|
call.SendSuccessResponse(texture_id); |
|
|
|
|
call.SendSuccessResponse(call.TextureRegister()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::onRemove(const MethodCall &call) |
|
|
|
|