Пример #1
0
void drawThings()
{
    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,eyeDistance);
    arcball.applyRotationMatrix();

    glEnable(GL_TEXTURE_3D);
    glBindTexture(GL_TEXTURE_3D, texName);
    shader->begin();
    shader->setUniform1f("c",parabolaQuadraticTerm);
    GLUquadric *quad = gluNewQuadric();
    gluQuadricDrawStyle(quad,GLU_FILL);
    gluDisk(quad,0.0,0.5,100,100);
    gluDeleteQuadric(quad);
    /*
    Grid grid;
    grid.init(-0.5,0.5,-0.5,0.5);
    grid.setRowsAndCols(iWidth,iDepth);
    grid.draw(true);
*/
    shader->end();
    glDisable(GL_TEXTURE_3D);
    glPopMatrix();

    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,eyeDistance+0.5);
    arcball.applyRotationMatrix();
    glutWireCube(1);
    glPopMatrix();
    getGLerrors();
}
Пример #2
0
void drawThings()
{
    glDisable(GL_LIGHTING);
    double a = angle*M_PI/180.0;
    double L = 2.5;

    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,focalDistance);
    arcball.applyRotationMatrix();
    glBegin(GL_LINES);
    glVertex3d(-8,0,0);
    glVertex3d(8,0,0);
    glEnd();
    //glutWireSphere(1,20,20);
    glPopMatrix();

    /*
    glPushMatrix();
    glTranslated(0,0,-L/2);
    glRotated(angle/2,1,0,0);
    //glScaled(1,1.0/sin(0.5*a),1);
    stimDrawerPlanes[0].draw();
    glPopMatrix();
    */

    /*
    int n=0;
    double h = 1.0;
    double salfa = sin(a);
    double calfa = cos(a);
    glBegin(GL_POINTS);
    while (n<1000)
    {
        double x = mathcommon::unifRand(-L/2,L/2);
        double y = mathcommon::unifRand(-h/2,h/2);
        double z = mathcommon::unifRand(-L/2,L/2);
        if ( y<= z*salfa+1E-2 && y>= z*salfa-1E-2)
        {
            n++;
            glVertex3d(x,y,z);
        }
    }
    glEnd();
    */
    /*
    glPushMatrix();
    glRotated(-angle/2,1,0,0);
    glScaled(1,1/sin(angle*M_PI/180.0),1);
    stimDrawerPlanes[1].draw();
    glPopMatrix();
    */
    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,focalDistance);
    arcball.applyRotationMatrix();
    stimDrawer.draw();
    glPopMatrix();
}
Пример #3
0
void drawThings()
{
    glEnable(GL_TEXTURE_2D);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, _textureId);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,eyeZ);
    arcball.applyRotationMatrix();
    shader->begin();
    glScaled(1,1,5*sin(frame/50.0));
    //glutSolidTeapot(1);
    drawCylinder(1.0,0.0,-0.5,0.0,0.0,0.5,0.0,64,0);
    shader->end();
    glPopMatrix();

}
Пример #4
0
void drawScene()
{   
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);	// clear background to black
	glClearDepth(100.0);					// set depth buffer to the most distant value
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0,0,0,1);
	glShadeModel(GL_SMOOTH);
	
	glEnable(GL_DEPTH_TEST);
	//glEnable(GL_CULL_FACE);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslatef(0.0f, 0.0f, eyeZ+eyeDistance);
	arcball.applyRotationMatrix();
	glTranslatef(0,0,eyeShift);

	// Qua mettere tutte le funzioni di disegno
	glPushMatrix();
	glScalef(3,3,3);
	drawReference();
	glPopMatrix();
	drawGeneratedPlanes();
	//grid.draw();
	glRotated(90,1,0,0);
	glColor3fv(glGray50);
	grid.draw();
	//drawInfo();
	glutSwapBuffers();
}
Пример #5
0
void drawScene()
{   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    frame+=0.01;
    glTranslatef(0.0f, 0.0f, eyeZ+eyeDistance);
    arcball.applyRotationMatrix();

    drawThings();
    glutSwapBuffers();
}
Пример #6
0
void drawThings()
{
    glPushMatrix();

    glLoadIdentity();
    // This is a light that is attached to the teapot

    glDisable(GL_BLEND);
    glTranslated(0,0,-5);
    arcball.applyRotationMatrix();
    glRotated(5*frame,0,1,0);
    glutSolidTeapot(0.5);
    glPopMatrix();

    glPushMatrix();
    glLoadIdentity();
    glTranslated(3*cos(frame),2.0*sin(frame/10),eyeDistance+eyeZ);
    arcball.applyRotationMatrix();

    //glRotated(10*frame,0,1,0);
    glutWireSphere(0.8,10,20);
    glPopMatrix();
}
Пример #7
0
void drawGLScene() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glShadeModel(GL_SMOOTH);
    
    glEnable(GL_DEPTH_TEST);
    //glEnable(GL_CULL_FACE);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0.0f, 0.0f, eyeZ+eyeDistance);
    arcball.applyRotationMatrix();

    drawErnstBanks(stimulus_height);

    glutSwapBuffers();
}
Пример #8
0
void drawThings()
{
    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,eyeZ);
    arcball.applyRotationMatrix();

    shader->begin();
    shader->setUniform1f("time",frame);
    obj.draw(GL_FILL);
    //glutSolidTorus(0.5,1.0,50,50);
    //glutSolidTeapot(1);
    //drawCylinder(1,0,0,-0.5,0,0,0.5,64,0);
    shader->end();
    glPopMatrix();
    getGLerrors();

    // Draw the light
    glPushMatrix();
    arcball.applyRotationMatrix();
    glTranslated(lightPos[0],lightPos[1],lightPos[2]);
    glutWireSphere(1,10,10);
    glPopMatrix();
}
Пример #9
0
/**
 * @brief drawThings
 */
void drawThings()
{
    GLText text(width,height,glWhite);
    text.init(width,height,glWhite);
    text.enterTextInputMode();
    text.draw("C= "+util::stringify(surface.parabolaSurface.curvature));
    text.leaveTextInputMode();
    glPushMatrix();
    glLoadIdentity();
    glTranslated(0,0,eyeDistance);
    glScaled(10,10,10);
    arcball.applyRotationMatrix();
    surface.draw();
    glPopMatrix();
    getGLerrors();
}
/**
 * @brief drawScene
 */
void drawScene()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    glMatrixMode(GL_MODELVIEW);

    glLoadIdentity();
    glPushMatrix();
    glTranslated(0,0,-10+eyeZ);
	//glScaled(0.01,0.01,0.01);
    arcball.applyRotationMatrix();
    obj.draw(GL_POINT);
    glPopMatrix();

    glutSwapBuffers();
}
Пример #11
0
void drawErnstBanks(double height)
{
	glLoadIdentity();
	glTranslated(0.0,0,Z);
	arcball.applyRotationMatrix();

	// print top sector
	glPushMatrix();
	glTranslated(0, (150+height)/4.0, 0);
	draw_ernst_banks[0].draw();
	glPopMatrix();

	// print bottom sector
	glPushMatrix();
	glTranslated(0, -(150+height)/4.0, 0);
	draw_ernst_banks[1].draw();
	glPopMatrix();

	// print relief
	glPushMatrix();
	glTranslated(0, 0, 0);
	draw_ernst_banks[2].draw();
	glPopMatrix();
}