PDA

View Full Version : ATI equivalent of TEXTURE_RECTANGLE



razor
10-13-2002, 12:58 PM
Hey all,

I would like to declare a pbuffer that is not of size 2^n by 2^n on a Radeon 9700. On nvidia hardware i would use the TEXTURE_RECTANGLE_NV extension, but i can't fins an equivalent one for ATI. Does anyone have any pointers as to the extension to use, or anything else that can help me.

Thanks

PH
10-13-2002, 01:34 PM
EXT_texture_rectangle. I've used that on Radeon 8500. I'm sure it'll appear on NV hardware too.

PH
10-13-2002, 01:39 PM
A link to the spec,
http://developer.apple.com/opengl/extensions/ext_texture_rectangle.html

Since Mark Kilgard is the contact person, it'll definitely appear on NV hardware ( if not already there ).

Edit:
I just checked the #define's are identicle to the NV version.

[This message has been edited by PH (edited 10-13-2002).]

Humus
10-13-2002, 02:26 PM
Hmm ... checking glATi.h (http://www.ati.com/developer/sdk/RadeonSDK/Html/Info/Extensions/glATI.h) on ATi's site I found this:

#define GL_TEXTURE_RECTANGLE_EXT 0x85B3
#define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x85B4
#define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x85B5
#define GL_MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x85B6

Your link shows
TEXTURE_RECTANGLE_EXT 0x84F5
TEXTURE_BINDING_RECTANGLE_EXT 0x84F6
PROXY_TEXTURE_RECTANGLE_EXT 0x84F7
MAX_RECTANGLE_TEXTURE_SIZE_EXT 0x84F8

which is the same as in the NV extension. I haven't used any of them so I don't know, but I found this out when I saw the EXT version in the extension string of my 8500, and I though that the EXT was a new one which maybe relaxed some of the restrictions of the NV version. Looking at that apple page though it seams that the spec looks very legit and isn't just a cut'n'paste from the NV spec, so I guess it's just a error in the wglATi.h.

PH
10-13-2002, 02:50 PM
Strange. You're right, they don't match ( the NV and EXT versions should be equivalent according to the apple spec ). There's a version of the spec on ATIs site here,
http://www.ati.com/developer/proginfo.html
The pdf a bit down the page: "ATI OpenGL Supported Extension List".

So, it seems they are not entirely identicle !? Well, the EXT constants work at least http://www.opengl.org/discussion_boards/ubb/smile.gif.

PH
10-13-2002, 02:54 PM
Hmm, the apple spec has a newer date!!

Note, I tried the EXT version some time ago ( before it was in the extension string ), so it might have changed since then ( looks like it )... I'll have to try it out again.

PH
10-13-2002, 03:12 PM
Ok, the NV constants are the ones that are valid now. It works as expected on the 8500 but it messes up my font ( I'll have to checl if this is my bug ).

Edit:

Looks like there's a bug in glCopyTexSubImage2D with texture_rectangle on 8500. The copy is fine but it apparently writes into other textures memory.

[This message has been edited by PH (edited 10-13-2002).]

razor
10-13-2002, 08:30 PM
How would i go about using it for the declaration of the pbuffer though?

Currently i choose the attributes as follows:

// set some pbuffer attributes so that we can use this pbuffer as a
// 2D RGBA texture target
int pAttrib[] =
{
WGL_TEXTURE_FORMAT_ARB,
WGL_TEXTURE_RGBA_ARB,
WGL_TEXTURE_TARGET_ARB,
WGL_TEXTURE_2D_ARB,
0
};

// create the pbuffer
hPBuffer = wglCreatePbufferARB(hGLDC, pixelFormat, width, height, pAttrib);

if(!hPBuffer)
{
printError("P-buffer Error: Unable to create P-buffer");
}

The problem is that as expected the call will fail if width and height are not powers of two. How would i use TEXTURE_RECTANGLE_EXT instead?

razor
10-13-2002, 08:41 PM
This is to supplement my last post.

I can't find a WGL_TEXTURE_RECTANGLE_EXT or anything similar in the header files from ATI, whereas the nvidia header files does have this.

Thanks

James Dolan
12-13-2004, 12:59 PM
I was recently looking for a solution for this. The solution I came up with was to simply make my pbuffer the next power of 2 greater than what I needed and use glViewport() to render only small region of the pbuffer.

Example:

wglCreatePbufferARB(blah, blah, 1024, 512, blah);
...
wglMakeCurrent(blah, blah);
glViewport(0, 0, 640, 480);

Anyways, works like a charm. I suspect the various RECTANGLE extensions basically do the same thing under the hood. Anyways, I found really no good solution online so I thought I would share mine.

Sunray
12-13-2004, 02:28 PM
In ATI Catalyst 4.12 beta there is an extension called WGL_ATI_render_texture_rectangle. But there is no documentation about it. I'm sure it's just a constant, like WGL_TEXTURE_RECTANGLE_NV. I havn't tried it though...