Problems with Offscreen rendering
Hi,
i have tried to render offscreen to a texture and use it late but it seems it doesn´t work. I call this method at the end of the GLInit function.
RenderToTexture(){
TerrainTexture = EmptyTexture();
glViewport(0,0,256,256); // Set Our Viewport (Match Texture Size)
glEnable(GL_TEXTURE_2D); // Enable 2D Texture Mapping
RenderHeightMap(); // Render The Helix
glBindTexture(GL_TEXTURE_2D,TerrainTexture); // Bind To The Blur Texture
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 256, 256, 0);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And Depth Buffer
glViewport(0 , 0,640 ,480);
maybe somebody knows whats wrong. Ok here the code which is executed at the drawing method.
glBindTexture(GL_TEXTURE_2D,TerrainTexture); // Bind To The Blur Texture
glColor3f(0.5f,0.5f,1.0f); // Set The Color To Blue One Time Only
ViewOrtho();
glBegin(GL_QUADS); // Begin Drawing Quads
glTexCoord2f(0,1); // Texture Coordinate ( 0, 1 )
glVertex3f(0,0,-1); // First Vertex ( 0, 0 )
glTexCoord2f(0,0); // Texture Coordinate ( 0, 0 )
glVertex3f(0,480,-1); // Second Vertex ( 0, 480 )
glTexCoord2f(1,0); // Texture Coordinate ( 1, 0 )
glVertex3f(640,480,-1); // Third Vertex ( 640, 480 )
glTexCoord2f(1,1); // Texture Coordinate ( 1, 1 )
glVertex3f(640,0,-1); // Fourth Vertex ( 640, 0 )
// Gradually Decrease alpha (Gradually Fading Image Out)
glEnd();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement