UFO: Alien Invasion
Loading...
Searching...
No Matches
r_program.h
Go to the documentation of this file.
1/*
2* Copyright(c) 1997-2001 Id Software, Inc.
3* Copyright(c) 2002 The Quakeforge Project.
4* Copyright(c) 2006 Quake2World.
5*
6* This program is free software; you can redistribute it and/or
7* modify it under the terms of the GNU General Public License
8* as published by the Free Software Foundation; either version 2
9* of the License, or(at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14*
15* See the GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with this program; if not, write to the Free Software
19* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20*/
21
22#pragma once
23
24#include "r_gl.h"
25
26/* glsl vertex and fragment shaders */
27typedef struct r_shader_s {
32
33#ifndef GL_UNIFORM
34#define GL_UNIFORM 1
35#endif
36#define GL_ATTRIBUTE 2
37/* program variables */
38typedef struct r_progvar_s {
43
44/* NOTE: OpenGL spec says we must be able to have at
45 * least 64 uniforms; may be more. glGet(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS) */
46#define MAX_PROGRAM_VARS 32
47
48struct r_program_s;
49
50typedef void (*programInitFunc_t)(struct r_program_s* prog);
51typedef void (*programUseFunc_t)(struct r_program_s* prog);
52
53/* and glsl programs */
64
65#define MAX_PROGRAMS 16
66#define MAX_SHADERS MAX_PROGRAMS * 2
67
68void R_UseProgram(r_program_t* prog);
69void R_ShutdownPrograms(void);
70void R_InitPrograms(void);
71
72void R_AttributePointer(const char* name, GLuint size, const GLvoid* array);
73void R_EnableAttribute(const char* name);
74void R_DisableAttribute(const char* name);
75
76void R_ProgramParameter1f(const char* name, GLfloat value);
77void R_ProgramParameter1fvs(const char* name, GLint size, GLfloat* value);
78void R_ProgramParameter1i(const char* name, GLint value);
79void R_ProgramParameter2fv(const char* name, GLfloat* value);
80void R_ProgramParameter2fvs(const char* name, GLint size, GLfloat* value);
81void R_ProgramParameter3fv(const char* name, GLfloat* value);
82void R_ProgramParameter3fvs(const char* name, GLint size, GLfloat* value);
83void R_ProgramParameter4fv(const char* name, GLfloat* value);
84void R_ProgramParameter4fvs(const char* name, GLint size, GLfloat* value);
85void R_ProgramParameterMatrix4fv(const char* name, GLfloat* value);
86
89
91void R_RestartPrograms_f(void);
#define MAX_QPATH
Definition filesys.h:40
voidpf void uLong size
Definition ioapi.h:42
OpenGL bindings.
QGL_EXTERN void(APIENTRY *qglActiveTexture)(GLenum texture)
QGL_EXTERN GLint
Definition r_gl.h:135
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition r_gl.h:110
QGL_EXTERN GLuint
Definition r_gl.h:124
QGL_EXTERN const GLuint *QGL_EXTERN GLuint *QGL_EXTERN GLenum
Definition r_gl.h:127
void R_InitParticleProgram(r_program_t *prog)
void R_ProgramParameter1fvs(const char *name, GLint size, GLfloat *value)
void(* programUseFunc_t)(struct r_program_s *prog)
Definition r_program.h:51
#define MAX_PROGRAM_VARS
Definition r_program.h:46
void R_RestartPrograms_f(void)
Reloads the glsl shaders.
void R_ProgramParameter1i(const char *name, GLint value)
void R_UseParticleProgram(r_program_t *prog)
r_program_t * R_LoadProgram(const char *name, programInitFunc_t init, programUseFunc_t use)
void(* programInitFunc_t)(struct r_program_s *prog)
Definition r_program.h:50
void R_EnableAttribute(const char *name)
void R_ProgramParameterMatrix4fv(const char *name, GLfloat *value)
void R_ProgramParameter2fv(const char *name, GLfloat *value)
void R_ProgramParameter3fvs(const char *name, GLint size, GLfloat *value)
void R_ProgramParameter4fv(const char *name, GLfloat *value)
void R_InitPrograms(void)
void R_ShutdownPrograms(void)
void R_ProgramParameter1f(const char *name, GLfloat value)
void R_ProgramParameter4fvs(const char *name, GLint size, GLfloat *value)
void R_DisableAttribute(const char *name)
void R_AttributePointer(const char *name, GLuint size, const GLvoid *array)
void R_ProgramParameter2fvs(const char *name, GLint size, GLfloat *value)
void R_UseProgram(r_program_t *prog)
Definition r_program.cpp:43
void R_ProgramParameter3fv(const char *name, GLfloat *value)
#define MAX_VAR
Definition shared.h:36
programUseFunc_t use
Definition r_program.h:61
void * userdata
Definition r_program.h:62
GLuint id
Definition r_program.h:55
r_progvar_t vars[MAX_PROGRAM_VARS]
Definition r_program.h:59
programInitFunc_t init
Definition r_program.h:60
r_shader_t * v
Definition r_program.h:57
r_shader_t * f
Definition r_program.h:58
char name[MAX_VAR]
Definition r_program.h:56
GLint location
Definition r_program.h:41
GLint type
Definition r_program.h:39
char name[MAX_QPATH]
Definition r_program.h:40
GLuint id
Definition r_program.h:29
char name[MAX_QPATH]
Definition r_program.h:30
GLenum type
Definition r_program.h:28