Multisampling & NV_render_to_texture

Hi,
I need to render scene to texture using multisampling and then to use that texture in
non-multisampling context.

I’m not able to find any pixel format with
multisampling and render_to_texture support
at the same time.

glCopyTexSubImage2D cannot be used because
contexts with different pixel format cannot
be shared.

I’m using NVIDIA Fx 5800 with 52.16 drivers

Any idea?
Appreciate your help.

RTT with a multisample p-buffer seems to be not supported on any card (unless someone knows different).

Duplicate your texture for each context. You probably have plenty of VRAM.

> glCopyTexSubImage2D cannot be used because
> contexts with different pixel format cannot
> be shared.

Definitely you can do glCopyTexSubImage2D from multisampled pbuffer to non-multisampling context.

How can I duplicate texture for second context?

As far as I know NVidia doesn’t support make_current_read extension.

Sharing texture objects among contexts is
posible only when both contexts have the same pixel format. Since multi sampling and non-multisampling buffers use different pixel format I cannot share them.

Try ‘simple_pbuffer’ example from nVidia SDK. Add ‘samples=2’ into pbuffer definition string and see the result - antialiased pbuffer will continue to work as texture for app. Sorry if this is not what you looking for, just this is as I understand your problem.

Why couldn’t you “copy” the texture into the other context by just doing a wglShareLists()?

it’s strange that RTT with a multisampling p-buffer doesn’t works, since that feature is avialable on direct3d and seems to works fine on a geForce2, according to:
http://www.flipcode.com/cgi-bin/msg.cgi?showThread=06-19-2003&forum=iotd&id=-1

All I need is to use that texture in NON-multisampling context.
I mean:

  • generate texture using multisampling
  • use texture without multisampling (for better frame rate)

Note:
glDisable(GL_MULTISAMPLE_…) in mutlisampling context doesn’t help (see specification).

>>>How can I duplicate texture for second context?<<<

On multisample context, render to framen buffer, copy it to a texture (I imagine this will be very slow).

Download to RAM via glGetTexImage

On non-multisample context, upload with glTexImage

>>>DX9a<<<

DX9a?
It uses stretchblit?
**** that!

Originally posted by nystep:
it’s strange that RTT with a multisampling p-buffer doesn’t works, since that feature is avialable on direct3d and seems to works fine on a geForce2, according to:
http://www.flipcode.com/cgi-bin/msg.cgi?showThread=06-19-2003&forum=iotd&id=-1

Actually, you can not do multisampling on a texture in D3D (CreateTexture lacks a multisamplequality field, unlike CreateRenderTarget). DX9.0a added the ability to copy a multisampled render target to a texture (DX9.0 used to refuse to do this, even though there’s no real problem with it).