PDA

View Full Version : PBuffer



Frenz
12-03-2002, 06:13 AM
Hy,I have some problems using the PixelBuffer for creating dynamic reflection..the generated texture is white! http://www.lib.unimib.it/students/bianchifr/3d/pbuffer.jpg

Here's my code:

// Enable Pixel Buffer
wglMakeContextCurrentARB( PBuffer.hdc , PBuffer.hdc , hglrc); // Init
glDrawBuffer( GL_FRONT );
glReadBuffer( GL_FRONT );
glViewport(0.0, 0.0, PBuffer.width, PBuffer.height);

// Render della scena...
..Draw...

// Bind Texture
glEnable( GL_TEXTURE_2D );
glBindTexture(GL_TEXTURE_2D, EnvTexture);
wglBindTexImageARB( PBuffer.hpbuffer , WGL_FRONT_LEFT_ARB);
wglReleaseTexImageARB(PBuffer.hpbuffer, WGL_FRONT_LEFT_ARB);

// Restore hDC
wglMakeContextCurrentARB( hDC, hDC , hglrc);
glDrawBuffer(GL_BACK);
glReadBuffer(GL_FRONT);
glViewport(0.0, 0.0, ScreenX, ScreenY);

// Render dell'oggetto con la texture
glBindTexture(GL_TEXTURE_2D, EnvTexture);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

\\Render dell'oggetto

glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);


Thanks nad sorry for my english http://www.opengl.org/discussion_boards/ubb/smile.gif
Frenz