Non Power Of 2 Texture

I use the pbuffer as a non power of 2 texture with the texture_rectangle extension of nvidia.

Is there any other way to do pbuffer with non power of 2 sizes but to not use the nvidia extension?

Is there any other method to get the depth buffer contents into a texture (other than glReadPixels)?

Does glCopyTexImage2D support copying from the depth buffer?

Originally posted by powerpad:
[b]
Is there any other method to get the depth buffer contents into a texture (other than glReadPixels)?

Does glCopyTexImage2D support copying from the depth buffer?[/b]
yes you answered your question yourself. you can use glCopyTexSubImage2D to copy the contents of the depth buffer into a texture. on nv hardware i think you can even bind the depth buffer of a pbuffer directly as depth texture.

I bound the pbuffer to the depth buffer.

I was not able to find information in the msdn that says how the component could be copied by glCopyTexImage().

Is this a never possibility (via extensions)?

Then again, OpenGL is not part of Microsofts strategy, so don’t expect it to answer all your questions.

In addition to searching the web (or posting on this forum) the OpenGL 2.0 spec may be useful. It’s not easy to read though. But at least it’s available on the site.

To copy the content of the depth-buffer into a texture, the texture needs to be of the type DEPTH_COMPONENT (there is an extension ARB_depth_texture or so, which defines this). If the texture is of this type, then glCopyTexSubImage will automatically copy from the depth-buffer instead of the color-buffer.

Hope that helps,
Jan.

tnx for the help and I will read the spec for this extension

“Is there any other way to do pbuffer with non power of 2 sizes but to not use the nvidia extension?”

Sure, use the ARB extension GL_TEXTURE_RECTANGLE_ARB.

Also, to follow up on what was said above, you want to use something like…

glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT32_ARB , offsetX, offsetY, width, height, 0);

To copy from the depth buffer to a texture.

yes I found the depth buffer read and glCopyTex** in the relevant extension.

So there is a non NVidia extension that deals with this texture rectangle…
I read the paper by Chris Wynn and he covers (of course) only the NVidia site.

But how do I set up my pbuffer to support this non power of two texture since I define

WGL_TEXTURE_TARGET_ARB, WGL_TEXTURE_RECTANGLE_NV

but what is the non NVidia way for doing it …

Thanks for all your help.

Just create a pBuffer without the WGL_ARB_render_texture stuff. You don’t need it anyway if you’re going to do a glCopyTexImage2D().

There is no vendor neutral way to do this.
ATI has WGL_ATI_render_texture_rectangle. I have never used it, but maybe it’s like NV’s extension.

I have not used the Pbuffer + RendertoTexture. I prefer FBO . but util last month, nvidia’s dirver not surpport NPOT in FBO.