PBuffers and pixelformats

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… :frowning:

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

The copy part seems to work… I´ve 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…

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.

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.
" );
exit( -1 );
}

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

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

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).

>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?