|
|
|
@ -7,6 +7,16 @@
|
|
|
|
|
#include <flutter/platform-methods.h> |
|
|
|
|
#include <sys/utsname.h> |
|
|
|
|
|
|
|
|
|
#include <GLES2/gl2.h> |
|
|
|
|
#include <GLES2/gl2ext.h> |
|
|
|
|
|
|
|
|
|
const GLfloat pixels[] = { |
|
|
|
|
1, 0, 0, |
|
|
|
|
0, 1, 0, |
|
|
|
|
0, 0, 1, |
|
|
|
|
1, 1, 1 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::RegisterWithRegistrar(PluginRegistrar ®istrar) |
|
|
|
|
{ |
|
|
|
|
registrar.RegisterMethodChannel("embedder_texture", |
|
|
|
@ -33,7 +43,13 @@ void EmbedderTexturePlugin::onMethodCall(const MethodCall &call)
|
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::onCreate(const MethodCall &call) |
|
|
|
|
{ |
|
|
|
|
call.SendSuccessResponse(0); |
|
|
|
|
unsigned int texture_id = 0; |
|
|
|
|
|
|
|
|
|
glGenTextures(1, &texture_id); |
|
|
|
|
glBindTexture(GL_TEXTURE_2D, texture_id); |
|
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels); |
|
|
|
|
|
|
|
|
|
call.SendSuccessResponse(texture_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void EmbedderTexturePlugin::onRemove(const MethodCall &call) |
|
|
|
|