mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 22:23:50 +02:00
Merge pull request #3996 from huffman/fix-overlay-vertices
Fix quad vertices for ImageOverlay and TextOverlay
This commit is contained in:
commit
6bcc4ec896
2 changed files with 18 additions and 8 deletions
|
@ -100,26 +100,31 @@ void ImageOverlay::render(RenderArgs* args) {
|
||||||
float w = fromImage.width() / imageWidth; // ?? is this what we want? not sure
|
float w = fromImage.width() / imageWidth; // ?? is this what we want? not sure
|
||||||
float h = fromImage.height() / imageHeight;
|
float h = fromImage.height() / imageHeight;
|
||||||
|
|
||||||
|
int left = _bounds.left();
|
||||||
|
int right = _bounds.right() + 1;
|
||||||
|
int top = _bounds.top();
|
||||||
|
int bottom = _bounds.bottom() + 1;
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
glTexCoord2f(x, 1.0f - y);
|
glTexCoord2f(x, 1.0f - y);
|
||||||
}
|
}
|
||||||
glVertex2f(_bounds.left(), _bounds.top());
|
glVertex2f(left, top);
|
||||||
|
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
glTexCoord2f(x + w, 1.0f - y);
|
glTexCoord2f(x + w, 1.0f - y);
|
||||||
}
|
}
|
||||||
glVertex2f(_bounds.right(), _bounds.top());
|
glVertex2f(right, top);
|
||||||
|
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
glTexCoord2f(x + w, 1.0f - (y + h));
|
glTexCoord2f(x + w, 1.0f - (y + h));
|
||||||
}
|
}
|
||||||
glVertex2f(_bounds.right(), _bounds.bottom());
|
glVertex2f(right, bottom);
|
||||||
|
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
glTexCoord2f(x, 1.0f - (y + h));
|
glTexCoord2f(x, 1.0f - (y + h));
|
||||||
}
|
}
|
||||||
glVertex2f(_bounds.left(), _bounds.bottom());
|
glVertex2f(left, bottom);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
if (_renderImage) {
|
if (_renderImage) {
|
||||||
|
|
|
@ -70,11 +70,16 @@ void TextOverlay::render(RenderArgs* args) {
|
||||||
glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR,
|
glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR,
|
||||||
getBackgroundAlpha());
|
getBackgroundAlpha());
|
||||||
|
|
||||||
|
int left = _bounds.left();
|
||||||
|
int right = _bounds.right() + 1;
|
||||||
|
int top = _bounds.top();
|
||||||
|
int bottom = _bounds.bottom() + 1;
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glVertex2f(_bounds.left(), _bounds.top());
|
glVertex2f(left, top);
|
||||||
glVertex2f(_bounds.right(), _bounds.top());
|
glVertex2f(right, top);
|
||||||
glVertex2f(_bounds.right(), _bounds.bottom());
|
glVertex2f(right, bottom);
|
||||||
glVertex2f(_bounds.left(), _bounds.bottom());
|
glVertex2f(left, bottom);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
// Same font properties as textSize()
|
// Same font properties as textSize()
|
||||||
|
|
Loading…
Reference in a new issue