Пример #1
0
void
QvisReflectWidget::paintEvent(QPaintEvent *e)
{
    // with qt4 we dont need a bg pixmap for flicker free
    QPainter paint(this);
    redrawScene(&paint);
}
void
QvisParallelCoordinatesWidget::paintEvent(QPaintEvent *e)
{
    bool clipByRegion = true;

    // Draw the scene into the backing pixmap.
    bool needsPaint = pixmapDirty;

    if (pixmap == NULL)
    {
        needsPaint = true;
        pixmap = new QPixmap(width(), height());
    }

    if (needsPaint)
    {
        QPainter pixpaint(pixmap);
        redrawScene(&pixpaint);
        clipByRegion = false;
        pixmapDirty = false;
    }

    // Blit the pixmap to the screen.
    QPainter paint(this);
    if (clipByRegion && !e->region().isEmpty())
        paint.setClipRegion(e->region());
    paint.drawPixmap(QPoint(0,0), *pixmap);
}
Пример #3
0
void changeResolution() {
    float res;
    cout << "Enter resolution between [0,1]: " << endl;
    cin >> res;
    
    
    resolution = res;
    redrawScene();
}
Пример #4
0
void Ether::advanceTime()
{
    timer->stop();
    for(std::vector<Field>::iterator it=fields.begin();it!=fields.end();it++)
    {
        (*it).computeOneIterationOfMotion(_timeDelay);
    }
    timer->start(_timeDelay);
    emit redrawScene();
}
Пример #5
0
/* OpenGL callbacks */
void redrawSchnauzer () {
	pScene sc = cv.scene[currentScene()];
	pMesh mesh;
	char *ptr, data[256];

	mesh = cv.mesh[sc->idmesh];
	strcpy(data, mesh->name);
	ptr = (char *)strstr(data, ".mesh");
	if (ptr) *ptr = '\0';

	ptr = (char *)strstr(data, ".gis");
	if (ptr) *ptr = '\0';

	strcat(data, ".ppm");
	redrawScene();
	imgHard(sc, data, 'H');

	exit(0);
}
Пример #6
0
/* OpenGL callbacks */
void redrawScene () {
	pScene sc;
	pTransform view;
	pPersp p;
	pCamera c;

	sc = cv.scene[currentScene()];
	view = sc->view;
	p = sc->persp;
	c = sc->camera;

	if (stereoMode == MONO || !hasStereo) {
		glDrawBuffer(GL_BACK_LEFT);
		glClearColor(sc->par.back[0], sc->par.back[1],
		             sc->par.back[2], sc->par.back[3]);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(0., 0., -p->depth, 0., 0., 0., 0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);
	} else {
		double ndfl, ratio, top, bottom;
		double left, right, nnear, ffar;

		nnear = -p->depth - 0.5 * sc->dmax;
		if (nnear < 0.1) nnear = 0.1;

		ffar = -p->depth + 0.5 * sc->dmax;
		ratio = sc->par.xs / (double)sc->par.ys;
		top = nnear * tan(DTOR * 0.5 * p->fovy);
		ndfl = nnear / p->depth;
		if (sc->par.eyesep < 0.0)
			sc->par.eyesep = fabs(p->depth / 20.0);

		/* left view */
		glDrawBuffer(GL_BACK_LEFT);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		left = -ratio * top + 0.5 * sc->par.eyesep * ndfl;
		right = ratio * top + 0.5 * sc->par.eyesep * ndfl;
		bottom = -top;

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glFrustum(left, right, top, bottom, nnear, ffar);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(-sc->par.eyesep, 0., -p->depth,
		          sc->par.eyesep / 3.0, 0., 0.,
		          0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);

		/* right view */
		glDrawBuffer(GL_BACK_RIGHT);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

		left = -ratio * top - 0.5 * sc->par.eyesep * ndfl;
		right = ratio * top - 0.5 * sc->par.eyesep * ndfl;

		glMatrixMode(GL_PROJECTION);
		glLoadIdentity();
		glFrustum(left, right, top, bottom, nnear, ffar);
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();
		gluLookAt(sc->par.eyesep, 0., -p->depth,
		          sc->par.eyesep / 3.0, 0., 0.,
		          0.0, 1.0, 0.0);

		setupView(sc);
		glMultMatrixf(view->matrix);
		glTranslatef(sc->cx, sc->cy, sc->cz);
		drawModel(sc);
		if (sc->type & S_DECO) redrawStatusBar(sc);
	}

	/* refresh screen */
	if (saveimg && animate)
		glFlush();
	else
		glutSwapBuffers();

	if (ddebug) checkErrors();

	if (saveimg && !(sc->type & S_SCISSOR)) keyFile('H', 0, 0);

	/* redraw linked scene */
	if (!animate && sc->slave > -1) {
		pScene slave;

		slave = cv.scene[sc->slave];
		glutSetWindow(slave->idwin);
		redrawScene();
	}
}