void OpenGLRender::blitLine(int pX1,
                            int pY1,
                            int pX2,
                            int pY2,
                            unsigned char pR,
                            unsigned char pG,
                            unsigned char pB,
                            unsigned char pA) {
	float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);
	//Fill the PIXEL structure
	fillPixel(&_pixels[0], static_cast<float>(pX1), static_cast<float>(pY1), r, g, b, a);
	fillPixel(&_pixels[1], static_cast<float>(pX2), static_cast<float>(pY2), r, g, b, a);

	//Render primitive - No textures
	setGLClientStateToPrimitive();

	// Color and transformation
	setForPrimitive(pA,true);

	//Line blitting
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_LINES, 0, 2);

	
#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in Line blitting ", DebugApi::LogHeaderError);
	}
#endif

    //Reenable texturing
	setGLClientStateToTexturing();
}
/*!
\b Parameters:

\arg \b pX, \b pY               Position in the screen
\arg \b pR, \b pG, \b pB        R, G, B components of the color
\arg \b pA                      Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a pixel into the screen. This is a really slow method when the number of pixels is
big.

This method is equivalent to use a combination of these methods:
- IND_Entity2d::setPrimitive2d()
- IND_Entity2d::setLine()
- IND_Entity2d::setTint()
- IND_Entity2d::setTransparency()
*/
void OpenGLRender::blitPixel(int pX,
                             int pY,
                             BYTE pR,
                             BYTE pG,
                             BYTE pB,
                             BYTE pA) {

    float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);
    // Fill the PIXEL structure
    fillPixel (&_pixels [0], static_cast<float>(pX), static_cast<float>(pY), r, g, b, a);

    //Render primitive - No textures
    glDisable(GL_TEXTURE_2D);

    // Color and transformation
    setForPrimitive (pA, true);

    // Pixel drawing
    glEnableClientState(GL_VERTEX_ARRAY);
    glEnableClientState(GL_COLOR_ARRAY);
    glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
    glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
    glDrawArrays(GL_POINTS, 0,1);


#ifdef _DEBUG
    GLenum glerror = glGetError();
    if (glerror) {
        g_debug->header("OpenGL error in pixel blitting ", 2);
    }
#endif

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
}
bool OpenGLRender::blitRegularPoly(int pX,
                                   int pY,
                                   int pRadius,
                                   int pN,
                                   float pAngle,
                                   BYTE pR,
                                   BYTE pG,
                                   BYTE pB,
                                   BYTE pA) {
	int x, y, i;
	float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);

	//LOOP - Fill pixels structure
	for (i = 0; i < pN; i++) {
		float c = i * 2 * static_cast<float>(PI / pN);
		x = static_cast<int>(pX + (pRadius * cos(c + _math.angleToRadians(pAngle))));
		y = static_cast<int>(pY + (pRadius * sin(c + _math.angleToRadians(pAngle))));

		fillPixel(&_pixels [i], static_cast<float>(x), static_cast<float>(y), r, g, b, a);
	}//LOOP END

	fillPixel(&_pixels [i], pX + (pRadius * cos(_math.angleToRadians(pAngle))), pY + (pRadius * sin(_math.angleToRadians(pAngle))), r, g, b, a);
	
	//Render primitive - No textures
	glDisable(GL_TEXTURE_2D);

	// Color and transformation
	setForPrimitive(pA,true);

	//Blitting
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	//Polygon blitting
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_LINE_STRIP, 0, pN+1);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in triangle list blitting ", 2);
	}
