diff options
author | wm4 <wm4@mplayer2.org> | 2011-10-06 20:46:01 +0200 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-11-25 23:56:28 +0200 |
commit | 28eaf11cf3b220871b97d9ba40d5058a84bcba09 (patch) | |
tree | 15f452ea32fcdbf788147694aa581530066da122 /libvo/gl_common.c | |
parent | 0440460d0cb1a65cc890508279b287c97db38a78 (diff) | |
download | mpv-28eaf11cf3b220871b97d9ba40d5058a84bcba09.tar.bz2 mpv-28eaf11cf3b220871b97d9ba40d5058a84bcba09.tar.xz |
vo_gl: implement screenshots
Diffstat (limited to 'libvo/gl_common.c')
-rw-r--r-- | libvo/gl_common.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index bbcbeb2f3b..f433f5642d 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -71,6 +71,7 @@ void glAdjustAlignment(GL *gl, int stride) else gl_alignment = 1; gl->PixelStorei(GL_UNPACK_ALIGNMENT, gl_alignment); + gl->PixelStorei(GL_PACK_ALIGNMENT, gl_alignment); } struct gl_name_map_struct { @@ -635,6 +636,24 @@ void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type, } /** + * \brief download a texture, handling things like stride and slices + * \param target texture target, usually GL_TEXTURE_2D + * \param format OpenGL format of data + * \param type OpenGL type of data + * \param dataptr destination memory for download + * \param stride data stride (must be positive) + * \ingroup gltexture + */ +void glDownloadTex(GL *gl, GLenum target, GLenum format, GLenum type, + void *dataptr, int stride) +{ + // this is not always correct, but should work for MPlayer + glAdjustAlignment(gl, stride); + gl->PixelStorei(GL_PACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); + gl->GetTexImage(target, 0, format, type, dataptr); +} + +/** * \brief Setup ATI version of register combiners for YUV to RGB conversion. * \param csp_params parameters used for colorspace conversion * \param text if set use the GL_ATI_text_fragment_shader API as |