GNU Radio's FOSPHOR Package

gl_cmap.h
Go to the documentation of this file.
1/*
2 * gl_cmap.h
3 *
4 * OpenGL float texture -> color mapping
5 *
6 * Copyright (C) 2013-2014 Sylvain Munaut
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __FOSPHOR_GL_CMAP_H__
23#define __FOSPHOR_GL_CMAP_H__
24
25/*! \defgroup gl/cmap
26 * @{
27 */
28
29/*! \file gl_cmap.h
30 * \brief OpenGL float texture to color mapping
31 */
32
33#include <stdint.h>
34
35#include "gl_platform.h"
36
37
38 struct fosphor_gl_cmap_ctx;
39
40 enum fosphor_gl_cmap_mode {
41 GL_CMAP_MODE_NEAREST,
42 GL_CMAP_MODE_BILINEAR,
43 GL_CMAP_MODE_BICUBIC,
44};
45
46
47 struct fosphor_gl_cmap_ctx *fosphor_gl_cmap_init(void);
48 void fosphor_gl_cmap_release(struct fosphor_gl_cmap_ctx *cmap_ctx);
49
50 void fosphor_gl_cmap_enable(struct fosphor_gl_cmap_ctx *cmap_ctx,
51 GLuint tex_id, GLuint cmap_id,
52 float scale, float offset,
53 enum fosphor_gl_cmap_mode mode);
54 void fosphor_gl_cmap_disable(void);
55
56 void fosphor_gl_cmap_draw_scale(GLuint cmap_id,
57 float x0, float x1, float y0, float y1);
58
59 typedef int (*gl_cmap_gen_func_t)(uint32_t *rgba, int N, void *arg);
60 int fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, void *gfn_arg, int N);
61
62
63/*! @} */
64
65#endif /* __FOSPHOR_GL_CMAP_H__ */
gl_platform.h
Wrapper to select proper OpenGL headers for various platforms.
fosphor_gl_cmap_generate
int fosphor_gl_cmap_generate(GLuint *cmap_id, gl_cmap_gen_func_t gfn, void *gfn_arg, int N)
fosphor_gl_cmap_disable
void fosphor_gl_cmap_disable(void)
fosphor_gl_cmap_enable
void fosphor_gl_cmap_enable(struct fosphor_gl_cmap_ctx *cmap_ctx, GLuint tex_id, GLuint cmap_id, float scale, float offset, enum fosphor_gl_cmap_mode mode)
fosphor_gl_cmap_release
void fosphor_gl_cmap_release(struct fosphor_gl_cmap_ctx *cmap_ctx)
fosphor_gl_cmap_init
struct fosphor_gl_cmap_ctx * fosphor_gl_cmap_init(void)
fosphor_gl_cmap_draw_scale
void fosphor_gl_cmap_draw_scale(GLuint cmap_id, float x0, float x1, float y0, float y1)
fosphor_gl_cmap_mode
fosphor_gl_cmap_mode
Definition: gl_cmap.h:40
gl_cmap_gen_func_t
int(* gl_cmap_gen_func_t)(uint32_t *rgba, int N, void *arg)
Definition: gl_cmap.h:59
GL_CMAP_MODE_BICUBIC
@ GL_CMAP_MODE_BICUBIC
Definition: gl_cmap.h:43
GL_CMAP_MODE_BILINEAR
@ GL_CMAP_MODE_BILINEAR
Definition: gl_cmap.h:42
GL_CMAP_MODE_NEAREST
@ GL_CMAP_MODE_NEAREST
Definition: gl_cmap.h:41