libsegl/gldrawhelper.cpp

25 lines
555 B
C++

#include "gldrawhelper.h"
void GLDrawSDLRect(SDL_Rect *rect, GLRect *tex) {
GLRect tmptex;
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();
}