/*
 * zazgl.h: included in every Zaz and FTGL file of the fredygames.com browser build (-include). The build
 * draws through Emscripten's legacy OpenGL emulation (glBegin/glEnd over WebGL), which has the float
 * forms of these two calls but not the double ones the game uses.
 * Copyright (C) 2026 FredyGames. GNU GPL version 3 or later, like Zaz.
 */
#ifndef ZAZ_GL_H
#define ZAZ_GL_H
#include <GL/gl.h>
#define glVertex3d(x, y, z) glVertex3f ((GLfloat) (x), (GLfloat) (y), (GLfloat) (z))
#define glTexCoord2d(s, t) glTexCoord2f ((GLfloat) (s), (GLfloat) (t))

/* WebGL accepts neither GL_CLAMP, nor GL_BGR/GL_BGRA, nor the old "number of components" internal
 * formats, and the emulation draws GL_ALPHA textures (FTGL's glyphs) black; these wrappers (zazgl.c)
 * translate all that before calling the real functions */
#ifdef __cplusplus
extern "C" {
#endif
void zaz_TexParameteri (GLenum target, GLenum pname, GLint param);
void zaz_TexEnvi (GLenum target, GLenum pname, GLint param);
void zaz_BindTexture (GLenum target, GLuint texture);
void zaz_TexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
                        GLsizei height, GLenum format, GLenum type, const void *pixels);
void zaz_TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
                     GLint border, GLenum format, GLenum type, const void *pixels);
#ifdef __cplusplus
}
#endif
#define glTexParameteri zaz_TexParameteri
#define glTexImage2D zaz_TexImage2D
#define glTexSubImage2D zaz_TexSubImage2D
#define glTexEnvi zaz_TexEnvi
#define glBindTexture zaz_BindTexture
#endif
