RAPICAM_3-15-2015
|
#include "RaspiTexUtil.h"
#include "RaspiTex.h"
#include <bcm_host.h>
#include <GLES2/gl2.h>
Functions | |
void | raspitexutil_gl_term (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_create_native_window (RASPITEX_STATE *raspitex_state) |
void | raspitexutil_destroy_native_window (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_create_textures (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_gl_init_1_0 (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_gl_init_2_0 (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_do_update_texture (EGLDisplay display, EGLenum target, EGLClientBuffer mm_buf, GLuint *texture, EGLImageKHR *egl_image) |
int | raspitexutil_update_texture (RASPITEX_STATE *raspitex_state, EGLClientBuffer mm_buf) |
int | raspitexutil_update_y_texture (RASPITEX_STATE *raspitex_state, EGLClientBuffer mm_buf) |
int | raspitexutil_update_u_texture (RASPITEX_STATE *raspitex_state, EGLClientBuffer mm_buf) |
int | raspitexutil_update_v_texture (RASPITEX_STATE *raspitex_state, EGLClientBuffer mm_buf) |
int | raspitexutil_update_model (RASPITEX_STATE *raspitex_state) |
int | raspitexutil_redraw (RASPITEX_STATE *raspitex_state) |
void | raspitexutil_close (RASPITEX_STATE *raspitex_state) |
void | raspitexutil_brga_to_rgba (uint8_t *buffer, size_t size) |
int | raspitexutil_capture_bgra (RASPITEX_STATE *state, uint8_t **buffer, size_t *buffer_size) |
int | raspitexutil_build_shader_program (RASPITEXUTIL_SHADER_PROGRAM_T *p) |
Variables | |
VCOS_LOG_CAT_T | raspitex_log_category |
Provides default implementations for the raspitex_scene_ops functions and general utility functions.
void raspitexutil_brga_to_rgba | ( | uint8_t * | buffer, |
size_t | size | ||
) |
Performs an in-place byte swap from BGRA to RGBA.
buffer | The buffer to modify. |
size | Size of the buffer in bytes. |
int raspitexutil_build_shader_program | ( | RASPITEXUTIL_SHADER_PROGRAM_T * | p | ) |
Takes a description of shader program, compiles it and gets the locations of uniforms and attributes.
p | The shader program state. |
int raspitexutil_capture_bgra | ( | RASPITEX_STATE * | state, |
uint8_t ** | buffer, | ||
size_t * | buffer_size | ||
) |
Uses glReadPixels to grab the current frame-buffer contents and returns the result in a newly allocate buffer along with the its size. Data is returned in BGRA format for TGA output. PPM output doesn't require the channel order swap but would require a vflip. The TGA format also supports alpha. The byte swap is not done in this function to avoid blocking the GL rendering thread.
state | Pointer to the GL preview state. |
buffer | Address of pointer to set to pointer to new buffer. |
buffer_size | The size of the new buffer in bytes (out param) |
void raspitexutil_close | ( | RASPITEX_STATE * | raspitex_state | ) |
Default is a no-op
raspitex_state | A pointer to the GL preview state. |
int raspitexutil_create_native_window | ( | RASPITEX_STATE * | raspitex_state | ) |
Creates a native window for the GL surface using dispmanx
raspitex_state | A pointer to the GL preview state. |
void raspitexutil_destroy_native_window | ( | RASPITEX_STATE * | raspitex_state | ) |
Destroys the pools of buffers used by the GL renderer.
raspitex_state | A pointer to the GL preview state. |
int raspitexutil_do_update_texture | ( | EGLDisplay | display, |
EGLenum | target, | ||
EGLClientBuffer | mm_buf, | ||
GLuint * | texture, | ||
EGLImageKHR * | egl_image | ||
) |
Advances the texture and EGL image to the next MMAL buffer.
display | The EGL display. |
target | The EGL image target e.g. EGL_IMAGE_BRCM_MULTIMEDIA |
mm_buf | The EGL client buffer (mmal opaque buffer) that is used to create the EGL Image for the preview texture. |
egl_image | Pointer to the EGL image to update with mm_buf. |
texture | Pointer to the texture to update from EGL image. |
int raspitexutil_gl_init_1_0 | ( | RASPITEX_STATE * | raspitex_state | ) |
Creates an OpenGL ES 1.X context.
raspitex_state | A pointer to the GL preview state. |
int raspitexutil_gl_init_2_0 | ( | RASPITEX_STATE * | raspitex_state | ) |
Creates an OpenGL ES 2.X context.
raspitex_state | A pointer to the GL preview state. |
void raspitexutil_gl_term | ( | RASPITEX_STATE * | raspitex_state | ) |
Deletes textures and EGL surfaces and context.
raspitex_state | Pointer to the Raspi |
int raspitexutil_redraw | ( | RASPITEX_STATE * | raspitex_state | ) |
Default is a no-op
raspitex_state | A pointer to the GL preview state. |
int raspitexutil_update_model | ( | RASPITEX_STATE * | raspitex_state | ) |
Default is a no-op
raspitex_state | A pointer to the GL preview state. |
int raspitexutil_update_texture | ( | RASPITEX_STATE * | raspitex_state, |
EGLClientBuffer | mm_buf | ||
) |
Updates the RGBX texture to the specified MMAL buffer.
raspitex_state | A pointer to the GL preview state. |
mm_buf | The MMAL buffer. |
int raspitexutil_update_u_texture | ( | RASPITEX_STATE * | raspitex_state, |
EGLClientBuffer | mm_buf | ||
) |
Updates the U plane texture to the specified MMAL buffer.
raspitex_state | A pointer to the GL preview state. |
mm_buf | The MMAL buffer. |
int raspitexutil_update_v_texture | ( | RASPITEX_STATE * | raspitex_state, |
EGLClientBuffer | mm_buf | ||
) |
Updates the V plane texture to the specified MMAL buffer.
raspitex_state | A pointer to the GL preview state. |
mm_buf | The MMAL buffer. |
int raspitexutil_update_y_texture | ( | RASPITEX_STATE * | raspitex_state, |
EGLClientBuffer | mm_buf | ||
) |
Updates the Y plane texture to the specified MMAL buffer.
raspitex_state | A pointer to the GL preview state. |
mm_buf | The MMAL buffer. |