Advertisement

Clearing Buffer

Started by January 29, 2004 12:50 PM
4 comments, last by mayhem79 21 years, 1 month ago
Hello, I have designed a program to do some very CPU intensive image processing algorithms using my Graphics card via OpenGL. These are done and then are rendered doing a screen grab, this workd fine with - ShowWindow(hWnd,SW_SHOW); however I wish not to show the window, so have modified it to - ShowWindow(hWnd,SW_HIDE); Now it seems that the grpahics memory does not clear properly, every time this program is executed there are reminants from the previous calls in are in the memory, giving the exported image a type of JIg-Saw effect, with the older renders behind the newer ones. I have already experimented with - glClearColor(0.0f, 0.0f, 0.0f, 0.5); glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ACCUM_BUFFER_BIT | GL_STENCIL_BUFFER_BIT ); However it does not seem to be implemented if the the window is not shown... Any ideas? [edited by - mayhem79 on January 29, 2004 2:01:37 PM]
If you want to render to an image, you should use the PDF_DRAW_TO_BITMAP pixel format descriptor flag.

Check out this article at MSDN.
Advertisement

Is it common to render a scene to a DIB (bmp) & modify that pic before you display it? I instantly think of cool effects like bending/warping as if you are looking through a special lense, or maybe even placing an entity in the scene that is invisible & bends the light around it, like the PREDATOR or something cool like that. Has anybody done this or played around with something like that????

Also, would using the PDF_DRAW_TO_BITMAP flag for one frame be better or worse than copying the backbuffer with glCopyTexSubImage2D() for taking a screen shot???? pros/cons???

thanks

Whatsoever you do, do it heartily as to the Lord, and not unto men.
I would expect that the overhead of copying the resulting dib to the screen would make this technique impractical for a real-time application. It might be good enough for a screensaver though...

As for screen shots, it''s probably easier just to use glCopyTexImage2D. Otherwise, you have to create and maintain two separate render contexts for the off-chance that someone wants to take a snapshot.

I''ll try it out sometime next week on one of my programs & let you know if the FPS drops much. Thanks for that link
Whatsoever you do, do it heartily as to the Lord, and not unto men.
If you use DIB rendering, you will get microsoft software rendering - this should redefine the meaning of "framerate drop" ! (as well as put you back in the opengl 1.1 world).
You should use the pbuffer extension, and the bind-to-texture extension to keep everything in GPU memory. Should be about, let''s think, 100 times faster ?

This topic is closed to new replies.

Advertisement