#endif
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

	return 1;
}
/*!
\b Parameters:

\arg \b pX, \b pY               Position in the screen
\arg \b pR, \b pG, \b pB        R, G, B components of the color
\arg \b pA                      Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a pixel into the screen. This is a really slow method when the number of pixels is
big.

This method is equivalent to use a combination of these methods:
- IND_Entity2d::setPrimitive2d()
- IND_Entity2d::setLine()
- IND_Entity2d::setTint()
- IND_Entity2d::setTransparency()
*/
void DirectXRender::blitPixel(int pX,
                              int pY,
                              BYTE pR,
                              BYTE pG,
                              BYTE pB,
                              BYTE pA) {

	// Fill the PIXEL structure
	fillPixel(&_pixels [0], pX, pY, pR, pG, pB);

	// Transformation
	setForPrimitive(pA);

	// Pixel drawing
	_info._device->DrawPrimitiveUP(D3DPT_POINTLIST, 1, &_pixels, sizeof(PIXEL));
}
void OpenGLRender::blitColoredTriangle(int pX1,
                                       int pY1,
                                       int pX2,
                                       int pY2,
                                       int pX3,
                                       int pY3,
                                       BYTE pR1, BYTE pG1, BYTE pB1,
                                       BYTE pR2, BYTE pG2, BYTE pB2,
                                       BYTE pR3, BYTE pG3, BYTE pB3,
                                       BYTE pA) {
	
    float r1(static_cast<float>(pR1) / 255.0f), g1(static_cast<float>(pG1) / 255.0f), b1(static_cast<float>(pB1) / 255.0f);
    float r2(static_cast<float>(pR2) / 255.0f), g2(static_cast<float>(pG2) / 255.0f), b2(static_cast<float>(pB2) / 255.0f);
    float r3(static_cast<float>(pR3) / 255.0f), g3(static_cast<float>(pG3) / 255.0f), b3(static_cast<float>(pB3) / 255.0f);
    float a(static_cast<float>(pA) / 255.0f);
	
    // Fill PIXEL structures
	fillPixel (&_pixels[0], static_cast<float>(pX1), static_cast<float>(pY1), r1, g1, b1, a);
	fillPixel (&_pixels[1], static_cast<float>(pX2), static_cast<float>(pY2), r2, g2, b2, a);
	fillPixel (&_pixels[2], static_cast<float>(pX3), static_cast<float>(pY3), r3, g3, b3, a);

	//Render primitive - No textures
	glDisable(GL_TEXTURE_2D);

	// Color and transformation
	setForPrimitive(pA,true);

	//Single Colored Triangle blitting
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_TRIANGLES, 0, 3);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in colored triangle blitting ", 2);
	}
#endif
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

}
/*!
\b Parameters:

\arg \b pX1, \b pY1             Origin point
\arg \b pX2, pY2                Destiny point
\arg \b pR, \b pG, \b pB        R, G, B components of the color
\arg \b pA                      Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a line into the screen

Using this method is equivalent to using all of these methods:
- IND_Entity2d::setPrimitive2d()
- IND_Entity2d::setLine()
- IND_Entity2d::setTint()
- IND_Entity2d::setTransparency()
*/
void DirectXRender::blitLine(int pX1,
                             int pY1,
                             int pX2,
                             int pY2,
                             BYTE pR,
                             BYTE pG,
                             BYTE pB,
                             BYTE pA) {
	// Fill the PIXEL structure
	fillPixel(&_pixels [0], pX1, pY1, pR, pG, pB);
	fillPixel(&_pixels [1], pX2, pY2, pR, pG, pB);

	// Transformation
	setForPrimitive(pA);

	// Line blitting
	_info._device->DrawPrimitiveUP(D3DPT_LINESTRIP, 1, &_pixels, sizeof(PIXEL));
}
bool OpenGLRender::blitPoly2d(IND_Point *pPolyPoints,
                              int pNumLines,
                              BYTE pR,
                              BYTE pG,
                              BYTE pB,
                              BYTE pA) {

	if (!pPolyPoints)   return 0;
	if (pNumLines < 1)  return 0;

    float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);

	// Fill PIXEL structures
    for (int i = 0; i < pNumLines + 1; i++){
	    fillPixel (&_pixels [i], static_cast<float>(pPolyPoints [i].x), static_cast<float>(pPolyPoints [i].y), r, g, b,a);
    }

	//Render primitive - No textures
	glDisable(GL_TEXTURE_2D);

	// Color and transformation
	setForPrimitive(pA,true);

	// Polygon blitting
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_LINE_STRIP, 0, pNumLines+1);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in triangle poly2d blitting ", 2);
	}
