examples/Qt/ISFEditor/ISFEditor_app/Spout/SpoutGLDXinterop.cpp
//
// Write user texture pixel data to shared memory
// rgba textures only
//

Write user texture pixel data to shared memory
rgba textures only
Write user texture pixel data to shared memory rgba textures only
bool spoutGLDXinterop::WriteMemory (GLuint TexID, 
									GLuint TextureTarget, 
									unsigned int width, 
									unsigned int height, 
									bool bInvert,
									GLuint HostFBO)
{
	unsigned char *pBuffer = memoryshare.LockSenderMemory();
	if(!pBuffer) {
		return false;
	}
	CheckOpenGLTexture(m_TexID, GL_RGBA, width, height, m_TexWidth, m_TexHeight);
	CopyTexture(TexID, TextureTarget, m_TexID, GL_TEXTURE_2D, width, height, bInvert, HostFBO);
	if(IsPBOavailable()) {
		UnloadTexturePixels(m_TexID, GL_TEXTURE_2D, width, height, pBuffer, GL_RGBA, false, HostFBO);
	}
	else {
		glBindTexture(GL_TEXTURE_2D, m_TexID);
		glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)pBuffer);
		glBindTexture(GL_TEXTURE_2D, 0);
	}
	memoryshare.UnlockSenderMemory();
	return true;
}
bool spoutGLDXinterop :: WriteMemory ( GLuint TexID , GLuint TextureTarget , unsigned int width , unsigned int height , bool bInvert , GLuint HostFBO ) { unsigned char * pBuffer = memoryshare . LockSenderMemory ( ) ; if ( ! pBuffer ) { return false ; } CheckOpenGLTexture ( m_TexID , GL_RGBA , width , height , m_TexWidth , m_TexHeight ) ; CopyTexture ( TexID , TextureTarget , m_TexID , GL_TEXTURE_2D , width , height , bInvert , HostFBO ) ; if ( IsPBOavailable ( ) ) { UnloadTexturePixels ( m_TexID , GL_TEXTURE_2D , width , height , pBuffer , GL_RGBA , false , HostFBO ) ; } else { glBindTexture ( GL_TEXTURE_2D , m_TexID ) ; glGetTexImage ( GL_TEXTURE_2D , 0 , GL_RGBA , GL_UNSIGNED_BYTE , ( GLvoid * ) pBuffer ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; } memoryshare . UnlockSenderMemory ( ) ; return true ; }
Write user texture pixel data to shared memory
rgba textures only
Write user texture pixel data to shared memory rgba textures only
// Create or resize a local OpenGL texture
 // Copy the user texture to the local rgba texture and invert as necessary
 // There is not much speed gain bypassing the intermediate texture
 // so create it and then it will always be RGBA for the functions to follow
 // Read the local opengl texture into the rgba memory map buffer
 // Use PBO if supported
 // printf("glGetTexImage\n");
