@@ -107,6 +107,7 @@ public:
int createInputDMABufTexture2D(eGLImage &eglImage, int fd);
int createOutputDMABufTexture2D(eGLImage &eglImage, int fd);
void createInputTexture2D(eGLImage &eglImage, void *data);
+ void createOutputTexture2D(eGLImage &eglImage);
int attachTextureToFBO(eGLImage &eglImage);
@@ -297,6 +297,22 @@ void eGL::createInputTexture2D(eGLImage &eglImage, void *data)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
+/**
+ * \brief Create a 2D texture attached to an FBO for render-to-texture
+ * \param[in,out] eglImage EGL image to associate with the texture
+ * \param[in] format OpenGL internal format (e.g., GL_RGB, GL_RGBA)
+ *
+ * Creates a 2D texture in VRAM. The texture
+ * is configured with nearest filtering and clamp-to-edge wrapping. This
+ * is useful for uploading static data like lookup tables or uniform color
+ * matrices to the GPU.
+ */
+void eGL::createOutputTexture2D(eGLImage &eglImage)
+{
+ createInputTexture2D(eglImage, NULL);
+ attachTextureToFBO(eglImage);
+}
+
/**
* \brief Initialise the EGL context
*
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> --- include/libcamera/internal/egl.h | 1 + src/libcamera/egl.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)