examples/Qt/ISFEditor/ISFEditor_app/Spout/SpoutGLDXinterop.cpp
//
// COPY IMAGE PIXELS TO THE SHARED TEXTURE
//

COPY IMAGE PIXELS TO THE SHARED TEXTURE
COPY IMAGE PIXELS TO THE SHARED TEXTURE
bool spoutGLDXinterop::WriteGLDXpixels(const unsigned char *pixels, 
	                                      unsigned int width, 
										  unsigned int height, 
										  GLenum glFormat,
										  bool bInvert,
										  GLuint HostFBO)
{
	GLenum glformat = glFormat;
	if(width != m_TextureInfo.width || height != m_TextureInfo.height) return false;
	CheckOpenGLTexture(m_TexID, GL_RGBA, width, height, m_TexWidth, m_TexHeight);
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
	if(IsPBOavailable()) {
		LoadTexturePixels(m_TexID, GL_TEXTURE_2D, width, height, (const unsigned char *)pixels, glFormat);
	}
	else {
		glBindTexture(GL_TEXTURE_2D, m_TexID);
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, glformat, GL_UNSIGNED_BYTE, (GLvoid *)pixels);
		glBindTexture(GL_TEXTURE_2D, 0);
	}
	glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
	WriteTexture(m_TexID, GL_TEXTURE_2D, width, height, bInvert, HostFBO);
	return true;
}
bool spoutGLDXinterop :: WriteGLDXpixels ( const unsigned char * pixels , unsigned int width , unsigned int height , GLenum glFormat , bool bInvert , GLuint HostFBO ) { GLenum glformat = glFormat ; if ( width != m_TextureInfo . width || height != m_TextureInfo . height ) return false ; CheckOpenGLTexture ( m_TexID , GL_RGBA , width , height , m_TexWidth , m_TexHeight ) ; glPixelStorei ( GL_UNPACK_ALIGNMENT , 1 ) ; if ( IsPBOavailable ( ) ) { LoadTexturePixels ( m_TexID , GL_TEXTURE_2D , width , height , ( const unsigned char * ) pixels , glFormat ) ; } else { glBindTexture ( GL_TEXTURE_2D , m_TexID ) ; glTexSubImage2D ( GL_TEXTURE_2D , 0 , 0 , 0 , width , height , glformat , GL_UNSIGNED_BYTE , ( GLvoid * ) pixels ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; } glPixelStorei ( GL_UNPACK_ALIGNMENT , 4 ) ; WriteTexture ( m_TexID , GL_TEXTURE_2D , width , height , bInvert , HostFBO ) ; return true ; }
COPY IMAGE PIXELS TO THE SHARED TEXTURE
COPY IMAGE PIXELS TO THE SHARED TEXTURE
// Use a GL texture so that WriteTexture can be used
 // Create or resize a local OpenGL texture
 // Transfer the pixels to the local texture
 // Write the local texture to the shared texture and invert if necessary
