Merge pull request #3996 from huffman/fix-overlay-vertices

Fix quad vertices for ImageOverlay and TextOverlay
This commit is contained in:
Brad Hefta-Gaub 2014-12-20 05:40:54 -08:00
commit 6bcc4ec896
2 changed files with 18 additions and 8 deletions

View file

@ -100,26 +100,31 @@ void ImageOverlay::render(RenderArgs* args) {
float w = fromImage.width() / imageWidth; // ?? is this what we want? not sure
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);
if (_renderImage) {
glTexCoord2f(x, 1.0f - y);
}
glVertex2f(_bounds.left(), _bounds.top());
glVertex2f(left, top);
if (_renderImage) {
glTexCoord2f(x + w, 1.0f - y);
}
glVertex2f(_bounds.right(), _bounds.top());
glVertex2f(right, top);
if (_renderImage) {
glTexCoord2f(x + w, 1.0f - (y + h));
}
glVertex2f(_bounds.right(), _bounds.bottom());
glVertex2f(right, bottom);
if (_renderImage) {
glTexCoord2f(x, 1.0f - (y + h));
}
glVertex2f(_bounds.left(), _bounds.bottom());
glVertex2f(left, bottom);
glEnd();
if (_renderImage) {

View file

@ -70,11 +70,16 @@ void TextOverlay::render(RenderArgs* args) {
glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR,
getBackgroundAlpha());
int left = _bounds.left();
int right = _bounds.right() + 1;
int top = _bounds.top();
int bottom = _bounds.bottom() + 1;
glBegin(GL_QUADS);
glVertex2f(_bounds.left(), _bounds.top());
glVertex2f(_bounds.right(), _bounds.top());
glVertex2f(_bounds.right(), _bounds.bottom());
glVertex2f(_bounds.left(), _bounds.bottom());
glVertex2f(left, top);
glVertex2f(right, top);
glVertex2f(right, bottom);
glVertex2f(left, bottom);
glEnd();
// Same font properties as textSize()