void FTPolygonGlyphImpl::DoRender() { GLfloat colors[4]; const FTMesh *mesh = vectoriser->GetMesh(); for(unsigned int t = 0; t < mesh->TesselationCount(); ++t) { const FTTesselation* subMesh = mesh->Tesselation(t); unsigned int polygonType = subMesh->PolygonType(); glGetFloatv(GL_CURRENT_COLOR, colors); glBindTexture(GL_TEXTURE_2D, 0); ftglBegin(polygonType); ftglColor4f(colors[0], colors[1], colors[2], colors[3]); for(unsigned int i = 0; i < subMesh->PointCount(); ++i) { FTPoint point = subMesh->Point(i); ftglTexCoord2f(point.Xf() / hscale, point.Yf() / vscale); ftglVertex3f(point.Xf() / 64.0f, point.Yf() / 64.0f, 0.0f); } ftglEnd(); } }
void FTExtrudeGlyphImpl::RenderBack() { vectoriser->MakeMesh(-1.0, 2, backOutset); glNormal3f(0.0, 0.0, -1.0); GLfloat colors[4]; const FTMesh *mesh = vectoriser->GetMesh(); for(unsigned int j = 0; j < mesh->TesselationCount(); ++j) { const FTTesselation* subMesh = mesh->Tesselation(j); unsigned int polygonType = subMesh->PolygonType(); glGetFloatv(GL_CURRENT_COLOR, colors); glBindTexture(GL_TEXTURE_2D, 0); ftglBegin(polygonType); ftglColor4f(colors[0], colors[1], colors[2], colors[3]); for(unsigned int i = 0; i < subMesh->PointCount(); ++i) { FTPoint pt = subMesh->Point(i); ftglTexCoord2f(subMesh->Point(i).Xf() / hscale, subMesh->Point(i).Yf() / vscale); ftglVertex3f(subMesh->Point(i).Xf() / 64.0f, subMesh->Point(i).Yf() / 64.0f, -depth); } ftglEnd(); } }
void FTExtrudeGlyphImpl::RenderSide() { int contourFlag = vectoriser->ContourFlag(); //LOG_INFO("RenderSide %d", contourFlag); GLfloat colors[4]; for(size_t c = 0; c < vectoriser->ContourCount(); ++c) { const FTContour* contour = vectoriser->Contour(c); size_t n = contour->PointCount(); if(n < 2) { continue; } glGetFloatv(GL_CURRENT_COLOR, colors); ftglBegin(GL_QUADS); ftglColor4f(colors[0]/2, colors[1]/2, colors[2]/2, colors[3]/2); for(size_t j = 0; j < n; j++ ) { size_t cur = j % n; size_t next = (j + 1) % n; FTPoint frontPt = contour->FrontPoint(cur); FTPoint frontPt1 = contour->FrontPoint(next); FTPoint backPt = contour->BackPoint(cur); FTPoint backPt1 = contour->BackPoint(next); FTPoint normal = FTPoint(0.f, 0.f, 1.f) ^ (frontPt - frontPt1); if(normal != FTPoint(0.0f, 0.0f, 0.0f)) { const FTGL_DOUBLE* pD = static_cast<const FTGL_DOUBLE*>(normal.Normalise()); glNormal3f( pD[0], pD[1], pD[2]); } ftglTexCoord2f(frontPt.Xf() / hscale, frontPt.Yf() / vscale); if(contourFlag & ft_outline_reverse_fill) { ftglVertex3f(backPt.Xf() / 64.0f, backPt.Yf() / 64.0f, 0.0f); ftglVertex3f(frontPt.Xf() / 64.0f, frontPt.Yf() / 64.0f, -depth); ftglVertex3f(frontPt1.Xf() / 64.0f, frontPt1.Yf() / 64.0f, -depth); ftglVertex3f(backPt1.Xf() / 64.0f, backPt1.Yf() / 64.0f, 0.0f); } else { ftglVertex3f(backPt.Xf() / 64.0f, backPt.Yf() / 64.0f, -depth); ftglVertex3f(frontPt.Xf() / 64.0f, frontPt.Yf() / 64.0f, 0.0f); ftglVertex3f(frontPt1.Xf() / 64.0f, frontPt1.Yf() / 64.0f, 0.f); ftglVertex3f(backPt1.Xf() / 64.0f, backPt1.Yf() / 64.0f, -depth); } } ftglEnd(); } }
void FTPolygonGlyphImpl::DoRender(const FTPoint& pen) { const FTMesh *mesh = vectoriser->GetMesh(); for (unsigned int t = 0; t < mesh->TesselationCount(); ++t) { const FTTesselation* subMesh = mesh->Tesselation(t); unsigned int polygonType = subMesh->PolygonType(); ftglBindTexture(0); ftglBegin(polygonType); for(unsigned int i = 0; i < subMesh->PointCount(); ++i) { FTPoint point = subMesh->Point(i); ftglColor4f(1.0f, 1.0f, 1.0f, 1.0f); ftglTexCoord2f(point.Xf() / hscale, point.Yf() / vscale); ftglVertex3f(pen.Xf() + point.Xf() / 64.0f, pen.Yf() + point.Yf() / 64.0f, 0.0f); } ftglEnd(); } }