/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/drivers/common/opengl/ogldrawsurface.cpp

*/

#include "sgx/graphics/graphics.hpp"
#include "drivers/common/opengl/opengl.hpp"

void CDriverOpenGLDrawSurface::drawLineTo(const tPOINT x, const tPOINT y) {
	CSGXGraphicsEngine::get()->drawLine2D(m_fLastX, m_fLastY, x, y);
	CSGXDrawSurface::drawLineTo(x,y);
}


void CDriverOpenGLDrawSurface::fillQuad(const tPOINT x1, const tPOINT y1, const tPOINT x2, const tPOINT y2, const tPOINT x3, const tPOINT y3, const tPOINT x4, const tPOINT y4) {
	CSGXDrawSurface::fillQuad(x1, y1, x2, y2, x3, y3, x4, y4);

	if (m_UseColorFill) {
	}

	if (m_pTexture) {
	}
		// apply m_Xform
#if 00
		sgxVector2 pt1x = m_Xform.m.mul(pt1.x, pt1.y);
		sgxVector2 pt2x = m_Xform.m.mul(pt2.x, pt2.y);
		sgxVector2 pt3x = m_Xform.m.mul(pt3.x, pt3.y);
		sgxVector2 pt4x = m_Xform.m.mul(pt4.x, pt4.y);
#endif
		CSGXGraphicsEngine::get()->setTransform(m_Xform.m);
#if 0
		sgxVector2 pt1x(pt1);
		sgxVector2 pt2x(pt2);
		sgxVector2 pt3x(pt3);
		sgxVector2 pt4x(pt4);
#endif
		CSGXGraphicsEngine::get()->drawRect2D(x1, y1, x2, y2, x3, y3, x4, y4);
		//CSGXGraphicsEngine::get()->drawRect2D(pt1x, pt2x, pt3x, pt4x);

}

void CDriverOpenGLDrawSurface::fillPolygon(const sgxVector<sgxPoint2i> &ptList) {
	if (m_UseColorFill) {
	}

	if (m_pTexture) {
		// apply m_Xform
#if 0
		sgxVector2 pt1x = m_Xform.m.mul(pt1.x, pt1.y);
		sgxVector2 pt2x = m_Xform.m.mul(pt2.x, pt2.y);
		sgxVector2 pt3x = m_Xform.m.mul(pt3.x, pt3.y);
		sgxVector2 pt4x = m_Xform.m.mul(pt4.x, pt4.y);
#endif
		CSGXGraphicsEngine::get()->drawPolygon2D(ptList);
	}

}


