Fixed printing.

This commit is contained in:
Leonardo Zide 2017-02-11 09:46:21 -08:00
parent cfdfe30b40
commit 0f2e808477
9 changed files with 133 additions and 270 deletions

View file

@ -964,7 +964,7 @@ void lcCamera::SetViewpoint(lcViewpoint Viewpoint)
void lcCamera::StartTiledRendering(int tw, int th, int iw, int ih, float AspectRatio) void lcCamera::StartTiledRendering(int tw, int th, int iw, int ih, float AspectRatio)
{ {
m_pTR = new TiledRender(); m_pTR = new TiledRender();
m_pTR->TileSize(tw, th, 0); m_pTR->TileSize(tw, th);
m_pTR->ImageSize(iw, ih); m_pTR->ImageSize(iw, ih);
if (IsOrtho()) if (IsOrtho())
@ -982,10 +982,10 @@ void lcCamera::GetTileInfo(int* row, int* col, int* width, int* height)
{ {
if (m_pTR != NULL) if (m_pTR != NULL)
{ {
*row = m_pTR->m_Rows - m_pTR->m_CurrentRow - 1; *row = m_pTR->mRows - m_pTR->mCurrentRow - 1;
*col = m_pTR->m_CurrentColumn; *col = m_pTR->mCurrentColumn;
*width = m_pTR->m_CurrentTileWidth; *width = m_pTR->mCurrentTileWidth;
*height = m_pTR->m_CurrentTileHeight; *height = m_pTR->mCurrentTileHeight;
} }
} }

View file

@ -337,6 +337,17 @@ void lcContext::SetLineWidth(float LineWidth)
mLineWidth = LineWidth; mLineWidth = LineWidth;
} }
void lcContext::SetTextureMode(lcTextureMode TextureMode)
{
#ifndef LC_OPENGLES
if (!gSupportsShaderObjects)
{
const GLenum ModeTable[] = { GL_DECAL, GL_REPLACE, GL_MODULATE };
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, ModeTable[TextureMode]);
}
#endif
}
void lcContext::SetColor(float Red, float Green, float Blue, float Alpha) void lcContext::SetColor(float Red, float Green, float Blue, float Alpha)
{ {
SetColor(lcVector4(Red, Green, Blue, Alpha)); SetColor(lcVector4(Red, Green, Blue, Alpha));
@ -938,7 +949,7 @@ void lcContext::DrawMeshSection(lcMesh* Mesh, lcMeshSection* Section)
if (!mTexture) if (!mTexture)
{ {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); SetTextureMode(LC_TEXTURE_DECAL);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
} }

View file

@ -82,6 +82,13 @@ struct lcProgram
GLint ColorLocation; GLint ColorLocation;
}; };
enum lcTextureMode
{
LC_TEXTURE_DECAL,
LC_TEXTURE_REPLACE,
LC_TEXTURE_MODULATE
};
class lcContext class lcContext
{ {
public: public:
@ -116,6 +123,7 @@ public:
void SetProgram(lcProgramType ProgramType); void SetProgram(lcProgramType ProgramType);
void SetViewport(int x, int y, int Width, int Height); void SetViewport(int x, int y, int Width, int Height);
void SetLineWidth(float LineWidth); void SetLineWidth(float LineWidth);
void SetTextureMode(lcTextureMode TextureMode);
void SetColor(const lcVector4& Color) void SetColor(const lcVector4& Color)
{ {

View file

@ -8,11 +8,15 @@
#include <QtGui> #include <QtGui>
#include <QPrinter> #include <QPrinter>
#if !defined(EGL_VERSION_1_0) && !defined(GL_ES_VERSION_2_0) && !defined(GL_ES_VERSION_3_0)
#undef GL_LINES_ADJACENCY_EXT #undef GL_LINES_ADJACENCY_EXT
#undef GL_LINE_STRIP_ADJACENCY_EXT #undef GL_LINE_STRIP_ADJACENCY_EXT
#undef GL_TRIANGLES_ADJACENCY_EXT #undef GL_TRIANGLES_ADJACENCY_EXT
#undef GL_TRIANGLE_STRIP_ADJACENCY_EXT #undef GL_TRIANGLE_STRIP_ADJACENCY_EXT
#include "lc_glext.h" #include "lc_glext.h"
#else
#define LC_OPENGLES 1
#endif
// Old defines and declarations. // Old defines and declarations.
#define LC_MAXPATH 1024 #define LC_MAXPATH 1024

View file

@ -904,16 +904,8 @@ inline lcMatrix44 lcMatrix44LookAt(const lcVector3& Eye, const lcVector3& Target
return m; return m;
} }
inline lcMatrix44 lcMatrix44Perspective(float FoVy, float Aspect, float Near, float Far) inline lcMatrix44 lcMatrix44Frustum(float Left, float Right, float Bottom, float Top, float Near, float Far)
{ {
float Left, Right, Bottom, Top;
Top = Near * (float)tan(FoVy * LC_PI / 360.0f);
Bottom = -Top;
Left = Bottom * Aspect;
Right = Top * Aspect;
if ((Near <= 0.0f) || (Far <= 0.0f) || (Near == Far) || (Left == Right) || (Top == Bottom)) if ((Near <= 0.0f) || (Far <= 0.0f) || (Near == Far) || (Left == Right) || (Top == Bottom))
return lcMatrix44Identity(); return lcMatrix44Identity();
@ -936,6 +928,19 @@ inline lcMatrix44 lcMatrix44Perspective(float FoVy, float Aspect, float Near, fl
return m; return m;
} }
inline lcMatrix44 lcMatrix44Perspective(float FoVy, float Aspect, float Near, float Far)
{
float Left, Right, Bottom, Top;
Top = Near * (float)tan(FoVy * LC_PI / 360.0f);
Bottom = -Top;
Left = Bottom * Aspect;
Right = Top * Aspect;
return lcMatrix44Frustum(Left, Right, Bottom, Top, Near, Far);
}
inline lcMatrix44 lcMatrix44Ortho(float Left, float Right, float Bottom, float Top, float Near, float Far) inline lcMatrix44 lcMatrix44Ortho(float Left, float Right, float Bottom, float Top, float Near, float Far)
{ {
lcMatrix44 m; lcMatrix44 m;

View file

@ -1155,7 +1155,7 @@ void lcModel::DrawBackground(lcGLWidget* Widget)
{ {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); Context->SetTextureMode(LC_TEXTURE_REPLACE);
glBindTexture(GL_TEXTURE_2D, mBackgroundTexture->mTexture); glBindTexture(GL_TEXTURE_2D, mBackgroundTexture->mTexture);
float TileWidth = 1.0f, TileHeight = 1.0f; float TileWidth = 1.0f, TileHeight = 1.0f;

View file

@ -1,129 +1,55 @@
// TR.cpp: implementation of the TiledRender class.
//
//////////////////////////////////////////////////////////////////////
#include "lc_global.h" #include "lc_global.h"
#include <math.h>
#include "tr.h" #include "tr.h"
#include "lc_math.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
TiledRender::TiledRender() TiledRender::TiledRender()
{ {
m_TileWidth = 256; mTileWidth = 256;
m_TileHeight = 256; mTileHeight = 256;
m_TileBorder = 0; mCurrentTile = -1;
m_RowOrder = TR_BOTTOM_TO_TOP;
m_CurrentTile = -1;
m_ImageBuffer = 0;
m_TileBuffer = 0;
} }
TiledRender::~TiledRender() TiledRender::~TiledRender()
{ {
} }
void TiledRender::TileSize(int width, int height, int border) void TiledRender::TileSize(int width, int height)
{ {
m_TileBorder = border; mTileWidth = width;
m_TileWidth = width; mTileHeight = height;
m_TileHeight = height;
m_TileWidthNB = width - 2 * border;
m_TileHeightNB = height - 2 * border;
}
void TiledRender::TileBuffer(TRenum format, TRenum type, void *image)
{
m_TileFormat = format;
m_TileType = type;
m_TileBuffer = image;
} }
void TiledRender::ImageSize(int width, int height) void TiledRender::ImageSize(int width, int height)
{ {
m_ImageWidth = width; mImageWidth = width;
m_ImageHeight = height; mImageHeight = height;
}
void TiledRender::ImageBuffer(TRenum format, TRenum type, void *image)
{
m_ImageFormat = format;
m_ImageType = type;
m_ImageBuffer = image;
}
void TiledRender::RowOrder(TRenum order)
{
if (order == TR_TOP_TO_BOTTOM || order == TR_BOTTOM_TO_TOP)
m_RowOrder = order;
}
int TiledRender::Get(TRenum param)
{
switch (param)
{
case TR_TILE_WIDTH:
return m_TileWidth;
case TR_TILE_HEIGHT:
return m_TileHeight;
case TR_TILE_BORDER:
return m_TileBorder;
case TR_IMAGE_WIDTH:
return m_ImageWidth;
case TR_IMAGE_HEIGHT:
return m_ImageHeight;
case TR_ROWS:
return m_Rows;
case TR_COLUMNS:
return m_Columns;
case TR_CURRENT_ROW:
if (m_CurrentTile < 0)
return -1;
else
return m_CurrentRow;
case TR_CURRENT_COLUMN:
if (m_CurrentTile < 0)
return -1;
else
return m_CurrentColumn;
case TR_CURRENT_TILE_WIDTH:
return m_CurrentTileWidth;
case TR_CURRENT_TILE_HEIGHT:
return m_CurrentTileHeight;
case TR_ROW_ORDER:
return (int) m_RowOrder;
default:
return 0;
}
} }
void TiledRender::Ortho(double left, double right, double bottom, double top, double zNear, double zFar) void TiledRender::Ortho(double left, double right, double bottom, double top, double zNear, double zFar)
{ {
if (m_CurrentTile < 0) if (mCurrentTile < 0)
{ {
m_Perspective = false; mPerspective = false;
m_Left = left; mLeft = left;
m_Right = right; mRight = right;
m_Bottom = bottom; mBottom = bottom;
m_Top = top; mTop = top;
m_Near = zNear; mNear = zNear;
m_Far = zFar; mFar = zFar;
} }
} }
void TiledRender::Frustum(double left, double right, double bottom, double top, double zNear, double zFar) void TiledRender::Frustum(double left, double right, double bottom, double top, double zNear, double zFar)
{ {
if (m_CurrentTile < 0) if (mCurrentTile < 0)
{ {
m_Perspective = true; mPerspective = true;
m_Left = left; mLeft = left;
m_Right = right; mRight = right;
m_Bottom = bottom; mBottom = bottom;
m_Top = top; mTop = top;
m_Near = zNear; mNear = zNear;
m_Far = zFar; mFar = zFar;
} }
} }
@ -137,129 +63,66 @@ void TiledRender::Perspective(double fovy, double aspect, double zNear, double z
Frustum(xmin, xmax, ymin, ymax, zNear, zFar); Frustum(xmin, xmax, ymin, ymax, zNear, zFar);
} }
void TiledRender::BeginTile() lcMatrix44 TiledRender::BeginTile()
{ {
GLint matrixMode; int tileWidth, tileHeight;
int tileWidth, tileHeight, border;
double left, right, bottom, top; double left, right, bottom, top;
if (m_CurrentTile <= 0) if (mCurrentTile <= 0)
{ {
m_Columns = (m_ImageWidth + m_TileWidthNB - 1) / m_TileWidthNB; mColumns = (mImageWidth + mTileWidth - 1) / mTileWidth;
m_Rows = (m_ImageHeight + m_TileHeightNB - 1) / m_TileHeightNB; mRows = (mImageHeight + mTileHeight - 1) / mTileHeight;
m_CurrentTile = 0; mCurrentTile = 0;
// Save user's viewport, will be restored after last tile rendered // Save user's viewport, will be restored after last tile rendered
glGetIntegerv(GL_VIEWPORT, m_ViewportSave); glGetIntegerv(GL_VIEWPORT, mViewportSave);
} }
// which tile (by row and column) we're about to render // which tile (by row and column) we're about to render
if (m_RowOrder == TR_BOTTOM_TO_TOP) mCurrentRow = mCurrentTile / mColumns;
{ mCurrentColumn = mCurrentTile % mColumns;
m_CurrentRow = m_CurrentTile / m_Columns;
m_CurrentColumn = m_CurrentTile % m_Columns;
}
else if (m_RowOrder==TR_TOP_TO_BOTTOM)
{
m_CurrentRow = m_Rows - (m_CurrentTile / m_Columns) - 1;
m_CurrentColumn = m_CurrentTile % m_Columns;
}
border = m_TileBorder;
// Compute actual size of this tile with border // Compute actual size of this tile with border
if (m_CurrentRow < m_Rows-1) if (mCurrentRow < mRows - 1)
tileHeight = m_TileHeight; tileHeight = mTileHeight;
else else
tileHeight = m_ImageHeight - (m_Rows-1) * (m_TileHeightNB) + 2 * border; tileHeight = mImageHeight - (mRows - 1) * (mTileHeight);
if (m_CurrentColumn < m_Columns-1) if (mCurrentColumn < mColumns - 1)
tileWidth = m_TileWidth; tileWidth = mTileWidth;
else else
tileWidth = m_ImageWidth - (m_Columns-1) * (m_TileWidthNB) + 2 * border; tileWidth = mImageWidth - (mColumns - 1) * (mTileWidth);
// Save tile size, with border // Save tile size, with border
m_CurrentTileWidth = tileWidth; mCurrentTileWidth = tileWidth;
m_CurrentTileHeight = tileHeight; mCurrentTileHeight = tileHeight;
glViewport(0, 0, tileWidth, tileHeight); // tile size including border glViewport(0, 0, tileWidth, tileHeight); // tile size including border
// save current matrix mode
glGetIntegerv(GL_MATRIX_MODE, &matrixMode);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// compute projection parameters // compute projection parameters
left = m_Left + (m_Right - m_Left) left = mLeft + (mRight - mLeft) * (mCurrentColumn * mTileWidth) / mImageWidth;
* (m_CurrentColumn * m_TileWidthNB - border) / m_ImageWidth; right = left + (mRight - mLeft) * tileWidth / mImageWidth;
right = left + (m_Right - m_Left) * tileWidth / m_ImageWidth; bottom = mBottom + (mTop - mBottom) * (mCurrentRow * mTileHeight) / mImageHeight;
bottom = m_Bottom + (m_Top - m_Bottom) top = bottom + (mTop - mBottom) * tileHeight / mImageHeight;
* (m_CurrentRow * m_TileHeightNB - border) / m_ImageHeight;
top = bottom + (m_Top - m_Bottom) * tileHeight / m_ImageHeight;
if (m_Perspective) if (mPerspective)
glFrustum(left, right, bottom, top, m_Near, m_Far); return lcMatrix44Frustum(left, right, bottom, top, mNear, mFar);
else else
glOrtho(left, right, bottom, top, m_Near, m_Far); return lcMatrix44Ortho(left, right, bottom, top, mNear, mFar);
// restore user's matrix mode
glMatrixMode((GLenum)matrixMode);
} }
int TiledRender::EndTile() int TiledRender::EndTile()
{ {
GLint prevRowLength, prevSkipRows, prevSkipPixels;
// be sure OpenGL rendering is finished // be sure OpenGL rendering is finished
glFlush(); glFlush();
// save current glPixelStore values
glGetIntegerv(GL_PACK_ROW_LENGTH, &prevRowLength);
glGetIntegerv(GL_PACK_SKIP_ROWS, &prevSkipRows);
glGetIntegerv(GL_PACK_SKIP_PIXELS, &prevSkipPixels);
if (m_TileBuffer)
{
int srcX = m_TileBorder;
int srcY = m_TileBorder;
int srcWidth = m_TileWidthNB;
int srcHeight = m_TileHeightNB;
glReadPixels(srcX, srcY, srcWidth, srcHeight,
(GLenum)m_TileFormat, (GLenum)m_TileType, m_TileBuffer);
}
if (m_ImageBuffer)
{
int srcX = m_TileBorder;
int srcY = m_TileBorder;
int srcWidth = m_CurrentTileWidth - 2 * m_TileBorder;
int srcHeight = m_CurrentTileHeight - 2 * m_TileBorder;
int destX = m_TileWidthNB * m_CurrentColumn;
int destY = m_TileHeightNB * m_CurrentRow;
// setup pixel store for glReadPixels
glPixelStorei(GL_PACK_ROW_LENGTH, m_ImageWidth);
glPixelStorei(GL_PACK_SKIP_ROWS, destY);
glPixelStorei(GL_PACK_SKIP_PIXELS, destX);
// read the tile into the final image
glReadPixels(srcX, srcY, srcWidth, srcHeight,
(GLenum)m_ImageFormat, (GLenum)m_ImageType, m_ImageBuffer);
}
// restore previous glPixelStore values
glPixelStorei(GL_PACK_ROW_LENGTH, prevRowLength);
glPixelStorei(GL_PACK_SKIP_ROWS, prevSkipRows);
glPixelStorei(GL_PACK_SKIP_PIXELS, prevSkipPixels);
// increment tile counter, return 1 if more tiles left to render // increment tile counter, return 1 if more tiles left to render
m_CurrentTile++; mCurrentTile++;
if (m_CurrentTile >= m_Rows * m_Columns) if (mCurrentTile >= mRows * mColumns)
{ {
// restore user's viewport // restore user's viewport
glViewport(m_ViewportSave[0], m_ViewportSave[1], glViewport(mViewportSave[0], mViewportSave[1], mViewportSave[2], mViewportSave[3]);
m_ViewportSave[2], m_ViewportSave[3]); mCurrentTile = -1; // all done
m_CurrentTile = -1; // all done
return 0; return 0;
} }
else else

View file

@ -5,70 +5,42 @@
#ifndef _TR_H_ #ifndef _TR_H_
#define _TR_H_ #define _TR_H_
typedef enum {
TR_TILE_WIDTH = 100,
TR_TILE_HEIGHT,
TR_TILE_BORDER,
TR_IMAGE_WIDTH,
TR_IMAGE_HEIGHT,
TR_ROWS,
TR_COLUMNS,
TR_CURRENT_ROW,
TR_CURRENT_COLUMN,
TR_CURRENT_TILE_WIDTH,
TR_CURRENT_TILE_HEIGHT,
TR_ROW_ORDER,
TR_TOP_TO_BOTTOM,
TR_BOTTOM_TO_TOP
} TRenum;
class TiledRender class TiledRender
{ {
public: public:
TiledRender(); TiledRender();
virtual ~TiledRender(); ~TiledRender();
void TileSize(int width, int height, int border); void TileSize(int width, int height);
void TileBuffer(TRenum format, TRenum type, void *image);
void ImageSize(int width, int height); void ImageSize(int width, int height);
void ImageBuffer(TRenum format, TRenum type, void *image);
void RowOrder(TRenum order);
void Ortho(double left, double right, double bottom, double top, double zNear, double zFar); void Ortho(double left, double right, double bottom, double top, double zNear, double zFar);
void Frustum(double left, double right, double bottom, double top, double zNear, double zFar); void Frustum(double left, double right, double bottom, double top, double zNear, double zFar);
void Perspective(double fovy, double aspect, double zNear, double zFar ); void Perspective(double fovy, double aspect, double zNear, double zFar );
int Get(TRenum param);
int EndTile(); int EndTile();
void BeginTile(); lcMatrix44 BeginTile();
// Final image parameters // Final image parameters
int m_ImageWidth, m_ImageHeight; int mImageWidth, mImageHeight;
TRenum m_ImageFormat, m_ImageType;
void *m_ImageBuffer;
// Tile parameters // Tile parameters
int m_TileWidth, m_TileHeight; int mTileWidth, mTileHeight;
int m_TileWidthNB, m_TileHeightNB;
int m_TileBorder;
TRenum m_TileFormat, m_TileType;
void *m_TileBuffer;
// Projection parameters // Projection parameters
bool m_Perspective; bool mPerspective;
double m_Left; double mLeft;
double m_Right; double mRight;
double m_Bottom; double mBottom;
double m_Top; double mTop;
double m_Near; double mNear;
double m_Far; double mFar;
// Misc // Misc
TRenum m_RowOrder; int mRows, mColumns;
int m_Rows, m_Columns; int mCurrentTile;
int m_CurrentTile; int mCurrentTileWidth, mCurrentTileHeight;
int m_CurrentTileWidth, m_CurrentTileHeight; int mCurrentRow, mCurrentColumn;
int m_CurrentRow, m_CurrentColumn;
GLint m_ViewportSave[4]; GLint mViewportSave[4];
}; };
#endif // _TR_H_ #endif // _TR_H_

View file

@ -277,7 +277,7 @@ lcMatrix44 View::GetProjectionMatrix() const
float AspectRatio = (float)mWidth / (float)mHeight; float AspectRatio = (float)mWidth / (float)mHeight;
if (mCamera->m_pTR) if (mCamera->m_pTR)
mCamera->m_pTR->BeginTile(); return mCamera->m_pTR->BeginTile();
if (mCamera->IsOrtho()) if (mCamera->IsOrtho())
{ {
@ -1120,7 +1120,7 @@ void View::DrawRotateOverlay()
mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0))); mContext->SetViewMatrix(lcMatrix44Translation(lcVector3(0.375, 0.375, 0.0)));
mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f)); mContext->SetProjectionMatrix(lcMatrix44Ortho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f));
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mContext->SetTextureMode(LC_TEXTURE_MODULATE);
gTexFont.MakeCurrent(); gTexFont.MakeCurrent();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -1439,7 +1439,7 @@ void View::DrawGrid()
if (Preferences.mDrawGridStuds) if (Preferences.mDrawGridStuds)
{ {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mContext->SetTextureMode(LC_TEXTURE_MODULATE);
glBindTexture(GL_TEXTURE_2D, gGridTexture->mTexture); glBindTexture(GL_TEXTURE_2D, gGridTexture->mTexture);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -1520,7 +1520,7 @@ void View::DrawAxes()
mContext->SetProgram(LC_PROGRAM_TEXTURE); mContext->SetProgram(LC_PROGRAM_TEXTURE);
mContext->SetViewMatrix(TranslationMatrix); mContext->SetViewMatrix(TranslationMatrix);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mContext->SetTextureMode(LC_TEXTURE_MODULATE);
gTexFont.MakeCurrent(); gTexFont.MakeCurrent();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@ -1577,7 +1577,7 @@ void View::DrawViewport()
mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f); mContext->SetColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mContext->SetTextureMode(LC_TEXTURE_MODULATE);
gTexFont.MakeCurrent(); gTexFont.MakeCurrent();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); glEnable(GL_BLEND);