diff --git a/basegraph.cpp b/basegraph.cpp index 2166e860..98f6a6b9 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -362,6 +362,7 @@ inline void reset_projection() { new_projection_needed = true; } EX ld lband_shift; void display_data::set_all(int ed, ld shift) { + if(!vid.usingGL) return; auto t = this; auto current_projection = tie(ed, pmodel, t, current_rbuffer); if(new_projection_needed || !glhr::current_glprogram || (next_shader_flags & GF_which) != (glhr::current_glprogram->shader_flags & GF_which) || current_projection != last_projection || shift != lband_shift) { @@ -625,7 +626,11 @@ EX void init_glfont(int size) { SDL_DestroySurface(txt); #endif +#if CAP_SDLTTF if(ch >= 128 && !TTF_GlyphIsProvided(cfont->font[siz], unicode_value(natchars[ch-128], 0).first)) { +#else + if(ch >= 128) { +#endif string s = natchars[ch - 128]; if(s == "Ⓐ") f.reps[ch] = "(A)"; if(s == "Ⓑ") f.reps[ch] = "(B)"; @@ -811,7 +816,8 @@ EX void resetGL() { check_cgi(); if(currentmap) cgi.require_shapes(); - cgi.initPolyForGL(); + + for(auto& c: cgis) c.second.initPolyForGL(); #if MAXMDIM >= 4 if(GDIM == 3 && !floor_textures) make_floor_textures(); #endif diff --git a/glhr.cpp b/glhr.cpp index 35a670a1..fc50039d 100644 --- a/glhr.cpp +++ b/glhr.cpp @@ -55,6 +55,7 @@ EX } // Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details EX void glError(const char* GLcall, const char* file, const int line) { + if(!vid.usingGL) return; GLenum errCode = glGetError(); if(errCode!=GL_NO_ERROR) rate_limited_error(hr::format("OPENGL ERROR #%i: in file %s on line %i :: %s",errCode,file, line, GLcall)); @@ -72,6 +73,7 @@ struct glwrap { #endif void glwrap::act(const char *when) { + if(!vid.usingGL) return; GLenum errCode = glGetError(); if(errCode!=GL_NO_ERROR) rate_limited_error(hr::format("GL error %i %s: %s:%i", errCode, when, msg, line)); diff --git a/hypgraph.cpp b/hypgraph.cpp index 82de0cef..218e0c6f 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -2548,7 +2548,7 @@ transmatrix backup_cam; EX void enable_flat_model(int val) { if(flat_on < 1 && flat_on + val >= 1) { #if CAP_GL - glClear(GL_DEPTH_BUFFER_BIT); + if(graphics_on && vid.usingGL) glClear(GL_DEPTH_BUFFER_BIT); #endif backup_geometry = geometry; backup_variation = variation; diff --git a/polygons.cpp b/polygons.cpp index a4a52119..3c308f1a 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -136,24 +136,29 @@ void geometry_information::shift(hpcshape& sh, double dx, double dy, double dz) } void geometry_information::initPolyForGL() { -#if CAP_GL ourshape.clear(); for(auto& h: hpc) ourshape.push_back(glhr::pointtogl(h)); - glhr::store_in_buffer(ourshape); +#if CAP_GL + if(graphics_on && vid.usingGL) + glhr::store_in_buffer(ourshape); #endif } void geometry_information::extra_vertices() { -#if CAP_GL while(isize(ourshape) < isize(hpc)) ourshape.push_back(glhr::pointtogl(hpc[isize(ourshape)])); - glhr::store_in_buffer(ourshape); - glhr::current_vertices = NULL; - prehpc = isize(hpc); + +#if CAP_GL + if(graphics_on && vid.usingGL) { + glhr::store_in_buffer(ourshape); + glhr::current_vertices = NULL; + } #endif + + prehpc = isize(hpc); } transmatrix geometry_information::ddi(int a, ld x) { return xspinpush(a * S_step, x); }