void display(void)
{
    
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    
    
    glPushMatrix();

    //TRANSLATION - Move object on X or Y axis using mouse drag + CTRL key
    glTranslatef(_yposition, _xposition,0.0f);
    
    //ZOOM - Zoom in or zoom out using mouse drag + SHIFT key
    glScalef(0.5f+zoom_in,0.5f+zoom_in,0.5f+zoom_in);
    
    //ROTATION - Rotate image along X and Y plane using mouse drag
    glRotated(camera_angle_v, 1.0, 0.0, 0.0);
    glRotated(camera_angle_h, 0.0, 1.0, 0.0);
    
    v.x=0.0;v.y=0.0;v.z=-1.0;
    
    camera();
    displayBackground();
    displayColumns();
    displayRollerCoaster();
    displayRails();

    
    glPopMatrix();
    glutSwapBuffers();
}
Beispiel #2
0
void View::displayBase(void){
	try{
		// render buttons and paper
		displayPaper();
		displayBackground();
		displayButtons();
		displaySliders();
		displayCurrentColour();
		
		// reset colours
		glColor3f(1.0f, 1.0f, 1.0f);
	} catch(...){
		throw eFileNotFoundException();
	}
}
Beispiel #3
0
void MapView::mapResized(QSize size)
{
	displayBackground();
	displayMap();
}
void PaintView::draw()
{
	initSetup();

	if ( m_pDoc->m_ucPainting && !isAnEvent) 
	{
		RestoreContent(); // restore content upon refresh
	}

	if (m_pDoc->m_ucPainting && isAnEvent)
	{
		// Clear it after processing.
		isAnEvent = 0;

		Point source(coord.x + m_nStartCol, m_nEndRow - coord.y);
		Point target(coord.x, m_nWindowHeight - coord.y);
		// This is the event handler
		switch (eventToDo)
		{
		case LEFT_MOUSE_DOWN:
			m_pDoc->m_pUI->m_SizeRandButton->value(0);
			m_pDoc->m_pUI->setSizeRand(FALSE);
			savePreviousStrokes(); // save previous strokes before creating new strokes
			RestoreContent(); // put the strokes to colour buffer (no background)

			m_pDoc->m_pCurrentBrush->BrushBegin(source, target); // place the strokes to the colour buffer

			SaveCurrentContent(); // save the strokes to the buffer
			break;
		case LEFT_MOUSE_DRAG:
			RestoreContent();

			m_pDoc->m_pCurrentBrush->BrushMove(source, target);

			SaveCurrentContent();
			break;
		case LEFT_MOUSE_UP:
			RestoreContent();

			m_pDoc->m_pCurrentBrush->BrushEnd(source, target);
			
			SaveCurrentContent(); // save current strokes
			break;
		case RIGHT_MOUSE_DOWN:
			firstCoord = target;

			// Implement the right mouse stroke direction here
			rightClickDirectionLine = new RightClickDirectionLine(m_pDoc, "Right Click Direction Line");
			rightClickDirectionLine->BrushBegin(source, target);
			break;
		case RIGHT_MOUSE_DRAG:

			// We need to release the current content because 
			// each mouse drag refers to a different angle
			RestoreContent();

			rightClickDirectionLine->BrushMove(source, target);
			break;
		case RIGHT_MOUSE_UP:
			RestoreContent();

			rightClickDirectionLine->BrushEnd(source, target);
			angle = LineBrush::DetermineAngle(firstCoord, target);
			m_pDoc->setLineAngle(angle);
			delete rightClickDirectionLine;
			rightClickDirectionLine = NULL;

			break;
		default:
			printf("Unknown event!!\n");
			break;
		}
	}

	// put the background on top of the stroke
	// it sounds stupid, but if we want to do the other way,
	// we need to make everything rbga rather than rbg
	if (m_pDoc->m_ucPainting) {
		displayBackground(); 
	}

	glFlush();

	#ifndef MESA
		// To avoid flicker on some machines.
		glDrawBuffer(GL_BACK);
	#endif // !MESA

}