Graphic-Pixel-Buffer

Abstraction of a native OpenGL off-screen pixel buffer to make other modules OS independent.

Supports OpenGL / GLES for drawing operations.

Summary
Graphic-Pixel-BufferAbstraction of a native OpenGL off-screen pixel buffer to make other modules OS independent.
CopyrightThis program is free software.
Files
C-kern/api/graphic/pixelbuffer.hHeader file Graphic-Pixel-Buffer.
C-kern/graphic/pixelbuffer.cImplementation file Graphic-Pixel-Buffer impl.
Types
struct pixelbuffer_tExport pixelbuffer_t into global namespace.
Functions
test
unittest_graphic_pixelbufferTest pixelbuffer_t functionality.
pixelbuffer_tWraps a native OpenGL off-screen pixel buffer.
lifetime
pixelbuffer_FREEStatic initializer.
init_pixelbufferCreates a new native OpenGL off-screen pixel buffer.
free_pixelbufferFrees all associated resources.
query
gl_pixelbufferReturns a pointer to a native opengl window.
size_pixelbufferReturns the width and height of pbuf.
configid_pixelbufferReturns the configuration ID of pbuf in configid.
inline implementation
pixelbuffer_t
gl_pixelbufferImplements pixelbuffer_t.gl_pixelbuffer.
size_pixelbufferImplements pixelbuffer_t.size_pixelbuffer.
configid_pixelbufferImplements pixelbuffer_t.configid_pixelbuffer.

Copyright

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.

Author

© 2014 Jörg Seebohn

Files

C-kern/api/graphic/pixelbuffer.h

C-kern/graphic/pixelbuffer.c

Implementation file Graphic-Pixel-Buffer impl.

Types

struct pixelbuffer_t

typedef struct pixelbuffer_t pixelbuffer_t

Export pixelbuffer_t into global namespace.

Functions

test

unittest_graphic_pixelbuffer

int unittest_graphic_pixelbuffer(void)

Test pixelbuffer_t functionality.

pixelbuffer_t

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.

Summary
lifetime
pixelbuffer_FREEStatic initializer.
init_pixelbufferCreates a new native OpenGL off-screen pixel buffer.
free_pixelbufferFrees all associated resources.
query
gl_pixelbufferReturns a pointer to a native opengl window.
size_pixelbufferReturns the width and height of pbuf.
configid_pixelbufferReturns the configuration ID of pbuf in configid.

lifetime

pixelbuffer_FREE

#define pixelbuffer_FREE surface_FREE

Static initializer.

init_pixelbuffer

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.

free_pixelbuffer

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.

query

gl_pixelbuffer

struct opengl_window_t * gl_pixelbuffer(const pixelbuffer_t *pbuf)

Returns a pointer to a native opengl window.

size_pixelbuffer

int size_pixelbuffer(const pixelbuffer_t *pbuf,
struct display_t *disp,
/*out*/uint32_t *width,
/*out*/uint32_t *height)

Returns the width and height of pbuf.

configid_pixelbuffer

int configid_pixelbuffer(const pixelbuffer_t *pbuf,
struct display_t *disp,
/*out*/uint32_t *configid)

Returns the configuration ID of pbuf in configid.  Use id in a call to <initfromconfigid_gconfig> for querying the configuration values assigned during creation of pbuf.

pixelbuffer_t

gl_pixelbuffer

#define gl_pixelbuffer(win) gl_surface(win)

Implements pixelbuffer_t.gl_pixelbuffer.

size_pixelbuffer

#define size_pixelbuffer(
   pbuf,
   disp,
   width,
   height
) size_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), width, height)

Implements pixelbuffer_t.size_pixelbuffer.

configid_pixelbuffer

#define configid_pixelbuffer(
   pbuf,
   disp,
   configid
) configid_eglpbuffer(gl_pixelbuffer(pbuf), gl_display(disp), configid)

Implements pixelbuffer_t.configid_pixelbuffer.

Abstraction of a native OpenGL off-screen pixel buffer to make other modules OS independent.
Implements Graphic-Pixel-Buffer.
typedef struct pixelbuffer_t pixelbuffer_t
Export pixelbuffer_t into global namespace.
struct pixelbuffer_t
Wraps a native OpenGL off-screen pixel buffer.
int unittest_graphic_pixelbuffer(void)
Test pixelbuffer_t functionality.
#define pixelbuffer_FREE surface_FREE
Static initializer.
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.
int free_pixelbuffer(pixelbuffer_t *pbuf,
struct display_t *disp)
Frees all associated resources.
struct opengl_window_t * gl_pixelbuffer(const pixelbuffer_t *pbuf)
Returns a pointer to a native opengl window.
int size_pixelbuffer(const pixelbuffer_t *pbuf,
struct display_t *disp,
/*out*/uint32_t *width,
/*out*/uint32_t *height)
Returns the width and height of pbuf.
int configid_pixelbuffer(const pixelbuffer_t *pbuf,
struct display_t *disp,
/*out*/uint32_t *configid)
Returns the configuration ID of pbuf in configid.
#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.
#define setcurrent_gcontext(
   cont,
   disp,
   drawsurf,
   readsurf
) setcurrent_eglcontext(gl_gcontext(cont), gl_display(disp), gl_surface(drawsurf), gl_surface(readsurf))
Implements gcontext_t.setcurrent_gcontext.
Close