linewidth bugs fixed when MINIMIZE_GL_CALLS

This commit is contained in:
Zeno Rogue 2019-07-12 23:15:09 +02:00
parent 392611045a
commit d67316454c
2 changed files with 21 additions and 5 deletions

View File

@ -559,7 +559,7 @@ ld scale_at(const transmatrix& T) {
ld linewidthat(const hyperpoint& h) {
if(!(vid.antialias & AA_LINEWIDTH)) return 1;
else if(hyperbolic && pmodel == mdDisk && vid.alpha == 1) {
else if(hyperbolic && pmodel == mdDisk && vid.alpha == 1 && !ISWEB) {
double dz = h[DIM];
if(dz < 1 || abs(dz-current_display->scrdist) < 1e-6) return 1;
else {
@ -578,6 +578,13 @@ ld linewidthat(const hyperpoint& h) {
return 1;
}
void set_width(ld w) {
#if MINIMIZE_GL_CALLS
if(w != glhr::current_linewidth) glflush();
#endif
glhr::set_linewidth(w);
}
// -radius to +3radius
int mercator_coord;
@ -889,7 +896,7 @@ void dqi_poly::draw() {
#if CAP_GL
if(vid.usingGL && (current_display->set_all(global_projection), shaderside_projection)) {
glLineWidth(get_width(this));
set_width(get_width(this));
flags &= ~POLY_INVERSE;
gldraw();
return;
@ -1024,7 +1031,7 @@ void dqi_poly::draw() {
if(tinf && (poly_flags & POLY_INVERSE)) {
return;
}
glLineWidth(get_width(this));
set_width(get_width(this));
dqi_poly npoly = (*this);
npoly.V = Id;
npoly.tab = &glcoords;
@ -1253,11 +1260,11 @@ void sort_drawqueue() {
#if MINIMIZE_GL_CALLS
unordered_map<color_t, vector<unique_ptr<drawqueueitem>>> subqueue;
for(auto& p: ptds) subqueue[p->prio == PPR::CIRCLE ? 0 : p->outline_group()].push_back(move(p));
for(auto& p: ptds) subqueue[(p->prio == PPR::CIRCLE || p->prio == PPR::OUTCIRCLE) ? 0 : p->outline_group()].push_back(move(p));
ptds.clear();
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
subqueue.clear();
for(auto& p: ptds) subqueue[p->prio == PPR::CIRCLE ? 0 : p->color].push_back(move(p));
for(auto& p: ptds) subqueue[(p->prio == PPR::CIRCLE || p->prio == PPR::OUTCIRCLE) ? 0 : p->color].push_back(move(p));
ptds.clear();
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
#endif

View File

@ -43,6 +43,7 @@ ld fogbase;
typedef const void *constvoidptr;
constvoidptr current_vertices, buffered_vertices;
ld current_linewidth;
GLuint buf_current, buf_buffered;
@ -468,6 +469,7 @@ void switch_mode(eMode m, shader_projection sp) {
current_projection[0][0] = -1e8;
}, {});
id_modelview();
current_linewidth = -1;
/* if(current_depthwrite) glDepthMask(GL_TRUE);
else glDepthMask(GL_FALSE);
if(current_depthtest) glEnable(GL_DEPTH_TEST);
@ -824,6 +826,13 @@ void set_depthwrite(bool b) {
}
}
void set_linewidth(ld lw) {
if(lw != current_linewidth) {
current_linewidth = lw;
glLineWidth(lw);
}
}
void switch_to_text(const vector<glvertex>& v, const vector<glvertex>& t) {
glhr::be_textured();
dynamicval<eModel> pm(pmodel, mdUnchanged);