libsegl/gldrawhelper.cpp

29 lines
590 B
C++
Raw Normal View History

2008-02-09 13:43:23 +01:00
#include "gldrawhelper.h"
namespace segl {
void GLDrawSDLRect(SDL_Rect *rect, Rect *tex) {
Rect tmptex;
2008-02-09 13:43:23 +01:00
if(tex) {
tmptex = *tex;
} else {
tmptex.set(0.0f, 0.0f, 1.0f, 1.0f);
}
glBegin(GL_QUADS);
glTexCoord2f(tmptex.x, tmptex.y);
glVertex2i(rect->x, rect->y+rect->h);
glTexCoord2f(tmptex.x+tmptex.w, tmptex.y);
glVertex2i(rect->x+rect->w, rect->y+rect->h);
glTexCoord2f(tmptex.x+tmptex.w, tmptex.y+tmptex.h);
glVertex2i(rect->x+rect->w, rect->y);
glTexCoord2f(tmptex.x, tmptex.y+tmptex.h);
glVertex2i(rect->x, rect->y);
glEnd();
}
} // namespace segl