[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd gl_helpers.h
From: |
Gerhard Reitmayr |
Subject: |
[libcvd-members] libcvd/cvd gl_helpers.h |
Date: |
Tue, 30 Oct 2007 15:06:25 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Gerhard Reitmayr <gerhard> 07/10/30 15:06:25
Modified files:
cvd : gl_helpers.h
Log message:
make glTexImage functions work with SubImage
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/gl_helpers.h?cvsroot=libcvd&r1=1.34&r2=1.35
Patches:
Index: gl_helpers.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/gl_helpers.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- gl_helpers.h 24 Oct 2007 10:44:52 -0000 1.34
+++ gl_helpers.h 30 Oct 2007 15:06:25 -0000 1.35
@@ -534,20 +534,24 @@
/// note the reordering of the various parameters to make better use of
default parameters
/// @param i the image to set as texture
/// @ingroup gGL
- template<class C> inline void glTexSubImage2D( const BasicImage<C> &i,
GLint xoffset = 0, GLint yoffset = 0, GLenum target = GL_TEXTURE_2D, GLint
level = 0)
+ template<class C> inline void glTexSubImage2D( const SubImage<C> &i,
GLint xoffset = 0, GLint yoffset = 0, GLenum target = GL_TEXTURE_2D, GLint
level = 0)
{
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ ::glPixelStorei(GL_UNPACK_ROW_LENGTH, i.row_stride());
::glTexSubImage2D(target, level, xoffset, yoffset, i.size().x,
i.size().y, gl::data<C>::format, gl::data<C>::type, i.data());
+ ::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
/// Sets an image as a texture.
/// note the reordering of the various parameters to make better use of
default parameters
/// @param i the image to set as texture
/// @ingroup gGL
- template<class C> inline void glTexImage2D( const BasicImage<C> &i,
GLint border = 0, GLenum target = GL_TEXTURE_2D, GLint level = 0)
+ template<class C> inline void glTexImage2D( const SubImage<C> &i, GLint
border = 0, GLenum target = GL_TEXTURE_2D, GLint level = 0)
{
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ ::glPixelStorei(GL_UNPACK_ROW_LENGTH, i.row_stride());
::glTexImage2D(target, level, gl::data<C>::format, i.size().x,
i.size().y, border, gl::data<C>::format, gl::data<C>::type, i.data());
+ ::glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
/// Prints the current errors on the gl error stack