Ejemplo n.º 1
0
const FTPoint& FTTextureGlyphImpl::RenderImpl(const FTPoint& pen,
                                              int renderMode)
{
    float dx, dy;

    glGetIntegerv(GL_TEXTURE_BINDING_2D, &activeTextureID);
    if(activeTextureID != glTextureID)
    {
        glBindTexture(GL_TEXTURE_2D, (GLuint)glTextureID);
        //activeTextureID = glTextureID;
    }

    dx = floor(pen.Xf() + corner.Xf());
    dy = floor(pen.Yf() + corner.Yf());

    ftglTexCoord2f(uv[0].Xf(), uv[0].Yf());
    ftglVertex2f(dx, dy);
    
    ftglTexCoord2f(uv[0].Xf(), uv[1].Yf());
    ftglVertex2f(dx, dy - destHeight);
    
    ftglTexCoord2f(uv[1].Xf(), uv[1].Yf());
    ftglVertex2f(dx + destWidth, dy - destHeight);
    
    ftglTexCoord2f(uv[1].Xf(), uv[0].Yf());
    ftglVertex2f(dx + destWidth, dy);
    
    return advance;
}
Ejemplo n.º 2
0
const FTPoint& FTTextureGlyphImpl::RenderImpl(const FTPoint& pen,
                                              int renderMode)
{
    float dx, dy;
	GLfloat colors[4];
	
    if(activeTextureID != glTextureID)
    {
        glBindTexture(GL_TEXTURE_2D, (GLuint)glTextureID);
        activeTextureID = glTextureID;
    }
	
    dx = floor(pen.Xf() + corner.Xf());
    dy = floor(pen.Yf() + corner.Yf());


	glGetFloatv(GL_CURRENT_COLOR, colors);
	
    ftglBegin(GL_QUADS);
	
    //ftglColor4f(colors[0], colors[1], colors[2], colors[3]);
	
	ftglTexCoord2f(uv[0].Xf(), uv[0].Yf());
	ftglVertex2f(dx, dy);
	
	ftglTexCoord2f(uv[0].Xf(), uv[1].Yf());
	ftglVertex2f(dx, dy - destHeight);
	
	ftglTexCoord2f(uv[1].Xf(), uv[1].Yf());
	ftglVertex2f(dx + destWidth, dy - destHeight);
	
	ftglTexCoord2f(uv[1].Xf(), uv[0].Yf());
	ftglVertex2f(dx + destWidth, dy);
	
    ftglEnd();
	
    return advance;
}
Ejemplo n.º 3
0
void FTOutlineGlyphImpl::RenderContours(const FTPoint& pen)
{
    for(unsigned int c = 0; c < vectoriser->ContourCount(); ++c)
    {
        const FTContour* contour = vectoriser->Contour(c);

        for(unsigned int i = 0; i < contour->PointCount(); ++i)
        {
            unsigned ii = (i+1 == contour->PointCount()) ? 0 : i+1;

            FTPoint point1 = FTPoint(contour->Point(i).X() + contour->Outset(i).X() * outset,
                                     contour->Point(i).Y() + contour->Outset(i).Y() * outset,
                                     0);
            FTPoint point2 = FTPoint(contour->Point(ii).X() + contour->Outset(ii).X() * outset,
                                     contour->Point(ii).Y() + contour->Outset(ii).Y() * outset,
                                     0);
            ftglVertex2f((point1.Xf() / 64.0f) + pen.Xf(), 
                         (point1.Yf() / 64.0f) + pen.Yf());
            ftglVertex2f((point2.Xf() / 64.0f) + pen.Xf(), 
                         (point2.Yf() / 64.0f) + pen.Yf());
        }
    }
}