FB Graphics
FBGraphics (FBG) : Simple C 16, 24, 32 bpp generic graphics library with parallelism support and custom backend.
|
#include <sys/ioctl.h>
#include <linux/fb.h>
#include <unistd.h>
#include <fcntl.h>
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "fbgraphics.h"
Go to the source code of this file.
Data Structures | |
struct | _fbg_gles2_context |
OpenGL ES 2.0 wrapper data structure. More... | |
struct | _fbg_vbo_data |
struct which hold usual VBO data for 3D objects More... | |
Functions | |
struct _fbg * | fbg_gles2Setup (const char *fb_device, int components) |
initialize a FB Graphics OpenGL ES 2 (fbdev or RPI direct) context More... | |
void | fbg_gles2Clear () |
OpenGL clear. More... | |
void | fbg_gles2UpdateBuffer (struct _fbg *fbg) |
this update FBG disp_buffer with the actual rendered OpenGL content More... | |
int | fbg_gles2ShouldClose (struct _fbg *fbg) |
Query the user requested (window close etc) close status. More... | |
GLuint | fbg_gles2CreateTextureFromImage (struct _fbg *fbg, struct _fbg_img *img) |
create a non-interpolated (NEAREST) GL texture from a FBG image More... | |
GLuint | fbg_gles2CreateTexture (GLuint width, GLuint height, GLint internal_format) |
create an empty non-interpolated (NEAREST) GL texture More... | |
struct _fbg_vbo_data * | fbg_gles2CreateVBO (GLsizeiptr indices_count, const GLvoid *indices_data, size_t sizeof_indice_type, GLsizeiptr vertices_count, const GLvoid *vertices_data, GLsizeiptr texcoords_count, const GLvoid *texcoords_data, GLsizeiptr normals_count, const GLvoid *normals_data, GLsizeiptr colors_count, const GLvoid *colors_data) |
create a VBO from indexed data, support for vertices, UVs, normals and colors More... | |
void | fbg_gles2FreeVBOData (struct _fbg_vbo_data *vbo_data) |
free VBO data (created with fbg_gles2CreateVBO) More... | |
GLuint | fbg_gles2CreateVBOvu (GLsizeiptr data_count, const GLvoid *data) |
create a VBO from vertices + UV data packed into a single array More... | |
GLuint | fbg_gles2CreateShader (GLenum type, const GLchar *source) |
create a FBO More... | |
GLuint | fbg_gles2CreateShaderFromFile (GLenum type, const char *filename) |
create a shader from the content of a file More... | |
GLuint | fbg_gles2CreateProgram (GLuint vertex_shader, GLuint fragment_shader) |
create a vertex and/or fragment program More... | |
GLenum | fbg_gles2CreateProgramFromFiles (const char *vs, const char *fs) |
create a vertex and/or fragment/geometry program from a file More... | |
GLenum | fbg_gles2CreateProgramFromString (const char *vs, const char *fs) |
create a vertex and/or fragment/geometry program from a string More... | |
Variables | |
const GLfloat | fbg_gles2Quad [] |
Simple quad geometry (vertices + UV) More... | |
const char * | fbg_gles2SimpleVs |
Simple vertex shader (screen quad, vertices + UV) More... | |
const char * | fbg_gles2SimpleFs |
Simple textured fragment shader. More... | |
struct _fbg_gles2_context |
OpenGL ES 2.0 wrapper data structure.
Definition at line 47 of file fbg_opengl_es2.h.
struct _fbg_vbo_data |
struct which hold usual VBO data for 3D objects
Definition at line 73 of file fbg_opengl_es2.h.
Data Fields | ||
---|---|---|
GLuint | cbo | |
GLuint | ibo | |
GLuint | nbo | |
GLuint | tbo | |
GLuint | vbo |
void fbg_gles2Clear | ( | ) |
OpenGL clear.
GLuint fbg_gles2CreateProgram | ( | GLuint | vertex_shader, |
GLuint | fragment_shader | ||
) |
create a vertex and/or fragment program
vertex_shader | vertex shader id, can be 0 |
fragment_shader | fragment shader id, can be 0 |
GLenum fbg_gles2CreateProgramFromFiles | ( | const char * | vs, |
const char * | fs | ||
) |
create a vertex and/or fragment/geometry program from a file
vs | vertex shader file |
fs | fragment shader file |
GLenum fbg_gles2CreateProgramFromString | ( | const char * | vs, |
const char * | fs | ||
) |
create a vertex and/or fragment/geometry program from a string
vs | vertex shader string |
fs | fragment shader string |
GLuint fbg_gles2CreateShader | ( | GLenum | type, |
const GLchar * | source | ||
) |
create a FBO
texture | GL texture id |
type | GL shader type |
source | shader code |
GLuint fbg_gles2CreateShaderFromFile | ( | GLenum | type, |
const char * | filename | ||
) |
create a shader from the content of a file
type | GL shader type |
filename | file to load |
GLuint fbg_gles2CreateTexture | ( | GLuint | width, |
GLuint | height, | ||
GLint | internal_format | ||
) |
create an empty non-interpolated (NEAREST) GL texture
width | width of the requested texture |
height | height of the requested texture |
internal_format | OpenGL format (GL_RGBA etc.) |
create a non-interpolated (NEAREST) GL texture from a FBG image
fbg | pointer to a FBG context / data structure |
img | image structure pointer |
struct _fbg_vbo_data* fbg_gles2CreateVBO | ( | GLsizeiptr | indices_count, |
const GLvoid * | indices_data, | ||
size_t | sizeof_indice_type, | ||
GLsizeiptr | vertices_count, | ||
const GLvoid * | vertices_data, | ||
GLsizeiptr | texcoords_count, | ||
const GLvoid * | texcoords_data, | ||
GLsizeiptr | normals_count, | ||
const GLvoid * | normals_data, | ||
GLsizeiptr | colors_count, | ||
const GLvoid * | colors_data | ||
) |
create a VBO from indexed data, support for vertices, UVs, normals and colors
indices_count | indices count |
indices_data | data containing indices |
sizeof_indice_type | sizeof indice type |
vertices_count | vertices count |
vertices_data | data containing vertices |
texcoords_count | uv count |
texcoords_data | data containing uv |
normals_count | normals count |
normals_data | data containing normals |
colors_count | colors count |
colors_data | data containing colors |
GLuint fbg_gles2CreateVBOvu | ( | GLsizeiptr | data_count, |
const GLvoid * | data | ||
) |
create a VBO from vertices + UV data packed into a single array
data_count | vertices data count |
data | data containing all vertices (set of 3 x float) then all associated UVs (set of 2 x float) |
void fbg_gles2FreeVBOData | ( | struct _fbg_vbo_data * | vbo_data | ) |
free VBO data (created with fbg_gles2CreateVBO)
vbo_data | data structure containing the VBOs |
struct _fbg* fbg_gles2Setup | ( | const char * | fb_device, |
int | components | ||
) |
initialize a FB Graphics OpenGL ES 2 (fbdev or RPI direct) context
fb_device | framebuffer device; example : /dev/fb0 |
components | fbg context color components (4 for RGBA or 3 for RGB) |
int fbg_gles2ShouldClose | ( | struct _fbg * | fbg | ) |
Query the user requested (window close etc) close status.
fbg | pointer to a FBG context / data structure |
void fbg_gles2UpdateBuffer | ( | struct _fbg * | fbg | ) |
this update FBG disp_buffer with the actual rendered OpenGL content
fbg | pointer to a FBG context / data structure |
const GLfloat fbg_gles2Quad[] |
Simple quad geometry (vertices + UV)
const char* fbg_gles2SimpleFs |
Simple textured fragment shader.
const char* fbg_gles2SimpleVs |
Simple vertex shader (screen quad, vertices + UV)