@@ -108,6 +108,7 @@ public:
int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
void createTexture2D(eGLImage &eglImage, void *data);
+ void updateTexture2D(eGLImage &eglImage, void *data);
void createOutputTexture2D(eGLImage &eglImage);
int attachTextureToFBO(eGLImage &eglImage);
@@ -343,6 +343,23 @@ bool eGL::isAvailable()
return true;
}
+/**
+ * \brief Update a 2D texture already created
+ * \param[in,out] eglImage EGL image to associate with the texture
+ * \param[data] Data to update the texture with
+ *
+ * Updates a 2D texture in VRAM.
+ */
+void eGL::updateTexture2D(eGLImage &eglImage, void *data)
+{
+ ASSERT(tid_ == Thread::currentId());
+
+ activateBindTexture(eglImage);
+
+ // Update an already existing texture
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, eglImage.width_, eglImage.height_, eglImage.format_, GL_UNSIGNED_BYTE, data);
+}
+
/**
* \brief Create a 2D texture attached to an FBO for render-to-texture
* \param[in,out] eglImage EGL image to associate with the texture