int main()
{
    Line l;
    Circle c, c1, c2;

    myDraw(l);            // myDraw(GeoObj&) => Line::draw()
    myDraw(c);            // myDraw(GeoObj&) => Circle::draw()

    distance(c1,c2);      // distance(GeoObj&,GeoObj&)
    distance(l,c);        // distance(GeoObj&,GeoObj&)

    std::vector<GeoObj*> coll;  // heterogeneous collection
    coll.push_back(&l);         // insert line
    coll.push_back(&c);         // insert circle
    drawElems(coll);            // draw different kinds of GeoObjs
}
Exemple #2
0
void __stdcall MySwapBuff(){
	__asm{
		push ecx
	}
	myDraw();
	__asm{
		pop ecx
		call pSwapBuff
	}
}
Exemple #3
0
void SkGLDevice::drawPosText(const SkDraw& draw, const void* text,
                             size_t byteLength, const SkScalar pos[],
                             SkScalar constY, int scalarsPerPos,
                             const SkPaint& paint) {
    if (draw.fMatrix->getType() & SkMatrix::kPerspective_Mask) {
        return;
    }
    
    SkDraw myDraw(draw);
    this->setupForText(&myDraw, paint);
    this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
                                 scalarsPerPos, paint);
    fDrawProcs->flush();
    glPopMatrix();  // GL_MODELVIEW
}
Exemple #4
0
void SkGLDevice::drawText(const SkDraw& draw, const void* text,
                          size_t byteLength, SkScalar x, SkScalar y,
                          const SkPaint& paint) {
    /*  Currently, perspective text is draw via paths, invoked directly by
     SkDraw. This can't work for us, since the bitmap that our draw points
     to has no pixels, so we just abort if we're in perspective.
     
     Better fix would be to...
     - have a callback inside draw to handle path drawing
     - option to have draw call the font cache, which we could patch (?)
     */
    if (draw.fMatrix->getType() & SkMatrix::kPerspective_Mask) {
        return;
    }
    
    SkDraw myDraw(draw);
    this->setupForText(&myDraw, paint);
    this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
    fDrawProcs->flush();
    glPopMatrix();  // GL_MODELVIEW
}
Exemple #5
0
/**
 * Clear the screen, then render the mesh using the given camera.
 * @param camera The logical camera to use.
 * @see scene/camera.hpp
 */
void GeometryProject::render( const Camera* camera )
{

	Vector3 vPos, vAt, vCen, vUp;
	float ambient[] = { 0.0215,  0.1745,   0.0215,  1.0};
	float diffuse[] = { 0.07568, 0.61424,  0.07568, 1.0};
	float specular[] = {  0.633,   0.727811, 0.633,   1.0};
	float shininess[] = {76.8};

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glMatrixMode( GL_PROJECTION ); // set current matrix 
	glLoadIdentity(); // Clears the matrix 

	//set perspective and camera
	gluPerspective(camera->get_fov_degrees(),camera->get_aspect_ratio(),camera->get_near_clip(),camera->get_far_clip());
	vPos = camera->get_position();
	vAt = camera->get_direction();
	vCen = vPos + vAt;
	vUp = camera->get_up();
	gluLookAt(vPos.x, vPos.y, vPos.z, vCen.x, vCen.y, vCen.z, vUp.x, vUp.y,  vUp.z);

    glMatrixMode(GL_MODELVIEW);
   	glLoadIdentity();
	glPushMatrix();
	if(!hasTexture){
		glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, ambient);
		glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
		glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
	}
	myDraw();
	glPopMatrix();


  	
}
Exemple #6
0
	void DrawingBasics::drawIt(drawtype type) {//DrawingBasics::drawtype
		if (okToDraw(type)) {
			applyColor();
			myDraw();
		}
	};