Abstraction of a native OpenGL off-screen pixel buffer to make other modules OS independent.
Supports OpenGL / GLES for drawing operations.
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2014 Jörg Seebohn
Header file Graphic-Pixel-Buffer.
Implementation file Graphic-Pixel-Buffer impl.
typedef struct pixelbuffer_t pixelbuffer_t
Export pixelbuffer_t into global namespace.
test | |
unittest_graphic_pixelbuffer | Test pixelbuffer_t functionality. |
int unittest_graphic_pixelbuffer( void )
Test pixelbuffer_t functionality.
struct pixelbuffer_t
Wraps a native OpenGL off-screen pixel buffer. You can use this drawing surface for off-screen rendering. Call setcurrent_gcontext with a pixelbuffer as 3rd and 4th argument. To read the pixels call OpenGL/ES function glReadPixels.
lifetime | |
pixelbuffer_FREE | Static initializer. |
init_pixelbuffer | Creates a new native OpenGL off-screen pixel buffer. |
free_pixelbuffer | Frees all associated resources. |
query | |
gl_pixelbuffer | Returns a pointer to a native opengl window. |
size_pixelbuffer | Returns the width and height of pbuf. |
configid_pixelbuffer | Returns the configuration ID of pbuf in configid. |
int init_pixelbuffer( /*out*/pixelbuffer_t * pbuf, struct display_t * disp, struct gconfig_t * gconf, uint32_t width, uint32_t height )
Creates a new native OpenGL off-screen pixel buffer. It is returned in pbuf. EALLOC is returned in case width or height are too large or not enough resources.
int free_pixelbuffer( pixelbuffer_t * pbuf, struct display_t * disp )
Frees all associated resources. Make sure that no thread uses pbuf as current drawing surface before calling this function. See setcurrent_gcontext.
#define gl_pixelbuffer( win ) gl_surface(win)
Implements pixelbuffer_t.gl_pixelbuffer.
#define size_pixelbuffer( pbuf, disp, width, height ) size_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), width, height)
Implements pixelbuffer_t.size_pixelbuffer.
#define configid_pixelbuffer( pbuf, disp, configid ) configid_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), configid)
Implements pixelbuffer_t.configid_pixelbuffer.
Export pixelbuffer_t into global namespace.
typedef struct pixelbuffer_t pixelbuffer_t
Wraps a native OpenGL off-screen pixel buffer.
struct pixelbuffer_t
Test pixelbuffer_t functionality.
int unittest_graphic_pixelbuffer( void )
Static initializer.
#define pixelbuffer_FREE surface_FREE
Creates a new native OpenGL off-screen pixel buffer.
int init_pixelbuffer( /*out*/pixelbuffer_t * pbuf, struct display_t * disp, struct gconfig_t * gconf, uint32_t width, uint32_t height )
Frees all associated resources.
int free_pixelbuffer( pixelbuffer_t * pbuf, struct display_t * disp )
Returns a pointer to a native opengl window.
struct opengl_window_t * gl_pixelbuffer( const pixelbuffer_t * pbuf )
Returns the width and height of pbuf.
int size_pixelbuffer( const pixelbuffer_t * pbuf, struct display_t * disp, /*out*/uint32_t * width, /*out*/uint32_t * height )
Returns the configuration ID of pbuf in configid.
int configid_pixelbuffer( const pixelbuffer_t * pbuf, struct display_t * disp, /*out*/uint32_t * configid )
Implements pixelbuffer_t.gl_pixelbuffer.
#define gl_pixelbuffer( win ) gl_surface(win)
Implements pixelbuffer_t.size_pixelbuffer.
#define size_pixelbuffer( pbuf, disp, width, height ) size_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), width, height)
Implements pixelbuffer_t.configid_pixelbuffer.
#define configid_pixelbuffer( pbuf, disp, configid ) configid_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), configid)
Implements gcontext_t.setcurrent_gcontext.
#define setcurrent_gcontext( cont, disp, drawsurf, readsurf ) setcurrent_eglcontext(gl_gcontext(cont), gl_display(disp), gl_surface(drawsurf), gl_surface(readsurf))