本文整理汇总了C++中FTFont::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ FTFont::Render方法的具体用法?C++ FTFont::Render怎么用?C++ FTFont::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FTFont
的用法示例。
在下文中一共展示了FTFont::Render方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPrimitives
Action::ResultE FTGLText::drawPrimitives(DrawActionBase *action )
{
FTGLFontPtr font = getFont();
if(font == NullFC)
{
FWARNING(("FTGLText::drawPrimitives: no font set!\n"));
return Action::Continue;
}
action->getWindow()->validateGLObject(font->getGLId());
FTFont *ftf = font->_fonts[action->getWindow()];
if(ftf == NULL)
{
FWARNING(("FTGLText::drawPrimitives: invalid font set!\n"));
return Action::Continue;
}
switch(font->getDrawType())
{
case FTGLFont::Texture:
case FTGLFont::Polygon:
case FTGLFont::Extrude:
case FTGLFont::Outline: glPushMatrix();
glTranslatef(getPosition()[0],
getPosition()[1],
getPosition()[2]);
glNormal3f(0,0,1);
break;
case FTGLFont::Pixmap:
case FTGLFont::Bitmap: glRasterPos3f(getPosition()[0],
getPosition()[1],
getPosition()[2]);
break;
}
ftf->Render(getText().c_str());
switch(font->getDrawType())
{
case FTGLFont::Texture:
case FTGLFont::Polygon:
case FTGLFont::Extrude:
case FTGLFont::Outline: glPopMatrix();
break;
case FTGLFont::Pixmap:
case FTGLFont::Bitmap: break;
}
return Action::Continue;
}
示例2: renderGlyphs
void OglRenderer::renderGlyphs(double x, double y, colorObj *color,
colorObj *outlinecolor, double size, const char* font, char *thechars, double angle,
colorObj *shadowcolor, double shdx, double shdy)
{
makeCurrent();
FTFont* face = getFTFont(font, size);
if (!face) {
msSetError(MS_OGLERR, "Failed to load font (%s).", "OglRenderer::renderGlyphs()", font);
return;
}
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
glTranslated(floor(x), floor(y), 0);
glScaled(1.0, -1.0, 1);
glRotated(angle * (180 / OGL_PI), 0, 0, 1);
if (outlinecolor && MS_VALID_COLOR(*outlinecolor)) {
setColor(outlinecolor);
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (i || j) {
glPushMatrix();
glTranslated(i, j, 0);
face->Render(thechars);
glPopMatrix();
}
}
}
}
if (color != NULL && MS_VALID_COLOR(*color)) {
setColor(color);
face->Render(thechars);
}
glPopMatrix();
glPopAttrib();
}
示例3: SetSize
void
moFont::Draw( MOfloat x, MOfloat y, moText& text, moFontSize p_fontsize, MOint set, MOfloat sx, MOfloat sy, MOfloat rt ) {
FTFont* FF = (FTFont*) m_pFace;
if (FF) {
SetSize(p_fontsize);
FF->Render( text, text.Length(), FTPoint(x,y) );
}
else {
if (m_FontGLId>=0) {
this->glPrint( (int)x, (int)y, text, set, sx, sy, rt );
}
}
}
示例4: draw
static void draw(const k3d::mesh& Mesh, const k3d::typed_array<k3d::point3>& Points, const k3d::color& Color, FunctorT PointTest, FTFont& Font)
{
k3d::gl::color3d(Color);
const size_t point_begin = 0;
const size_t point_end = point_begin + Points.size();
for(size_t point = point_begin; point != point_end; ++point)
{
if(PointTest(*Mesh.point_selection, point))
{
const k3d::point3 position = Points[point];
glRasterPos3d(position[0], position[1], position[2]);
Font.Render(k3d::string_cast(point).c_str());
}
}
}
示例5: Draw
void Writter::Draw(string iname, string str, float x, float y, float mangle){
FTFont* nfont = m_font_list[iname];
if (nfont != NULL){
glPushMatrix();
glTranslatef(x, -y - nfont->LineHeight(), 0);
glRotatef(mangle, 0.0, 0.0, 1);
nfont->Render(str.c_str());
glPopMatrix();
}else{
fprintf(stderr, "Failed to draw using name '%s': %s\n", iname.c_str(), str.c_str());
}
}
示例6: draw_text
int draw_text(int corner_x, int corner_y, int size, string text, int color){
if((size > 4 || size < 1) && size < 10 ){
cerr << "FutureGL Error: FutureGL only supports 4 core font sizes\nPlease adapt your code. Sorry.\n";
return -1;
}
colors(1, color);
glTranslated(corner_x, corner_y, 0);
// Create a texture font from a TrueType file.
FTFont *font;
bool font_loaded = false;
for(int i = 0; i < num_fonts; i++){
font = new FTTextureFont(fonts[i].c_str());
if(!(font->Error())){
font_loaded = true;
break;
}
}
if(!font_loaded){
cerr << "FutureGL Error: Font not found\nTried:\n";
for(int i = 0; i < num_fonts; i++) cerr << "\t" << fonts[i] << "\n";
return -1;
}
// Set the font size and render a small text.
if(size == 1) font->FaceSize(60);
else if(size == 2) font->FaceSize(29);
else if(size == 3) font->FaceSize(10);
else if(size == 4) font->FaceSize(10);
else font->FaceSize(size);
font->Render(text.c_str());
delete(font);
glTranslated(-corner_x, -corner_y, 0);
return 0;
}
示例7: coreRendering
void RenderThread::coreRendering(FTFont& font, bool testMode)
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDrawBuffer(GL_BACK);
//Clear the back buffer
RGB bg=sys->getBackground();
glClearColor(bg.Red/255.0F,bg.Green/255.0F,bg.Blue/255.0F,1);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
m_sys->Render(false);
assert(maskStack.empty());
if(testMode && m_sys->showDebug)
{
glLoadIdentity();
glScalef(1.0f/scaleX,-1.0f/scaleY,1);
glTranslatef(-offsetX,(offsetY+windowHeight)*(-1.0f),0);
glUseProgram(0);
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glDisable(GL_TEXTURE_2D);
if(selectedDebug)
selectedDebug->debugRender(&font, true);
else
m_sys->debugRender(&font, true);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glUseProgram(gpu_program);
}
if(m_sys->showProfilingData)
{
glLoadIdentity();
glScalef(1.0f/scaleX,-1.0f/scaleY,1);
glTranslatef(-offsetX,(offsetY+windowHeight)*(-1.0f),0);
glUseProgram(0);
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glDisable(GL_TEXTURE_2D);
glColor3f(0,0,0);
char frameBuf[20];
snprintf(frameBuf,20,"Frame %u",m_sys->state.FP);
font.Render(frameBuf,-1,FTPoint(0,0));
//Draw bars
glColor4f(0.7,0.7,0.7,0.7);
glBegin(GL_LINES);
for(int i=1;i<10;i++)
{
glVertex2i(0,(i*windowHeight/10));
glVertex2i(windowWidth,(i*windowHeight/10));
}
glEnd();
list<ThreadProfile>::iterator it=m_sys->profilingData.begin();
for(;it!=m_sys->profilingData.end();it++)
it->plot(1000000/m_sys->getFrameRate(),&font);
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
glUseProgram(gpu_program);
}
}
示例8: output
void output(vsx_module_param_abs* param)
{
VSX_UNUSED(param);
if (text_in->updates)
{
if (process_lines())
text_in->updates = 0;
}
if (text_alpha->get() <= 0)
return;
if (!ftfont)
{
user_message = "module||error loading font "+cur_font;
return;
}
if (text_in->get() == "_")
return;
float obj_size = size->get();
gl_state->matrix_mode (VSX_GL_MODELVIEW_MATRIX );
gl_state->matrix_push();
gl_state->matrix_rotate_f( (float)angle->get()*360, rotation_axis->get(0), rotation_axis->get(1), rotation_axis->get(2) );
if (obj_size < 0)
obj_size = 0;
gl_state->matrix_scale_f( obj_size*0.8*0.01, obj_size*0.01, obj_size*0.01 );
int l_align = align->get();
float l_leading = leading->get();
float ypos = 0;
if (cur_render_type == 0)
glEnable(GL_TEXTURE_2D);
glColor4f(red->get(),green->get(),blue->get(),text_alpha->get());
for (unsigned long i = 0; i < lines.size(); ++i)
{
float ll = limit_line->get();
if (ll != -1.0f)
{
if (trunc(ll) != i) continue;
}
gl_state->matrix_push();
if (l_align == 0)
{
gl_state->matrix_translate_f( 0, ypos, 0 );
} else
if (l_align == 1)
{
gl_state->matrix_translate_f( -lines[i].size_x*0.5f,ypos,0 );
}
if (l_align == 2)
{
gl_state->matrix_translate_f( -lines[i].size_x,ypos,0 );
}
if (cur_render_type == 1)
{
if (outline_alpha->get() > 0.0f && ftfont2) {
float pre_linew;
pre_linew = gl_state->line_width_get();
gl_state->line_width_set( outline_thickness->get() );
glColor4f(outline_color->get(0),outline_color->get(1),outline_color->get(2),outline_alpha->get()*outline_color->get(3));
ftfont2->Render(lines[i].string.c_str());
gl_state->line_width_set( pre_linew );
}
glColor4f(red->get(),green->get(),blue->get(),text_alpha->get());
}
ftfont->Render(lines[i].string.c_str());
gl_state->matrix_pop();
ypos += l_leading;
}
if (cur_render_type == 0)
glDisable(GL_TEXTURE_2D);
gl_state->matrix_pop();
render_result->set(1);
loading_done = true;
}
示例9: draw
void draw ( const std::string & str ) {
glEnable(GL_TEXTURE_2D);
m_font->Render( str.c_str() );
glDisable(GL_TEXTURE_2D);
}