Esempio n. 1
0
/*!
 * \brief where points are draw and point of view set.
 */
void FrameGL::paintGL()
{
    glPushMatrix();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // Se seleeciona el punto de vista desde donde se mira.
    //float ptoVista[3]={-50.f,-100.f,-1000.f};

    // Define una transformacion de vision.Punto de vista XYZ, centro de la
    // escena donde se mira XYZ y vector de direccion ascendente
    //gluLookAt(ptoVista[0],ptoVista[1],ptoVista[2],0.0,0.0,5000.0,0.0,-1.0,0.0);
    gluLookAt(-7*anglex, -7*angley-1000,-3000.0,    0.0,-1000.0,3000.0,   0.0,-1.0,0.0);

    glScalef(zoom, zoom, 1);

    //glRotatef(m_x,1.0f, 0.0f, 0.0f); // Rotacion X (ángulo, vector alrededor del que giras)
    //glRotatef(m_y,0.0f, 1.0f, 0.0f); // Rotacion Y

    drawAxis();
    drawCloud();
    //drawLines();//el de Raul Alves

    glPopMatrix();
}
Esempio n. 2
0
void display(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // „Ƕ„Ç£„É≥„Éâ„Ƕ„ÅÆËÉåÊôØ„Çí°ó„Çä„ŧ„Å∂„Å? & Èö†Èù¢Âá¶ÁêÅEÇíÂèØËÉΩ„Å´„Åô„Çã
    glEnable(GL_DEPTH_TEST);    // Èö†Èù¢Âá¶ÁêÅEñãÂß?
    glEnable(GL_NORMALIZE);
    glEnable(GL_LIGHTING);
    glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
    
    glPushMatrix();
    glTranslatef(0.0, 1.0, 0.0);
    polarview();    // „Éù„ÅE„É©„ɺ„Éì„É•„ɺ„Å∏„ÅÆ„Éì„É•„ɺ„ǧ„É≥„Ç∞§âÊèõ
    glPushMatrix();
    glLightfv(GL_LIGHT0, GL_POSITION, light0);
    glPopMatrix();
    
    shading(5);
    drawGround2D();
    
    shading(6);
    glDisable(GL_LIGHTING);
    drawGrass();
    glEnable(GL_LIGHTING);
    
    shading(5);
    drawPlant();
    
    if (rainFlag == GL_TRUE)
        drawRain();
    
    glDisable(GL_LIGHTING);
    
    glDisable(GL_DEPTH_TEST);
    
    drawCloud();
    
    if (thunderFlag == GL_TRUE && rainFlag == GL_TRUE) {
        if (lightningnum == 0 || lightningnum == 4)
            lightning();
        lightningnum++;
        if (lightningnum == 5) {
            lightningnum = 0;
            thunderFlag = GL_FALSE;
        }
        if (rand() % 10 == 4)
            fallFlag = GL_TRUE;
    }
    else thunderFlag = GL_FALSE;
    
    glPopMatrix();
    glutSwapBuffers();
}
Esempio n. 3
0
void testApp::draw() {
	if (hidden)
		ofBackground(0, 0, 0);
	else
		ofBackground(128, 128, 128);

	glPushMatrix();
	camera.place();
	glEnable(GL_DEPTH_TEST);

	ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2);

	if (!hidden)
		drawAxes(256); // major axes

	if (threePhase != NULL) {
		if(needsDecode)
			threePhase->decode();

		ofTranslate(-threePhase->getWidth() / 2, -threePhase->getHeight() / 2);

		if (!hidden) {
			ofxPoint3f min, max;
			getBounds(min, max);
			ofSetColor(255, 255, 255);
			boxOutline(min, max);
			min.z = panel.getValueF("filterMin");
			max.z = panel.getValueF("filterMax");
			min -= 4;
			max += 4;
			ofSetColor(0, 0, 255);
			boxOutline(min, max);
		}

		ofSetColor(255, 255, 255);
		int useCloud = panel.getValueI("style");
		if (useCloud == 0) {
			drawCloud();
		} else if (useCloud == 1) {
			drawMesh();
		}
	}

	glDisable(GL_DEPTH_TEST);

	camera.remove();

	if (!hidden) {
		ofSetColor(255, 255, 255);

		for(int i = 0; i < 3; i++) {
			if(needsUpdate[i]) {
				recent[i].update();
				needsUpdate[i] = false;
			}
			int resizeWidth = cameraWidth / 3;
			int resizeHeight = cameraHeight / 3;
			recent[i].draw(
				ofGetWidth() - resizeWidth, resizeHeight * i + i,
				resizeWidth, resizeHeight);
		}
	}

	glPopMatrix();
}