mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-28 06:17:03 +00:00
fixed to work on OPENGL 1.0
This commit is contained in:
parent
c07e22ca5e
commit
5476b33e94
@ -219,9 +219,10 @@ void display_data::set_projection(int ed) {
|
|||||||
|
|
||||||
shaderside_projection = false;
|
shaderside_projection = false;
|
||||||
glhr::new_shader_projection = glhr::shader_projection::standard;
|
glhr::new_shader_projection = glhr::shader_projection::standard;
|
||||||
if(vid.consider_shader_projection) {
|
|
||||||
if(pmodel == mdDisk && !spherespecial && !(hyperbolic && vid.alpha <= -1) && DIM == 2)
|
if(vid.consider_shader_projection && pmodel == mdDisk && !spherespecial && !(hyperbolic && vid.alpha <= -1) && DIM == 2)
|
||||||
shaderside_projection = true;
|
shaderside_projection = true;
|
||||||
|
else if(vid.consider_shader_projection && !glhr::noshaders) {
|
||||||
if(pmodel == mdDisk && !spherespecial && !(hyperbolic && vid.alpha <= -1) && DIM == 3 && apply_models)
|
if(pmodel == mdDisk && !spherespecial && !(hyperbolic && vid.alpha <= -1) && DIM == 3 && apply_models)
|
||||||
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::ball;
|
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::ball;
|
||||||
if(pmodel == mdBand && hyperbolic && apply_models)
|
if(pmodel == mdBand && hyperbolic && apply_models)
|
||||||
@ -585,18 +586,16 @@ int gl_width(int size, const char *s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace glhr { void texture_vertices(GLfloat *f, int qty, int stride = 2) {
|
namespace glhr { void texture_vertices(GLfloat *f, int qty, int stride = 2) {
|
||||||
#if CAP_SHADER
|
WITHSHADER(
|
||||||
glVertexAttribPointer(aTexture, stride, GL_FLOAT, GL_FALSE, stride * sizeof(GLfloat), f);
|
glVertexAttribPointer(aTexture, stride, GL_FLOAT, GL_FALSE, stride * sizeof(GLfloat), f);,
|
||||||
#else
|
glTexCoordPointer(stride, GL_FLOAT, 0, f);
|
||||||
glTexCoordPointer(stride, GL_FLOAT, 0, f);
|
)
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
void oldvertices(GLfloat *f, int qty) {
|
void oldvertices(GLfloat *f, int qty) {
|
||||||
#if CAP_SHADER
|
WITHSHADER(
|
||||||
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, SHDIM * sizeof(GLfloat), f);
|
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, SHDIM * sizeof(GLfloat), f);,
|
||||||
#else
|
glVertexPointer(SHDIM, GL_FLOAT, 0, f);
|
||||||
glVertexPointer(SHDIM, GL_FLOAT, 0, f);
|
)
|
||||||
#endif
|
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2085,6 +2085,10 @@ int read_config_args() {
|
|||||||
}
|
}
|
||||||
TOGGLE('o', vid.usingGL, switchGL())
|
TOGGLE('o', vid.usingGL, switchGL())
|
||||||
TOGGLE('f', vid.full, switchFullscreen())
|
TOGGLE('f', vid.full, switchFullscreen())
|
||||||
|
else if(argis("-noshaders")) {
|
||||||
|
PHASE(1);
|
||||||
|
glhr::noshaders = true;
|
||||||
|
}
|
||||||
else if(argis("-d:sight")) {
|
else if(argis("-d:sight")) {
|
||||||
PHASEFROM(2); launch_dialog(); edit_sightrange();
|
PHASEFROM(2); launch_dialog(); edit_sightrange();
|
||||||
}
|
}
|
||||||
|
@ -4718,6 +4718,7 @@ void prepare_sky() {
|
|||||||
|
|
||||||
void dqi_sky::draw() {
|
void dqi_sky::draw() {
|
||||||
|
|
||||||
|
if(!vid.usingGL || sky.empty()) return;
|
||||||
vector<glhr::colored_vertex> skyvertices;
|
vector<glhr::colored_vertex> skyvertices;
|
||||||
|
|
||||||
int sk = get_skybrightness();
|
int sk = get_skybrightness();
|
||||||
|
307
shaders.cpp
307
shaders.cpp
@ -21,8 +21,20 @@ void glError(const char* GLcall, const char* file, const int line) {
|
|||||||
#define CAP_VERTEXBUFFER (ISWEB)
|
#define CAP_VERTEXBUFFER (ISWEB)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CAP_SHADER
|
||||||
|
#define WITHSHADER(x, y) if(noshaders) y else x
|
||||||
|
#else
|
||||||
|
#define WITHSHADER(x, y) y
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace glhr {
|
namespace glhr {
|
||||||
|
|
||||||
|
#if CAP_SHADER
|
||||||
|
bool noshaders = false;
|
||||||
|
#else
|
||||||
|
bool noshaders = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool glew = false;
|
bool glew = false;
|
||||||
|
|
||||||
bool current_depthtest, current_depthwrite;
|
bool current_depthtest, current_depthwrite;
|
||||||
@ -121,53 +133,31 @@ glmatrix translate(ld x, ld y, ld z) {
|
|||||||
|
|
||||||
// ** legacy **
|
// ** legacy **
|
||||||
|
|
||||||
#if !CAP_SHADER
|
|
||||||
|
|
||||||
void new_projection() {
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glLoadIdentity();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glLoadIdentity();
|
|
||||||
}
|
|
||||||
|
|
||||||
void projection_multiply(const glmatrix& m) {
|
|
||||||
glMultMatrixf(m.as_array());
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_modelview(const glmatrix& m) {
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glLoadMatrixf(m.as_array());
|
|
||||||
}
|
|
||||||
|
|
||||||
void id_modelview() {
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glLoadIdentity();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// /* shaders */
|
// /* shaders */
|
||||||
|
|
||||||
#if CAP_SHADER
|
|
||||||
|
|
||||||
glmatrix projection;
|
glmatrix projection;
|
||||||
|
|
||||||
void new_projection() {
|
void new_projection() {
|
||||||
projection = id;
|
WITHSHADER({
|
||||||
|
projection = id;
|
||||||
|
}, {
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void projection_multiply(const glmatrix& m) {
|
void projection_multiply(const glmatrix& m) {
|
||||||
projection = m * projection;
|
WITHSHADER({
|
||||||
|
projection = m * projection;
|
||||||
|
}, {
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glMultMatrixf(m.as_array());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#define glMatrixMode DISABLED
|
|
||||||
#define glLoadIdentity DISABLED
|
|
||||||
#define glMultMatrixf DISABLED
|
|
||||||
#define glScalef DISABLED
|
|
||||||
#define glTranslatef DISABLED
|
|
||||||
#define glPushMatrix DISABLED
|
|
||||||
#define glPopMatrix DISABLED
|
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
int compileShader(int type, const string& s) {
|
int compileShader(int type, const string& s) {
|
||||||
@ -321,6 +311,11 @@ bool operator != (const glmatrix& m1, const glmatrix& m2) {
|
|||||||
bool uses_mvp(shader_projection sp) { return among(sp, shader_projection::standard, shader_projection::flatten); }
|
bool uses_mvp(shader_projection sp) { return among(sp, shader_projection::standard, shader_projection::flatten); }
|
||||||
|
|
||||||
void set_modelview(const glmatrix& modelview) {
|
void set_modelview(const glmatrix& modelview) {
|
||||||
|
if(noshaders) {
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadMatrixf(modelview.as_array());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!current) return;
|
if(!current) return;
|
||||||
if(!uses_mvp(current_shader_projection)) {
|
if(!uses_mvp(current_shader_projection)) {
|
||||||
if(modelview != current_modelview) {
|
if(modelview != current_modelview) {
|
||||||
@ -345,6 +340,11 @@ void set_modelview(const glmatrix& modelview) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void id_modelview() {
|
void id_modelview() {
|
||||||
|
if(noshaders) {
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!current) return;
|
if(!current) return;
|
||||||
if(!uses_mvp(current_shader_projection)) { set_modelview(id); return; }
|
if(!uses_mvp(current_shader_projection)) { set_modelview(id); return; }
|
||||||
#if MINIMIZE_GL_CALLS
|
#if MINIMIZE_GL_CALLS
|
||||||
@ -354,19 +354,18 @@ void id_modelview() {
|
|||||||
glUniformMatrix4fv(current->uMVP, 1, 0, projection.as_array());
|
glUniformMatrix4fv(current->uMVP, 1, 0, projection.as_array());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void color2(color_t color, ld scale) {
|
void color2(color_t color, ld scale) {
|
||||||
GLfloat cols[4];
|
GLfloat cols[4];
|
||||||
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
||||||
cols[i] = part(color, 3-i) / 255.0 * scale;
|
cols[i] = part(color, 3-i) / 255.0 * scale;
|
||||||
#if CAP_SHADER
|
|
||||||
// glUniform4fv(current->uFog, 4, cols);
|
WITHSHADER({
|
||||||
if(!current) return;
|
if(!current) return;
|
||||||
glUniform4f(current->uColor, cols[0], cols[1], cols[2], cols[3]);
|
glUniform4f(current->uColor, cols[0], cols[1], cols[2], cols[3]);
|
||||||
#else
|
}, {
|
||||||
glColor4f(cols[0], cols[1], cols[2], cols[3]);
|
glColor4f(cols[0], cols[1], cols[2], cols[3]);
|
||||||
#endif
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
void colorClear(color_t color) {
|
void colorClear(color_t color) {
|
||||||
@ -381,55 +380,55 @@ void switch_mode(eMode m, shader_projection sp) {
|
|||||||
if(m == mode && current_shader_projection == sp) return;
|
if(m == mode && current_shader_projection == sp) return;
|
||||||
reset_projection();
|
reset_projection();
|
||||||
GLERR("pre_switch_mode");
|
GLERR("pre_switch_mode");
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
programs[m][int(sp)]->enable();
|
programs[m][int(sp)]->enable();
|
||||||
GLERR("after_enable");
|
GLERR("after_enable");
|
||||||
#endif
|
}, {})
|
||||||
flagtype newflags = flags[m] &~ flags[mode];
|
flagtype newflags = flags[m] &~ flags[mode];
|
||||||
flagtype oldflags = flags[mode] &~ flags[m];
|
flagtype oldflags = flags[mode] &~ flags[m];
|
||||||
if(newflags & GF_TEXTURE) {
|
if(newflags & GF_TEXTURE) {
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glEnableVertexAttribArray(aTexture);
|
glEnableVertexAttribArray(aTexture);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#else
|
}, {
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#endif
|
})
|
||||||
}
|
}
|
||||||
if(oldflags & GF_TEXTURE) {
|
if(oldflags & GF_TEXTURE) {
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glDisableVertexAttribArray(aTexture);
|
glDisableVertexAttribArray(aTexture);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#else
|
}, {
|
||||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#endif
|
});
|
||||||
}
|
}
|
||||||
if(newflags & GF_VARCOLOR) {
|
if(newflags & GF_VARCOLOR) {
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
glEnableVertexAttribArray(aColor);
|
glEnableVertexAttribArray(aColor);
|
||||||
#else
|
}, {
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
glEnableClientState(GL_COLOR_ARRAY);
|
glEnableClientState(GL_COLOR_ARRAY);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#endif
|
});
|
||||||
}
|
}
|
||||||
if(oldflags & GF_VARCOLOR) {
|
if(oldflags & GF_VARCOLOR) {
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glDisableVertexAttribArray(aColor);
|
glDisableVertexAttribArray(aColor);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#else
|
}, {
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
GLERR("xsm");
|
GLERR("xsm");
|
||||||
#endif
|
});
|
||||||
}
|
}
|
||||||
if(newflags & GF_LIGHTFOG) {
|
if(newflags & GF_LIGHTFOG) {
|
||||||
#if !CAP_SHADER
|
WITHSHADER({}, {
|
||||||
/*GLfloat light_ambient[] = { 3.5, 3.5, 3.5, 1.0 };
|
/*GLfloat light_ambient[] = { 3.5, 3.5, 3.5, 1.0 };
|
||||||
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
|
GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
|
||||||
GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 };
|
GLfloat light_position[] = { 0.0, 0.0, 0.0, 1.0 };
|
||||||
@ -451,24 +450,23 @@ void switch_mode(eMode m, shader_projection sp) {
|
|||||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||||
#endif
|
#endif
|
||||||
glFogf(GL_FOG_START, 0);
|
glFogf(GL_FOG_START, 0);
|
||||||
#endif
|
});
|
||||||
}
|
}
|
||||||
if(oldflags & GF_LIGHTFOG) {
|
if(oldflags & GF_LIGHTFOG) {
|
||||||
#if !CAP_SHADER
|
WITHSHADER({}, {glDisable(GL_FOG);});
|
||||||
glDisable(GL_FOG);
|
|
||||||
|
|
||||||
/*
|
|
||||||
glDisable(GL_LIGHTING); */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
glUniform1f(current->uFogBase, 1); fogbase = 1;
|
WITHSHADER({
|
||||||
|
glUniform1f(current->uFogBase, 1); fogbase = 1;
|
||||||
|
}, {});
|
||||||
mode = m;
|
mode = m;
|
||||||
current_shader_projection = sp;
|
current_shader_projection = sp;
|
||||||
GLERR("after_switch_mode");
|
GLERR("after_switch_mode");
|
||||||
current_vertices = NULL;
|
current_vertices = NULL;
|
||||||
current_matrix[0][0] = -1e8; // invalid
|
WITHSHADER({
|
||||||
current_modelview[0][0] = -1e8;
|
current_matrix[0][0] = -1e8; // invalid
|
||||||
current_projection[0][0] = -1e8;
|
current_modelview[0][0] = -1e8;
|
||||||
|
current_projection[0][0] = -1e8;
|
||||||
|
}, {});
|
||||||
id_modelview();
|
id_modelview();
|
||||||
/* if(current_depthwrite) glDepthMask(GL_TRUE);
|
/* if(current_depthwrite) glDepthMask(GL_TRUE);
|
||||||
else glDepthMask(GL_FALSE);
|
else glDepthMask(GL_FALSE);
|
||||||
@ -477,31 +475,34 @@ void switch_mode(eMode m, shader_projection sp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fog_max(ld fogmax, color_t fogcolor) {
|
void fog_max(ld fogmax, color_t fogcolor) {
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glUniform1f(current->uFog, 1 / fogmax);
|
glUniform1f(current->uFog, 1 / fogmax);
|
||||||
|
|
||||||
GLfloat cols[4];
|
GLfloat cols[4];
|
||||||
for(int i=0; i<4; i++) cols[i] = part(fogcolor, 3-i) / 255.0;
|
for(int i=0; i<4; i++) cols[i] = part(fogcolor, 3-i) / 255.0;
|
||||||
glUniform4f(current->uFogColor, cols[0], cols[1], cols[2], cols[3]);
|
glUniform4f(current->uFogColor, cols[0], cols[1], cols[2], cols[3]);
|
||||||
#else
|
}, {
|
||||||
glFogf(GL_FOG_END, fogmax);
|
glFogf(GL_FOG_END, fogmax);
|
||||||
#endif
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_fogbase(ld _fogbase) {
|
void set_fogbase(ld _fogbase) {
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
if(fogbase != _fogbase) {
|
if(fogbase != _fogbase) {
|
||||||
fogbase = _fogbase;
|
fogbase = _fogbase;
|
||||||
glUniform1f(current->uFogBase, fogbase);
|
glUniform1f(current->uFogBase, fogbase);
|
||||||
}
|
}
|
||||||
#endif
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_ualpha(ld alpha) {
|
void set_ualpha(ld alpha) {
|
||||||
glUniform1f(current->uAlpha, alpha);
|
WITHSHADER({
|
||||||
|
glUniform1f(current->uAlpha, alpha);
|
||||||
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
|
||||||
#if CAP_GLEW
|
#if CAP_GLEW
|
||||||
if(!glew) {
|
if(!glew) {
|
||||||
glew = true;
|
glew = true;
|
||||||
@ -512,12 +513,15 @@ void init() {
|
|||||||
printf("Failed to initialize GLEW\n");
|
printf("Failed to initialize GLEW\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
printf("CreateProgram = %p\n", __glewCreateProgram);
|
||||||
|
if(!__glewCreateProgram) noshaders = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_SHADER
|
#if CAP_SHADER
|
||||||
projection = id;
|
projection = id;
|
||||||
|
|
||||||
|
if(!noshaders)
|
||||||
for(int i=0; i<gmMAX; i++)
|
for(int i=0; i<gmMAX; i++)
|
||||||
for(int j=0; j<int(shader_projection::MAX); j++) {
|
for(int j=0; j<int(shader_projection::MAX); j++) {
|
||||||
flagtype f = flags[i];
|
flagtype f = flags[i];
|
||||||
@ -650,18 +654,14 @@ void init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch_mode(gmColored, shader_projection::standard);
|
switch_mode(gmColored, shader_projection::standard);
|
||||||
programs[gmColored][0]->enable();
|
if(!noshaders) programs[gmColored][0]->enable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !CAP_SHADER
|
#if !CAP_SHADER
|
||||||
switch_mode(gmColored, 0);
|
switch_mode(gmColored, shader_projection::standard);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CAP_SHADER
|
WITHSHADER(glEnableVertexAttribArray(aPosition);, glEnableClientState(GL_VERTEX_ARRAY);)
|
||||||
glEnableVertexAttribArray(aPosition);
|
|
||||||
#else
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
|
||||||
#endif
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
#if CAP_VERTEXBUFFER
|
#if CAP_VERTEXBUFFER
|
||||||
@ -715,11 +715,10 @@ void vertices(const vector<glvertex>& v, int vshift = 0) {
|
|||||||
#else
|
#else
|
||||||
if(current_vertices == &v[vshift]) return;
|
if(current_vertices == &v[vshift]) return;
|
||||||
current_vertices = &v[vshift];
|
current_vertices = &v[vshift];
|
||||||
#if CAP_SHADER
|
WITHSHADER(
|
||||||
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &v[vshift]);
|
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &v[vshift]);,
|
||||||
#else
|
glVertexPointer(SHDIM, GL_FLOAT, sizeof(glvertex), &v[0]);
|
||||||
glVertexPointer(SHDIM, GL_FLOAT, sizeof(glvertex), &v[0]);
|
)
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,11 +727,10 @@ void vertices_texture(const vector<glvertex>& v, const vector<glvertex>& t, int
|
|||||||
// not implemented!
|
// not implemented!
|
||||||
#else
|
#else
|
||||||
vertices(v, vshift);
|
vertices(v, vshift);
|
||||||
#if CAP_SHADER
|
WITHSHADER(
|
||||||
glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &t[tshift]);
|
glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(glvertex), &t[tshift]);,
|
||||||
#else
|
glTexCoordPointer(SHDIM, GL_FLOAT, 0, &t[tshift]);
|
||||||
glTexCoordPointer(SHDIM, GL_FLOAT, 0, &t[tshift]);
|
)
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -744,13 +742,13 @@ void prepare(vector<colored_vertex>& v) {
|
|||||||
#else
|
#else
|
||||||
if(current_vertices == &v[0]) return;
|
if(current_vertices == &v[0]) return;
|
||||||
current_vertices = &v[0];
|
current_vertices = &v[0];
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(colored_vertex), &v[0].coords);
|
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(colored_vertex), &v[0].coords);
|
||||||
glVertexAttribPointer(aColor, 4, GL_FLOAT, GL_FALSE, sizeof(colored_vertex), &v[0].color);
|
glVertexAttribPointer(aColor, 4, GL_FLOAT, GL_FALSE, sizeof(colored_vertex), &v[0].color);
|
||||||
#else
|
}, {
|
||||||
glVertexPointer(SHDIM, GL_FLOAT, sizeof(colored_vertex), &v[0].coords);
|
glVertexPointer(SHDIM, GL_FLOAT, sizeof(colored_vertex), &v[0].coords);
|
||||||
glColorPointer(4, GL_FLOAT, sizeof(colored_vertex), &v[0].color);
|
glColorPointer(4, GL_FLOAT, sizeof(colored_vertex), &v[0].color);
|
||||||
#endif
|
})
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,13 +760,13 @@ void prepare(vector<textured_vertex>& v) {
|
|||||||
#else
|
#else
|
||||||
if(current_vertices == &v[0]) return;
|
if(current_vertices == &v[0]) return;
|
||||||
current_vertices = &v[0];
|
current_vertices = &v[0];
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(textured_vertex), &v[0].coords);
|
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(textured_vertex), &v[0].coords);
|
||||||
glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(textured_vertex), &v[0].texture);
|
glVertexAttribPointer(aTexture, SHDIM, GL_FLOAT, GL_FALSE, sizeof(textured_vertex), &v[0].texture);
|
||||||
#else
|
}, {
|
||||||
glVertexPointer(SHDIM, GL_FLOAT, sizeof(textured_vertex), &v[0].coords);
|
glVertexPointer(SHDIM, GL_FLOAT, sizeof(textured_vertex), &v[0].coords);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(textured_vertex), &v[0].texture);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(textured_vertex), &v[0].texture);
|
||||||
#endif
|
});
|
||||||
#endif
|
#endif
|
||||||
// color2(col);
|
// color2(col);
|
||||||
}
|
}
|
||||||
@ -782,15 +780,15 @@ void prepare(vector<ct_vertex>& v) {
|
|||||||
#else
|
#else
|
||||||
if(current_vertices == &v[0]) return;
|
if(current_vertices == &v[0]) return;
|
||||||
current_vertices = &v[0];
|
current_vertices = &v[0];
|
||||||
#if CAP_SHADER
|
WITHSHADER({
|
||||||
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].coords);
|
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].coords);
|
||||||
glVertexAttribPointer(aColor, 4, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].color);
|
glVertexAttribPointer(aColor, 4, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].color);
|
||||||
glVertexAttribPointer(aTexture, 2, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].texture);
|
glVertexAttribPointer(aTexture, 2, GL_FLOAT, GL_FALSE, sizeof(ct_vertex), &v[0].texture);
|
||||||
#else
|
}, {
|
||||||
glVertexPointer(SHDIM, GL_FLOAT, sizeof(ct_vertex), &v[0].coords);
|
glVertexPointer(SHDIM, GL_FLOAT, sizeof(ct_vertex), &v[0].coords);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ct_vertex), &v[0].texture);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(ct_vertex), &v[0].texture);
|
||||||
glColorPointer(4, GL_FLOAT, sizeof(ct_vertex), &v[0].color);
|
glColorPointer(4, GL_FLOAT, sizeof(ct_vertex), &v[0].color);
|
||||||
#endif
|
})
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,3 +833,12 @@ void switch_to_text(const vector<glvertex>& v, const vector<glvertex>& t) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define glMatrixMode DISABLED
|
||||||
|
#define glLoadIdentity DISABLED
|
||||||
|
#define glMultMatrixf DISABLED
|
||||||
|
#define glScalef DISABLED
|
||||||
|
#define glTranslatef DISABLED
|
||||||
|
#define glPushMatrix DISABLED
|
||||||
|
#define glPopMatrix DISABLED
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user