当前位置: 首页>>代码示例>>C++>>正文


C++ GLText::setFontScale方法代码示例

本文整理汇总了C++中GLText::setFontScale方法的典型用法代码示例。如果您正苦于以下问题:C++ GLText::setFontScale方法的具体用法?C++ GLText::setFontScale怎么用?C++ GLText::setFontScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLText的用法示例。


在下文中一共展示了GLText::setFontScale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: draw

void RamachandranPlot::draw(void)
{
    ProteinState *state = curProtein();
    if ( !state ) return;
	 
	 GLText text;
    if(!valid())
    {
        /* Set the viewport: */
        glViewport(0,0,w(),h());
        
        /* Set the projection and modelview matrices: */
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        float factor=1.0/Math::Constants<double>::pi;
        glScale(factor,factor,factor);
        glDisable(GL_DEPTH_TEST);
    }
    
    /* Clear window: */
    glClearColor(backgroundColor);
    glClear(GL_COLOR_BUFFER_BIT);
    
    /* Draw ramachandran texture background: */
    glEnable(GL_TEXTURE_2D);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_BASE_LEVEL,0);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_LEVEL,0);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
    glPixelStorei(GL_UNPACK_ALIGNMENT,1);
    glPixelStorei(GL_UNPACK_SKIP_PIXELS,0);
    glPixelStorei(GL_UNPACK_ROW_LENGTH,0);
    glPixelStorei(GL_UNPACK_SKIP_ROWS,0);
    glPixelStorei(GL_UNPACK_IMAGE_HEIGHT,0);
    glPixelStorei(GL_UNPACK_SKIP_IMAGES,0);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,ramachandranTextureHeight,ramachandranTextureWidth,0,GL_RGB,GL_UNSIGNED_BYTE,ramachandranTexture);
    glColor3f(1.0f,0.0f,1.0f);
    glBegin(GL_QUADS);
    glTexCoord2f(0.0f,0.0f);
    glVertex2f(-Math::Constants<float>::pi,-Math::Constants<float>::pi);
    glTexCoord2f(1.0f,0.0f);
    glVertex2f(Math::Constants<float>::pi,-Math::Constants<float>::pi);
    glTexCoord2f(1.0f,1.0f);
    glVertex2f(Math::Constants<float>::pi,Math::Constants<float>::pi);
    glTexCoord2f(0.0f,1.0f);
    glVertex2f(-Math::Constants<float>::pi,Math::Constants<float>::pi);
    glEnd();
    glDisable(GL_TEXTURE_2D);
    
    /* Draw coordinate axes: */
    glColor3f(1.0f-backgroundColor[0],1.0f-backgroundColor[1],1.0f-backgroundColor[2]);
    glBegin(GL_LINES);
    glVertex2f(0.0f,-4.0f);
    glVertex2f(0.0f,4.0f);
    glVertex2f(-4.0f,0.0f);
    glVertex2f(4.0f,0.0f);
    glEnd();

	/* Draw axes data range */
	text.setFontColor(0.0, 0.0, 0.0);
	/* h, v */
	/*	+  */
	/*-   +*/
	/*	-  */	
	text.drawFreeString("pi",2.3f,-2.7f);
	text.drawFreeString("-pi",-2.8f,-2.7f);
	text.drawFreeString("pi",-3.0f,2.6f);
	text.drawFreeString("0",-3.0f,-0.3f);
	text.drawFreeString("0",-0.3f,-2.7f);
	text.drawFreeString("Phi",0.15f,2.5f);
	text.drawFreeString("Psi",2.5f,0.15f);

	/* Draw axes label */
	text.setFontScale(0.003, 0.003);
	text.setFontColor(0.0, 0.0, 1.0);
    
    if(structureValid)
    {
        /* Visualize dihedral angles inside a selected structure: */
        glPointSize(3.0f);
        glBegin(GL_POINTS);
        glColor(selectedStructureColor);
        for(int i=0;i<numStructureResidues;++i)
            glVertex(structurePhis[i],structurePsis[i]);
        glEnd();
    }
    
    /* Visualize dihedral angles inside all active coil regions: */
    if(activeCoilsValid)
    {
        /* Visualize dihedral angles inside all active coil regions: */
        glPointSize(3.0f);
        glBegin(GL_POINTS);
        glColor(activeCoilRegionColor);
        for(int i=0;i<numActiveCoilsResidues;++i)
//.........这里部分代码省略.........
开发者ID:exratione,项目名称:protein-shop-vagrant,代码行数:101,代码来源:RamachandranPlot.cpp


注:本文中的GLText::setFontScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。