PDA

View Full Version : PBuffers and pixelformats



dntoll
04-01-2003, 11:42 PM
Hi
While working on my little engine I want to use pbuffers for offscren rendering to textures...

After downloading a few tutorials from NVIDIA and read through a few papers I got to work, trying to implement pbuffers in my shaders...

No success... :-(

I copy the rendered result to a texture and rendered the result, pitch black!

The copy part seems to work... Ive copied parts of the back-buffer and that worked... But thats no fun...

The code in the tutorial works...in the tutorial but not in my framework...

My guess is that my framework, containing old code which does not use wglChoosePixelFormatARB, is the one causing me trouble?
//FrameWork Code
//Context creation
if (!(PixelFormat=ChoosePixelFormat(m_hDC,&pfd)))
{
}
if(!SetPixelFormat(m_hDC,PixelFormat,&pfd))
{
// Return FALSE
}

The pbuffer is created using NVIDIAs code pbuffer with wgl...

So what i wonder is if anyone else have had these problems?
Or stumbled on a solution?

yours...

roffe
04-02-2003, 01:45 AM
Originally posted by dntoll:

My guess is that my framework, containing old code which does not use wglChoosePixelFormatARB, is the one causing me trouble?


I would think so too. A piece of advise, before you start coding up a new pixel-format-selector function(with wglGetPixelFormatAttribivARB) run NV Pixel Format and select the pixel format you want and hard code it into your app for now. Later when things work, you can do the "maintenance" work. Some people do it the other way around though.

dntoll
04-02-2003, 03:05 AM
hmm i get ERROR_INVALID_WINDOW_HANDLE
when i run GetLastError() after this code...
seems to happen just once... =) ???

if ( !wglMakeCurrent( myDC, myGLctx ) )
{
fprintf( stderr, "PBuffer::MakeCurrent() failed.\n" );
exit( -1 );
}

But the same thing happen when i run the tutorial... argh!

[This message has been edited by dntoll (edited 04-02-2003).]

rgpc
04-03-2003, 02:03 AM
This same error has been observed before and can probably be ignored (driver bug I think).

http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008470.html

I would recommend that you try using wglChoosePixelFormatARB(). I would also recommend you don't get your hopes up too much with respect to using pbuffers. They are quite slow on nVidia hardware (although I haven't tried the latest drivers) and you will most likely get better results with using the Back buffer (but by all means give pbuffers ago as it's a useful learning experience if nothing else).

dntoll
04-04-2003, 02:25 AM
>you will most likely get better results >with using the Back buffer

ok... But if i want to create textures on the fly without destroying the content of the backbuffer?