|
#include "stdafx.h"
#include "RasterImageRectTool.h"
#include <OAGPrimitives.h>
#include <OAGRectangleMapping.h>
CRasterImageRectTool::CRasterImageRectTool(void)
{
}
CRasterImageRectTool::~CRasterImageRectTool(void)
{
}
//Operations
//Virtual
void CRasterImageRectTool::AddAllVerticesToScene()
{
m_pWinGraphicContext->MakeCurrent();
oag::OAGTexture* t1 = m_pScene->GetTextureMappingTable()->GetTexture("Image1");
if ( t1 )
{
//Clear filters and wraps set for the texture
t1->ClearFiltersAndWraps();
std::vector<OAG_TEXTURE_FILTER> filterList;
switch( m_textureRenderMode)
{
case NORMAL:
{
//Filters
filterList.push_back( MAG_FILTER_LINEAR);
filterList.push_back( MIN_FILTER_LINEAR);
}
break;
case REAPEATING:
{
//Filters
filterList.push_back( MAG_FILTER_LINEAR);
filterList.push_back( MIN_FILTER_LINEAR);
//Reapeating
std::vector<OAG_TEXTURE_WRAP> wrapList;
wrapList.push_back( WRAP_S_REPEAT);
wrapList.push_back( WRAP_T_REPEAT);
t1->SetTextureWrap( wrapList );
t1->SetWrapValue( 6 );//Value for texture reapeating
t1->SetTextureMode( GL_MODULATE );
}
break;
case CLAMPING:
{
//Filters
filterList.push_back( MAG_FILTER_LINEAR);
filterList.push_back( MIN_FILTER_LINEAR);
//Clamping
std::vector<OAG_TEXTURE_WRAP> wrapList;
wrapList.push_back( WRAP_S_CLAMP);
wrapList.push_back( WRAP_T_CLAMP);
t1->SetTextureWrap( wrapList );
t1->SetWrapValue( 4 ); //Value for texture clamping
t1->SetTextureMode( GL_MODULATE );
}
break;
}
t1->SetTextureFilter( filterList );
t1->SetTextureHeight(256);
t1->SetTextureWidth(256);
t1->BuildTexture();
}
oag::OAGRectangleMapping* tex = new oag::OAGRectangleMapping(t1);
oag::OAGVector3f vec1 = m_arrVector[0];
oag::Matrix4x4 mt;
mt.SetTranslation(vec1.m_X, vec1.m_Y, vec1.m_Z);
tex->SetTransform( mt );
m_pScene->AddObject( tex );
m_pWinGraphicContext->DeleteCurrent();
}
|
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.