examples/Qt/ISFEditor/ISFEditor_app/Spout/SpoutGLDXinterop.cpp
//
// Draw shared memory via texture - equivalent to DrawSharedTexture
//

Draw shared memory via texture - equivalent to DrawSharedTexture
Draw shared memory via texture - equivalent to DrawSharedTexture
bool spoutGLDXinterop::DrawSharedMemory(float max_x, float max_y, float aspect, bool bInvert)
{
	unsigned int width, height;
	if(!memoryshare.GetSenderMemorySize(width, height))
		return false;
	unsigned char *pBuffer = memoryshare.LockSenderMemory();
	if(!pBuffer) return false;
	CheckOpenGLTexture(m_TexID, GL_RGBA, width, height, m_TexWidth, m_TexHeight);
		glBindTexture(GL_TEXTURE_2D, m_TexID);
		glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)pBuffer);
		glBindTexture(GL_TEXTURE_2D, 0);
	SaveOpenGLstate(width, height);
	glColor4f(1.f, 1.f, 1.f, 1.f);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, m_TexID);
	glBegin(GL_QUADS);
	if(bInvert) {
		glTexCoord2f(0.0,	max_y);	glVertex2f(-aspect,-1.0); 
		glTexCoord2f(0.0,	0.0);	glVertex2f(-aspect, 1.0); 
		glTexCoord2f(max_x, 0.0);	glVertex2f( aspect, 1.0); 
		glTexCoord2f(max_x, max_y);	glVertex2f( aspect,-1.0); 
	}
	else {
		glTexCoord2f(0.0,   0.0);	glVertex2f(-aspect,-1.0); 
		glTexCoord2f(0.0,   max_y);	glVertex2f(-aspect, 1.0); 
		glTexCoord2f(max_x, max_y);	glVertex2f( aspect, 1.0); 
		glTexCoord2f(max_x, 0.0);	glVertex2f( aspect,-1.0); 
	}
	glEnd();
	glBindTexture(GL_TEXTURE_2D, 0);
	glDisable(GL_TEXTURE_2D);
	RestoreOpenGLstate();
	memoryshare.UnlockSenderMemory();
	return true;
}
bool spoutGLDXinterop :: DrawSharedMemory ( float max_x , float max_y , float aspect , bool bInvert ) { unsigned int width , height ; if ( ! memoryshare . GetSenderMemorySize ( width , height ) ) return false ; unsigned char * pBuffer = memoryshare . LockSenderMemory ( ) ; if ( ! pBuffer ) return false ; CheckOpenGLTexture ( m_TexID , GL_RGBA , width , height , m_TexWidth , m_TexHeight ) ; glBindTexture ( GL_TEXTURE_2D , m_TexID ) ; glTexSubImage2D ( GL_TEXTURE_2D , 0 , 0 , 0 , width , height , GL_RGBA , GL_UNSIGNED_BYTE , ( GLvoid * ) pBuffer ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; SaveOpenGLstate ( width , height ) ; glColor4f ( 1.f , 1.f , 1.f , 1.f ) ; glEnable ( GL_TEXTURE_2D ) ; glBindTexture ( GL_TEXTURE_2D , m_TexID ) ; glBegin ( GL_QUADS ) ; if ( bInvert ) { glTexCoord2f ( 0.0 , max_y ) ; glVertex2f ( - aspect , -1.0 ) ; glTexCoord2f ( 0.0 , 0.0 ) ; glVertex2f ( - aspect , 1.0 ) ; glTexCoord2f ( max_x , 0.0 ) ; glVertex2f ( aspect , 1.0 ) ; glTexCoord2f ( max_x , max_y ) ; glVertex2f ( aspect , -1.0 ) ; } else { glTexCoord2f ( 0.0 , 0.0 ) ; glVertex2f ( - aspect , -1.0 ) ; glTexCoord2f ( 0.0 , max_y ) ; glVertex2f ( - aspect , 1.0 ) ; glTexCoord2f ( max_x , max_y ) ; glVertex2f ( aspect , 1.0 ) ; glTexCoord2f ( max_x , 0.0 ) ; glVertex2f ( aspect , -1.0 ) ; } glEnd ( ) ; glBindTexture ( GL_TEXTURE_2D , 0 ) ; glDisable ( GL_TEXTURE_2D ) ; RestoreOpenGLstate ( ) ; memoryshare . UnlockSenderMemory ( ) ; return true ; }
Draw shared memory via texture - equivalent to DrawSharedTexture
Draw shared memory via texture - equivalent to DrawSharedTexture
// Get the memoryshare size
 // Find the shared memory buffer pointer
 // Create or resize a local OpenGL texture
 // if(IsPBOavailable()) {
 // LoadTexturePixels(m_TexID, GL_TEXTURE_2D, width, height, (const unsigned char *)pBuffer, GL_RGBA);
 // }
 // else {
 // }
 // Draw the texture
 // lower left
 // upper left
 // upper right
 // lower right
 // lower left
 // upper left
 // upper right
 // lower right
