diff --git a/drawing.cpp b/drawing.cpp index d25a8808..f9133dd6 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -598,10 +598,17 @@ void dqi_poly::gldraw() { #endif if(tinf) { - glhr::be_textured(); + bool col = isize(tinf->colors); + if(col) + glhr::be_color_textured(); + else + glhr::be_textured(); if(flags & POLY_SHADE_TEXTURE) current_display->next_shader_flags |= GF_TEXTURE_SHADED; glBindTexture(GL_TEXTURE_2D, tinf->texture_id); - glhr::vertices_texture(v, tinf->tvertices, offset, offset_texture); + if(isize(tinf->colors)) + glhr::vertices_texture_color(v, tinf->tvertices, tinf->colors, offset, offset_texture); + else + glhr::vertices_texture(v, tinf->tvertices, offset, offset_texture); ioffset = 0; } else { diff --git a/geometry.cpp b/geometry.cpp index d5b87c72..1ccfb1a8 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -90,6 +90,7 @@ struct escher_floorshape : floorshape { struct basic_textureinfo { int texture_id; vector tvertices; + vector colors; }; /** basic geometry parameters */ diff --git a/glhr.cpp b/glhr.cpp index 8f2af5b2..3b7cb92c 100644 --- a/glhr.cpp +++ b/glhr.cpp @@ -729,6 +729,29 @@ EX void vertices_texture(const vector& v, const vector& t, i #endif } +EX void vertices_texture_color(const vector& v, const vector& t, const vector& c, int vshift IS(0), int tshift IS(0)) { + #if CAP_VERTEXBUFFER + int q = min(isize(v)-vshift, isize(t)-tshift); + vector tv(q); + for(int i=0; i& v) { #if CAP_VERTEXBUFFER bindbuffer(v); @@ -835,6 +858,7 @@ EX void switch_to_text(const vector& v, const vector& t) { EX void be_nontextured() { current_display->next_shader_flags = 0; } EX void be_textured() { current_display->next_shader_flags = GF_TEXTURE; } +EX void be_color_textured() { current_display->next_shader_flags = GF_TEXTURE | GF_VARCOLOR; } EX }