i want to rendering image in godot each frame from unsigned char *pixels data
void render(int width, int height, const unsigned char *pixels)
// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
// GL_UNSIGNED_BYTE, pixels);
i know how to do this in imgui,though imgui.Image(textureid) function,but i dont know how to work with godot.i try to use set_pixel ,but dont work
int size = sizeof(unsigned char);
Ref<Image> image = new Image(width, height, false, Image::FORMAT_RGBA8);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
// call im->set_pixel to create the image
// printf("%d\n", );
image->set_pixel(x, y, Color(*(pixels + x * y * size*4)/255
, *(pixels + x * y * size*4+1)/255,
*(pixels + x * y * size*4+2)/255,
0.5));
}
// image->create_from_data(width, height, false, Image::FORMAT_RGBA8, vec);
}