- removed "no texture binded with per points vertex texture modality" bug

This commit is contained in:
Guido Ranzuglia 2016-09-08 05:22:53 +02:00
parent 0e454e5c87
commit 16879ec6ca
2 changed files with 36 additions and 9 deletions

View File

@ -111,6 +111,7 @@ static void WedgeTexFromVertexTex(ComputeMeshType &m)
{
(*fi).WT(i).U() = (*fi).V(i)->T().U();
(*fi).WT(i).V() = (*fi).V(i)->T().V();
(*fi).WT(i).N() = 0;
}
}
}

View File

@ -1321,7 +1321,7 @@ namespace vcg
glDisable(GL_POLYGON_OFFSET_FILL);
}
if (dt.isPrimitiveActive(PR_POINTS))
drawPoints(dt._intatts[size_t(PR_POINTS)], dt._glopts);
drawPoints(dt._intatts[size_t(PR_POINTS)], dt._glopts,textid);
glPopMatrix();
glPopAttrib();
@ -1587,7 +1587,7 @@ namespace vcg
glEnd();
}
void drawPoints(const InternalRendAtts& req,GL_OPTIONS_DERIVED_TYPE* glopts) const
void drawPoints(const InternalRendAtts& req,GL_OPTIONS_DERIVED_TYPE* glopts, const std::vector<GLuint>& textureindex = std::vector<GLuint>()) const
{
if (_mesh.VN() == 0)
return;
@ -1597,7 +1597,7 @@ namespace vcg
bool isgloptsvalid = (glopts != NULL);
if (isgloptsvalid && glopts->_perpoint_noshading)
if ((isgloptsvalid && glopts->_perpoint_noshading) || (isgloptsvalid && glopts->_perpoint_dot_enabled))
glDisable(GL_LIGHTING);
else
if ((!isgloptsvalid) || req[INT_ATT_NAMES::ATT_VERTNORMAL])
@ -1618,15 +1618,22 @@ namespace vcg
if (req[INT_ATT_NAMES::ATT_VERTTEXTURE])
{
glEnable(GL_TEXTURE_2D);
if (textureindex.size() > 0)
glBindTexture(GL_TEXTURE_2D, textureindex[0]);
else
glBindTexture(GL_TEXTURE_2D, 0);
}
else
glDisable(GL_TEXTURE_2D);
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _bo[GLMeshAttributesInfo::ATT_VERTINDEX]->_bohandle);
if (glopts != NULL)
{
if (!glopts->_perpoint_dot_enabled)
glPointSize(glopts->_perpoint_pointsize);
if(glopts->_perpoint_pointsmooth_enabled)
if ((glopts->_perpoint_pointsmooth_enabled) || (glopts->_perpoint_dot_enabled))
glEnable(GL_POINT_SMOOTH);
else
glDisable(GL_POINT_SMOOTH);
@ -1650,11 +1657,30 @@ namespace vcg
pointsize = glopts->_perpoint_pointsize;
glPointSize(pointsize);
}
if (glopts->_perpoint_dot_enabled)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor(vcg::Color4b(vcg::Color4b::Black));
glDepthRange(0.0, 0.9999);
glDepthFunc(GL_LEQUAL);
glPointSize(glopts->_perpoint_pointsize + 0.5);
}
}
if (isBORenderingAvailable())
drawPointsBO(req);
else
drawPointsIM(req);
if ((glopts != NULL) && (glopts->_perpoint_dot_enabled))
{
glPointSize(glopts->_perpoint_pointsize - 1);
if (isBORenderingAvailable())
drawPointsBO(req);
else
drawPointsIM(req);
}
glPopAttrib();
}