#endif
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

	return 1;
}
void OpenGLRender::blitTriangleList(IND_Point *pTrianglePoints,
                                    int pNumPoints,
                                    BYTE pR,
                                    BYTE pG,
                                    BYTE pB,
                                    BYTE pA) {

	//TODO: CHECK MAX POLYGONS PER CALL...
	if (pNumPoints < 3)
		return;

    float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);

	//LOOP - Fill pixels structure
	for (int i = 0; i < pNumPoints; i++) {
		fillPixel(&_pixels[i], static_cast<float>(pTrianglePoints[i].x), static_cast<float>(pTrianglePoints[i].y), r, g, b, a);
	}//LOOP END

	//Render primitive - No textures
	glDisable(GL_TEXTURE_2D);

	// Color and transformation
	setForPrimitive(pA,true);

	//Triangle strip blitting
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);

	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, pNumPoints);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in triangle list blitting ", 2);
	}
#endif
	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

}
void OpenGLRender::blitColoredTriangle(int pX1,
                                       int pY1,
                                       int pX2,
                                       int pY2,
                                       int pX3,
                                       int pY3,
                                       unsigned char pR1, unsigned char pG1, unsigned char pB1,
                                       unsigned char pR2, unsigned char pG2, unsigned char pB2,
                                       unsigned char pR3, unsigned char pG3, unsigned char pB3,
                                       unsigned char pA) {
	
    float r1(static_cast<float>(pR1) / 255.0f), g1(static_cast<float>(pG1) / 255.0f), b1(static_cast<float>(pB1) / 255.0f);
    float r2(static_cast<float>(pR2) / 255.0f), g2(static_cast<float>(pG2) / 255.0f), b2(static_cast<float>(pB2) / 255.0f);
    float r3(static_cast<float>(pR3) / 255.0f), g3(static_cast<float>(pG3) / 255.0f), b3(static_cast<float>(pB3) / 255.0f);
    float a(static_cast<float>(pA) / 255.0f);
	
    // Fill PIXEL structures
	fillPixel (&_pixels[0], static_cast<float>(pX1), static_cast<float>(pY1), r1, g1, b1, a);
	fillPixel (&_pixels[1], static_cast<float>(pX2), static_cast<float>(pY2), r2, g2, b2, a);
	fillPixel (&_pixels[2], static_cast<float>(pX3), static_cast<float>(pY3), r3, g3, b3, a);

	//Render primitive - No textures
	setGLClientStateToPrimitive();

	// Color and transformation
	setForPrimitive(pA,true);

	//Single Colored Triangle blitting
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_TRIANGLES, 0, 3);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in colored triangle blitting ", DebugApi::LogHeaderError);
	}
#endif

    //Reenable texturing
	setGLClientStateToTexturing();
}
void OpenGLRender::blitRectangle(int pX1,
                                 int pY1,
                                 int pX2,
                                 int pY2,
                                 BYTE pR,
                                 BYTE pG,
                                 BYTE pB,
                                 BYTE pA) {
	float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);
 	
	// Fill PIXEL structures
	fillPixel (&_pixels [0], static_cast<float>(pX1),static_cast<float>(pY1),      r, g, b,a);
	fillPixel (&_pixels [1], static_cast<float>(pX2), static_cast<float>(pY1),      r, g, b,a);
	fillPixel (&_pixels [2], static_cast<float>(pX2), static_cast<float>(pY2),      r, g, b,a);
	fillPixel (&_pixels [3], static_cast<float>(pX1), static_cast<float>(pY2),      r, g, b,a);
	fillPixel (&_pixels [4], static_cast<float>(pX1), static_cast<float>(pY1),      r, g, b,a);
	
	//Render primitive - No textures
	glDisable(GL_TEXTURE_2D);

	// Color and transformation
	setForPrimitive (pA,true);

	//rectangle blitting
	glEnableClientState(GL_VERTEX_ARRAY);
	glEnableClientState(GL_COLOR_ARRAY);
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_LINE_STRIP, 0, 5);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in rectangle blitting ", 2);
	}
