40#ifndef GEOGRAM_GFX_BASIC_GL
41#define GEOGRAM_GFX_BASIC_GL
50#if defined(GEO_OS_EMSCRIPTEN)
51# define GLFW_INCLUDE_ES2
52# include <GLFW/glfw3.h>
53# define GL_GLEXT_PROTOTYPES
54# include <GLES3/gl3.h>
55 typedef double GLdouble;
58# define GEO_GL_NO_DOUBLES
59#elif defined(GEO_OS_ANDROID)
60# include <GLES3/gl3.h>
61# include <GLES3/gl31.h>
62# include <GLES3/gl32.h>
63# define GEO_GL_TEXTURE_3D
67# define GEO_GL_NO_DOUBLES
70# ifdef GEO_COMPILER_CLANG
71# pragma GCC diagnostic push
72# pragma GCC diagnostic ignored "-Wreserved-identifier"
75# include <geogram_gfx/third_party/glad/glad.h>
77# ifdef GEO_COMPILER_CLANG
78# pragma GCC diagnostic pop
81# define GEO_GL_TEXTURE_3D
97#if defined(GEO_OS_EMSCRIPTEN) || defined(GEO_OS_ANDROID)
99# define GL_RGB8 0x8051
103# define GL_RGBA8 0x8058
107# define GL_R16F 0x822D
111# define GL_R32F 0x822E
115# define GL_RED 0x1903
123# define GL_R16 0x822A
126# ifndef GL_DEPTH_COMPONENT24
127# define GL_DEPTH_COMPONENT24 0x81A6
159 glupVertex2dv(v.
data());
167 glupVertex3dv(v.
data());
176 glupVertex4dv(v.
data());
184 glupColor3dv(v.
data());
192 glupColor4dv(v.
data());
201 glupTexCoord2dv(v.
data());
209 glupTexCoord3dv(v.
data());
217 glupTexCoord4dv(v.
data());
225 glupTranslated(v.x, v.y, v.z);
287 GLuint& buffer_id, GLenum target,
size_t new_size,
const void* data
308 GLuint& buffer_id, GLenum target,
size_t new_size,
const void* data
332 GLuint& buffer_id, GLenum target,
size_t new_size,
const void* data,
344 const char* file,
int line,
bool warning_only=
false
387# define GEO_CHECK_GL() ::GEO::check_gl(__FILE__,__LINE__)
389# define GEO_CHECK_GL()
GLUP: GL Useful Primitives.
void initialize()
Initializes some GL functions and objects.
void terminate()
Terminates GL functions and objects.
T * data()
Gets modifiable vector data.
Geometric functions in 2d and 3d.
Common include file, providing basic definitions. Should be included before anything else by all head...
Basic definitions for the Geogram C API.
#define GEOGRAM_GFX_API
Linkage declaration for geogram symbols.
Global Vorpaline namespace.
void glupLoadMatrix(const mat4 &m)
Replaces the current GLUP matrix with a user defined one.
Matrix< 4, Numeric::float64 > mat4
Represents a 4x4 matrix.
void update_or_check_buffer_object(GLuint &buffer_id, GLenum target, size_t new_size, const void *data, bool update)
Updates the content of an OpenGL buffer object, and resizes it if need be, or tests whether it has th...
vecng< 3, Numeric::float64 > vec3
Represents points and vectors in 3d.
GLint64 get_size_of_bound_buffer_object(GLenum target)
Gets the size (in bytes) of the OpenGL buffer bound to a specified target.
void glupVertex(const vec2 &v)
Sends a vertex to OpenGL.
geo_index_t index_t
The type for storing and manipulating indices.
vecng< 4, Numeric::float64 > vec4
Represents points and vectors in 4d.
void glupTexCoord(const vec2 &v)
Sends 2d texture coordinates to OpenGL.
void clear_gl_error_flags(const char *file, int line)
Clears all error flags set by previous OpenGL calls.
void draw_unit_textured_quad(TexturedQuadMode mode=TEX_QUAD_RGBA)
Draws a textured quad.
void glupTranslate(const vec3 &v)
Applies a translation.
void glupMapTexCoords1d(double minval, double maxval, index_t mult=1)
Maps texture coordinates from a specified interval to the unit interval.
void update_buffer_object(GLuint &buffer_id, GLenum target, size_t new_size, const void *data)
Updates the content of an OpenGL buffer object, and resizes it if need be.
TexturedQuadMode
Constants for draw_unit_textured_quad().
vecng< 2, Numeric::float64 > vec2
Represents points and vectors in 2d.
vecng< DIM, FT > mult(const Matrix< DIM, FT > &M, const vecng< DIM, FT > &x)
Computes a matrix vector product.
void check_gl(const char *file, int line, bool warning_only=false)
Tests for OpenGL errors and displays a message if OpenGL errors were encountered.
void glupColor(const vec3 &v)
Sends a RGB color to OpenGL.
void glupMultMatrix(const mat4 &m)
Multiplies the current GLUP matrix with another one.
void stream_buffer_object(GLuint &buffer_id, GLenum target, size_t new_size, const void *data)
Updates the content of an OpenGL buffer object in streaming mode.