- 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).U() = (*fi).V(i)->T().U();
(*fi).WT(i).V() = (*fi).V(i)->T().V(); (*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); glDisable(GL_POLYGON_OFFSET_FILL);
} }
if (dt.isPrimitiveActive(PR_POINTS)) 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(); glPopMatrix();
glPopAttrib(); glPopAttrib();
@ -1587,7 +1587,7 @@ namespace vcg
glEnd(); 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) if (_mesh.VN() == 0)
return; return;
@ -1597,7 +1597,7 @@ namespace vcg
bool isgloptsvalid = (glopts != NULL); bool isgloptsvalid = (glopts != NULL);
if (isgloptsvalid && glopts->_perpoint_noshading) if ((isgloptsvalid && glopts->_perpoint_noshading) || (isgloptsvalid && glopts->_perpoint_dot_enabled))
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
else else
if ((!isgloptsvalid) || req[INT_ATT_NAMES::ATT_VERTNORMAL]) if ((!isgloptsvalid) || req[INT_ATT_NAMES::ATT_VERTNORMAL])
@ -1618,15 +1618,22 @@ namespace vcg
if (req[INT_ATT_NAMES::ATT_VERTTEXTURE]) if (req[INT_ATT_NAMES::ATT_VERTTEXTURE])
{
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
if (textureindex.size() > 0)
glBindTexture(GL_TEXTURE_2D, textureindex[0]);
else
glBindTexture(GL_TEXTURE_2D, 0);
}
else else
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _bo[GLMeshAttributesInfo::ATT_VERTINDEX]->_bohandle); //glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _bo[GLMeshAttributesInfo::ATT_VERTINDEX]->_bohandle);
if (glopts != NULL) if (glopts != NULL)
{ {
if (!glopts->_perpoint_dot_enabled)
glPointSize(glopts->_perpoint_pointsize); glPointSize(glopts->_perpoint_pointsize);
if(glopts->_perpoint_pointsmooth_enabled) if ((glopts->_perpoint_pointsmooth_enabled) || (glopts->_perpoint_dot_enabled))
glEnable(GL_POINT_SMOOTH); glEnable(GL_POINT_SMOOTH);
else else
glDisable(GL_POINT_SMOOTH); glDisable(GL_POINT_SMOOTH);
@ -1650,11 +1657,30 @@ namespace vcg
pointsize = glopts->_perpoint_pointsize; pointsize = glopts->_perpoint_pointsize;
glPointSize(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()) if (isBORenderingAvailable())
drawPointsBO(req); drawPointsBO(req);
else else
drawPointsIM(req); drawPointsIM(req);
if ((glopts != NULL) && (glopts->_perpoint_dot_enabled))
{
glPointSize(glopts->_perpoint_pointsize - 1);
if (isBORenderingAvailable())
drawPointsBO(req);
else
drawPointsIM(req);
}
glPopAttrib(); glPopAttrib();
} }