diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-08-14 13:44:14 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-08-14 13:44:14 +0000 |
commit | 698494f77958dc33b10c42ffcabffdac1f2a5e1f (patch) | |
tree | 2a4c42bb6fb7bc8690a1f4872a67b230373e9f11 /libvo/gl_common.c | |
parent | 3cf870e26bcd7cd0e03c8d170cf34ee7bd0409ab (diff) | |
download | mpv-698494f77958dc33b10c42ffcabffdac1f2a5e1f.tar.bz2 mpv-698494f77958dc33b10c42ffcabffdac1f2a5e1f.tar.xz |
Helper function for drawing texture and general cleanup of vo_gl2.c
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16215 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/gl_common.c')
-rw-r--r-- | libvo/gl_common.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index e68bc75d69..8aa75cd5d0 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -345,6 +345,38 @@ void glUploadTex(GLenum target, GLenum format, GLenum type, glTexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data); } +/** + * \brief draw a texture part at given 2D coordinates + * \param x screen top coordinate + * \param y screen left coordinate + * \param w screen width coordinate + * \param h screen height coordinate + * \param tx texture top coordinate in pixels + * \param ty texture left coordinate in pixels + * \param tw texture part width in pixels + * \param th texture part height in pixels + * \param sx width of texture in pixels + * \param sy height of texture in pixels + * \param rect_tex whether this texture uses texture_rectangle extension + */ +void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, + GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th, + int sx, int sy, int rect_tex) { + if (!rect_tex) { + tx /= sx; ty /= sy; tw /= sx; th /= sy; + } + glBegin(GL_QUADS); + glTexCoord2f(tx, ty); + glVertex2f(x, y); + glTexCoord2f(tx, ty + th); + glVertex2f(x, y + h); + glTexCoord2f(tx + tw, ty + th); + glVertex2f(x + w, y + h); + glTexCoord2f(tx + tw, ty); + glVertex2f(x + w, y); + glEnd(); +} + #ifdef GL_WIN32 static void *w32gpa(const GLubyte *procName) { return wglGetProcAddress(procName); |