|
#include "..\..\include\TextureMapping\OAGTriangleMapping.h"
#include "..\..\include\Texture\OAGTextureLoader.h"
oag::OAGTriangleMapping::OAGTriangleMapping(void)
{
m_enumTextureMapping = OAG_TEXTURE_MAP_TRIANGLE;
}
oag::OAGTriangleMapping::~OAGTriangleMapping(void)
{
}
//Operations
void oag::OAGTriangleMapping::OnDraw()
{
::glPushMatrix();
::glLoadIdentity();
if ( m_nTextureCoordinates.size() == 0
|| m_nTextureVertices.size() == 0
)
return;
::glColor4ubv( m_Color.GetColor4ubv() );
::glPolygonMode(m_PolygonFace, m_PolygonMode);
::glTranslated(m_position.m_X, m_position.m_Y, m_position.m_Z);
glEnable(GL_BLEND);
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, m_glTextureId);
glBegin(GL_TRIANGLES);
glTexCoord2d( m_nTextureCoordinates[0], m_nTextureCoordinates[1] );
glVertex2d(m_nTextureVertices[0], m_nTextureVertices[1]);
glTexCoord2d( m_nTextureCoordinates[2], m_nTextureCoordinates[3] );
glVertex2d(m_nTextureVertices[2], m_nTextureVertices[3]);
glTexCoord2d( m_nTextureCoordinates[4], m_nTextureCoordinates[5]);
glVertex2d(m_nTextureVertices[4], m_nTextureVertices[5]);
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
::glPopMatrix();
}
void oag::OAGTriangleMapping::ReadNodeXML(CXmlNode *pNode)
{
oag::OAGTextureMapping::ReadNodeXML(pNode);
}
void oag::OAGTriangleMapping::SaveNodeXML(CXmlNode *pNode)
{
oag::OAGTextureMapping::SaveNodeXML(pNode);
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Matão, a small city in Brazil. I studied as Programmer in a College for Software Development in Database.
After finishing the College I have been working with java, c# and Computer Graphics with searches for OpenGL.