linewidth bugs fixed when MINIMIZE_GL_CALLS
This commit is contained in:
parent
392611045a
commit
d67316454c
17
drawing.cpp
17
drawing.cpp
|
@ -559,7 +559,7 @@ ld scale_at(const transmatrix& T) {
|
||||||
|
|
||||||
ld linewidthat(const hyperpoint& h) {
|
ld linewidthat(const hyperpoint& h) {
|
||||||
if(!(vid.antialias & AA_LINEWIDTH)) return 1;
|
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];
|
double dz = h[DIM];
|
||||||
if(dz < 1 || abs(dz-current_display->scrdist) < 1e-6) return 1;
|
if(dz < 1 || abs(dz-current_display->scrdist) < 1e-6) return 1;
|
||||||
else {
|
else {
|
||||||
|
@ -578,6 +578,13 @@ ld linewidthat(const hyperpoint& h) {
|
||||||
return 1;
|
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
|
// -radius to +3radius
|
||||||
|
|
||||||
int mercator_coord;
|
int mercator_coord;
|
||||||
|
@ -889,7 +896,7 @@ void dqi_poly::draw() {
|
||||||
|
|
||||||
#if CAP_GL
|
#if CAP_GL
|
||||||
if(vid.usingGL && (current_display->set_all(global_projection), shaderside_projection)) {
|
if(vid.usingGL && (current_display->set_all(global_projection), shaderside_projection)) {
|
||||||
glLineWidth(get_width(this));
|
set_width(get_width(this));
|
||||||
flags &= ~POLY_INVERSE;
|
flags &= ~POLY_INVERSE;
|
||||||
gldraw();
|
gldraw();
|
||||||
return;
|
return;
|
||||||
|
@ -1024,7 +1031,7 @@ void dqi_poly::draw() {
|
||||||
if(tinf && (poly_flags & POLY_INVERSE)) {
|
if(tinf && (poly_flags & POLY_INVERSE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
glLineWidth(get_width(this));
|
set_width(get_width(this));
|
||||||
dqi_poly npoly = (*this);
|
dqi_poly npoly = (*this);
|
||||||
npoly.V = Id;
|
npoly.V = Id;
|
||||||
npoly.tab = &glcoords;
|
npoly.tab = &glcoords;
|
||||||
|
@ -1253,11 +1260,11 @@ void sort_drawqueue() {
|
||||||
|
|
||||||
#if MINIMIZE_GL_CALLS
|
#if MINIMIZE_GL_CALLS
|
||||||
unordered_map<color_t, vector<unique_ptr<drawqueueitem>>> subqueue;
|
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();
|
ptds.clear();
|
||||||
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
|
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
|
||||||
subqueue.clear();
|
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();
|
ptds.clear();
|
||||||
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
|
for(auto& p: subqueue) for(auto& r: p.second) ptds.push_back(move(r));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,6 +43,7 @@ ld fogbase;
|
||||||
typedef const void *constvoidptr;
|
typedef const void *constvoidptr;
|
||||||
|
|
||||||
constvoidptr current_vertices, buffered_vertices;
|
constvoidptr current_vertices, buffered_vertices;
|
||||||
|
ld current_linewidth;
|
||||||
|
|
||||||
GLuint buf_current, buf_buffered;
|
GLuint buf_current, buf_buffered;
|
||||||
|
|
||||||
|
@ -468,6 +469,7 @@ void switch_mode(eMode m, shader_projection sp) {
|
||||||
current_projection[0][0] = -1e8;
|
current_projection[0][0] = -1e8;
|
||||||
}, {});
|
}, {});
|
||||||
id_modelview();
|
id_modelview();
|
||||||
|
current_linewidth = -1;
|
||||||
/* if(current_depthwrite) glDepthMask(GL_TRUE);
|
/* if(current_depthwrite) glDepthMask(GL_TRUE);
|
||||||
else glDepthMask(GL_FALSE);
|
else glDepthMask(GL_FALSE);
|
||||||
if(current_depthtest) glEnable(GL_DEPTH_TEST);
|
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) {
|
void switch_to_text(const vector<glvertex>& v, const vector<glvertex>& t) {
|
||||||
glhr::be_textured();
|
glhr::be_textured();
|
||||||
dynamicval<eModel> pm(pmodel, mdUnchanged);
|
dynamicval<eModel> pm(pmodel, mdUnchanged);
|
||||||
|
|
Loading…
Reference in New Issue