#endif

	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_COLOR_ARRAY);

}
/*!
\b Parameters:

\arg \b pPixel                      Pointer to a points array ::IND_Point. Example: ::IND_Point mPoly3 [ ] = { {60, 10},  {20, 15},  {50, 90},  {170, 190} } => Sets 3 points (each one with x and y coordinates).
\arg \b pNumLines                   Number of edges to draw
\arg \b pR, \b pG, \b pB            R, G, B components of the color
\arg \b pA                          Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a 2d poly

Using this method is equivalent to using all of these methods:
- IND_Entity2d::setPrimitive2d()
- IND_Entity2d::setPolyPoints()
- IND_Entity2d::setNumSides()
- IND_Entity2d::setTint()
- IND_Entity2d::setTransparency()
*/
bool DirectXRender::blitPoly2d(IND_Point *pPolyPoints,
                               int pNumLines,
                               BYTE pR,
                               BYTE pG,
                               BYTE pB,
                               BYTE pA) {
	if (!pPolyPoints)   return 0;
	if (pNumLines < 1)  return 0;

	// Fill PIXEL structures
	for (int i = 0; i < pNumLines + 1; i++)
		fillPixel(&_pixels [i], pPolyPoints [i].x, pPolyPoints [i].y, pR, pG, pB);

	// Transformation
	setForPrimitive(pA);

	// Polygon blitting
	_info._device->DrawPrimitiveUP(D3DPT_LINESTRIP, pNumLines, &_pixels, sizeof(PIXEL));

	return 1;
}
/*!
\b Parameters:

\arg \b pTrianglePoints             Triangle Points allocated array
\arg \b pNumPoints                  Number of points passed (numtriangles =  pNumPoints - 2)
\arg \b pR, \b pG, \b pB            R, G, B components of the color in outer vertexs
\arg \b pA                          Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a complete triangle fan. The triangle fan is a set of triangles which
share a central vertex (http://msdn.microsoft.com/en-us/library/ee422512(VS.85).aspx)
The A parameter is transparency (255 = complety opaque).
*/
void DirectXRender::blitTriangleList(IND_Point *pTrianglePoints,
                                     int pNumPoints,
                                     BYTE pR,
                                     BYTE pG,
                                     BYTE pB,
                                     BYTE pA) {
	//TODO: CHECK MAX POLYGONS PER CALL...  mD3dcap.MaxPrimitiveCount
	if (pNumPoints < 3)
		return;

	//LOOP - Fill pixels structure
	for (int i = 0; i < pNumPoints; i++) {
		fillPixel(&_pixels[i], pTrianglePoints[i].x, pTrianglePoints[i].y, pR, pG, pB);
	}//LOOP END

	//Transformation
	setForPrimitive(pA);

	//Blitting
	_info._device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, pNumPoints - 2, &_pixels, sizeof(PIXEL));
}
bool OpenGLRender::blitPoly2d(IND_Point *pPolyPoints,
                              int pNumLines,
                              unsigned char pR,
                              unsigned char pG,
                              unsigned char pB,
                              unsigned char pA) {

	if (!pPolyPoints)   return 0;
	if (pNumLines < 1)  return 0;

    float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);

	// Fill PIXEL structures
    for (int i = 0; i < pNumLines + 1; i++){
	    fillPixel (&_pixels [i], static_cast<float>(pPolyPoints [i].x), static_cast<float>(pPolyPoints [i].y), r, g, b,a);
    }

	//Render primitive - No textures
	setGLClientStateToPrimitive();

	// Color and transformation
	setForPrimitive(pA,true);

	// Polygon blitting
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_LINE_STRIP, 0, pNumLines+1);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in triangle poly2d blitting ", DebugApi::LogHeaderError);
	}
