mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Removed cut and paste error from CMake file, made a couple variables in
TextRenderer more descriptive.
This commit is contained in:
parent
8b742e43e6
commit
ccdc1146a2
3 changed files with 9 additions and 9 deletions
|
@ -84,7 +84,7 @@ target_link_libraries(${TARGET_NAME} ${QT_LIBRARIES})
|
|||
if (NOT APPLE)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLUT REQUIRED)
|
||||
include_directories(${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${})
|
||||
include_directories(${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
|
||||
target_link_libraries(${TARGET_NAME} ${OPENGL_LIBRARY})
|
||||
else (NOT APPLE)
|
||||
# link in required OS X frameworks and include the right GL headers
|
||||
|
|
|
@ -25,7 +25,7 @@ TextRenderer::TextRenderer(const char* family, int pointSize, int weight, bool i
|
|||
}
|
||||
|
||||
TextRenderer::~TextRenderer() {
|
||||
glDeleteTextures(_textureIDs.size(), _textureIDs.constData());
|
||||
glDeleteTextures(_allTextureIDs.size(), _allTextureIDs.constData());
|
||||
}
|
||||
|
||||
void TextRenderer::draw(int x, int y, const char* str) {
|
||||
|
@ -102,17 +102,17 @@ const Glyph& TextRenderer::getGlyph(char c) {
|
|||
}
|
||||
if (_y + bounds.height() > IMAGE_SIZE) {
|
||||
// can't fit it on current texture; make a new one
|
||||
glGenTextures(1, &_textureID);
|
||||
glGenTextures(1, &_currentTextureID);
|
||||
_x = _y = _rowHeight = 0;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, _textureID);
|
||||
glBindTexture(GL_TEXTURE_2D, _currentTextureID);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, IMAGE_SIZE, IMAGE_SIZE, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
_textureIDs.append(_textureID);
|
||||
_allTextureIDs.append(_currentTextureID);
|
||||
|
||||
} else {
|
||||
glBindTexture(GL_TEXTURE_2D, _textureID);
|
||||
glBindTexture(GL_TEXTURE_2D, _currentTextureID);
|
||||
}
|
||||
// render the glyph into an image and copy it into the texture
|
||||
QImage image(bounds.width(), bounds.height(), QImage::Format_ARGB32);
|
||||
|
@ -125,7 +125,7 @@ const Glyph& TextRenderer::getGlyph(char c) {
|
|||
}
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, _x, _y, bounds.width(), bounds.height(), GL_RGBA, GL_UNSIGNED_BYTE, image.constBits());
|
||||
|
||||
glyph = Glyph(_textureID, QPoint(_x, _y), bounds, _metrics.width(c));
|
||||
glyph = Glyph(_currentTextureID, QPoint(_x, _y), bounds, _metrics.width(c));
|
||||
_x += bounds.width();
|
||||
_rowHeight = qMax(_rowHeight, bounds.height());
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
QHash<char, Glyph> _glyphs;
|
||||
|
||||
// the id of the glyph texture to which we're currently writing
|
||||
GLuint _textureID;
|
||||
GLuint _currentTextureID;
|
||||
|
||||
// the position within the current glyph texture
|
||||
int _x, _y;
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
int _rowHeight;
|
||||
|
||||
// the list of all texture ids for which we're responsible
|
||||
QVector<GLuint> _textureIDs;
|
||||
QVector<GLuint> _allTextureIDs;
|
||||
};
|
||||
|
||||
class Glyph {
|
||||
|
|
Loading…
Reference in a new issue