コード例 #1
0
ファイル: qcn_cube.cpp プロジェクト: happyj/qcn
void CCube::RenderText()
{   // this draws the necessary text for the cube view
    // draw text on top

    if (! bIsQCNLive) {
        char buf[256];
        // left of window informative text
        if (!qcn_graphics::g_bFullScreen)  { // don't show the button press text in fullscreen/screensaver mode
            mode_unshaded();
            qcn_graphics::mode_ortho_qcn();
            sprintf(buf, "Press 'Q' to return to");
            TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .32, 0, MSG_SIZE_NORMAL, yellow, TTF_ARIAL, buf);
            sprintf(buf, "seismic sensor view");
            TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .30, 0, MSG_SIZE_NORMAL, yellow, TTF_ARIAL, buf);
            ortho_done();
        }

        // print a "legend"
        mode_unshaded();
        qcn_graphics::mode_ortho_qcn();
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .27, 0, MSG_SIZE_NORMAL, red, TTF_ARIAL, "Red is Significance");
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .25, 0, MSG_SIZE_NORMAL, blue, TTF_ARIAL, "Blue is Z-axis");
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .23, 0, MSG_SIZE_NORMAL, yellow, TTF_ARIAL, "Yellow is Y-axis");
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .21, 0, MSG_SIZE_NORMAL, green, TTF_ARIAL, "Green is X-axis");
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .19, 0, MSG_SIZE_NORMAL, cyan, TTF_ARIAL, "Cyan is Magnitude");
        TTFont::ttf_render_string(qcn_graphics::cfTextAlpha, 0, .17, 0, MSG_SIZE_NORMAL, magenta, TTF_ARIAL, "Magenta is Variance");
        ortho_done();
    }
    // NB: draw_text_user called automatically from qcn_graphics to show BOINC username, CPU time etc
}
コード例 #2
0
ファイル: gutil.cpp プロジェクト: AltroCoin/altrocoin
// draw the starfield,
// move stars
//
void STARFIELD::update_stars(float dt) {
    int i;

    mode_ortho();
    mode_lines();
	glColor4f(1.0, 1.0, 1.0, 1.0);
	for (i=0; i<nstars; i++) {
		stars[i].z -= speed*dt/500;
        if (stars[i].z < 0) stars[i].z += zmax;
        if (stars[i].z > zmax) stars[i].z -= zmax;

        double x = stars[i].x/stars[i].z;
        double y = stars[i].y/stars[i].z;
        x = (x*zmax+1)/2;
        y = (y*zmax+1)/2;

        if (stars[i].z > zmax/2) glPointSize(1);
        else glPointSize(2);
		glBegin(GL_POINTS);
		glVertex2f((GLfloat)x, (GLfloat)y);
		glEnd();
	}
    ortho_done();
}