#endif

    //Reenable texturing
	setGLClientStateToTexturing();
	return 1;
}
void OpenGLRender::blitTriangleList(IND_Point *pTrianglePoints,
                                    int pNumPoints,
                                    unsigned char pR,
                                    unsigned char pG,
                                    unsigned char pB,
                                    unsigned char pA) {

	//TODO: CHECK MAX POLYGONS PER CALL...
	if (pNumPoints < 3)
		return;

    float r(static_cast<float>(pR) / 255.0f), g(static_cast<float>(pG) / 255.0f), b(static_cast<float>(pB) / 255.0f), a(static_cast<float>(pA) / 255.0f);

	//LOOP - Fill pixels structure
	for (int i = 0; i < pNumPoints; i++) {
		fillPixel(&_pixels[i], static_cast<float>(pTrianglePoints[i].x), static_cast<float>(pTrianglePoints[i].y), r, g, b, a);
	}//LOOP END

	//Render primitive - No textures
	setGLClientStateToPrimitive();

	// Color and transformation
	setForPrimitive(pA,true);

	//Triangle strip blitting
	glVertexPointer(3, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._x);
	glColorPointer(4, GL_FLOAT, sizeof(PIXEL), &_pixels[0]._colorR);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, pNumPoints);

#ifdef _DEBUG
    GLenum glerror = glGetError();
	if (glerror) {
		g_debug->header("OpenGL error in triangle list blitting ", DebugApi::LogHeaderError);
	}
#endif

    //Reenable texturing
	setGLClientStateToTexturing();
}
/*!
\b Parameters:

\arg \b pX1, \b pY1                 Upper left corner of the rectangle
\arg \b pX2, \b pY2                 Lower right corner of the rectangle
\arg \b pR, \b pG, \b pB            R, G, B components of the color
\arg \b pA                          Level of transparency. (255 = completly opaque)

\b Operation:

This function draws a rectangle filled with a color into the screen. The A component is the
transparency level (255 = complety opaque).

Using this method is equivalent to using all of these methods:
- IND_Entity2d::setPrimitive2d()
- IND_Entity2d::setRectangle()
- IND_Entity2d::setTint()
- IND_Entity2d::setTransparency()
*/
void DirectXRender::blitFillRectangle(int pX1,
                                      int pY1,
                                      int pX2,
                                      int pY2,
                                      BYTE pR,
                                      BYTE pG,
                                      BYTE pB,
                                      BYTE pA) {
	// Fill PIXEL structures
	fillPixel(&_pixels [0], pX2, pY1,      pR, pG, pB);
	fillPixel(&_pixels [1], pX2, pY2,      pR, pG, pB);
	fillPixel(&_pixels [2], pX1, pY1,      pR, pG, pB);
	fillPixel(&_pixels [3], pX1, pY2,      pR, pG, pB);

	// Transformation
	//setTransform2d(0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);

	// Color transformation
	setForPrimitive(pA);

	// Rectangle blitting
	_info._device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, &_pixels, sizeof(PIXEL));
}
void DirectXRender::blitColoredTriangle(int pX1,
                                        int pY1,
                                        int pX2,
                                        int pY2,
                                        int pX3,
                                        int pY3,
                                        BYTE pR1, BYTE pG1, BYTE pB1,
                                        BYTE pR2, BYTE pG2, BYTE pB2,
                                        BYTE pR3, BYTE pG3, BYTE pB3,
                                        BYTE pA) {
	// Fill PIXEL structures
	fillPixel(&_pixels [0], pX1, pY1, pR1, pG1, pB1);
	fillPixel(&_pixels [1], pX2, pY2, pR2, pG2, pB2);
	fillPixel(&_pixels [2], pX3, pY3, pR3, pG3, pB3);

	// Transformation
	//setTransform2d(0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);

	// Color transformation
	setForPrimitive(pA);

	// Rectangle blitting
	_info._device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, &_pixels, sizeof(PIXEL));
}