🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Find out if sampler2DRect is supported?

Started by
4 comments, last by lc_overlord 17 years, 11 months ago
Hi, is there a way to find out if the Graphiccard supports the sampler2DRect in GLSL? And is there any way to use GL_TEXTURE_RECTANGLE_ARB Textures in a Shader on ATI Cards? Aya~
I aim for my endless Dreams and I know they will come true!
Advertisement
sampler2DRect should work if the card supports GL_ARB_texture_rectangle.
To check if it does download lesson 45, in there you will find a function called "IsExtensionSupported" add that to your code and use it with the string "GL_ARB_texture_rectangle".
The function will then return true if the extention is supported on your card.

Regarding ATI cards, yes using the above way, but acording to the delphi 3D harware regestry ATI does not support that extention, but they do support GL_EXT_texture_rectangle witch is the same extention.
Hi,

thanks for your reply.

All machines with ATI Cards I tested hat no problems with the GL_ARB_texture_rectangle Extension, but noone of the ATI Cards were able to use the Texture in a GLSL Shader..

I tried both variants:
uniform sampler2DRect tex;
uniform samplerRect tex;

Both didn't work on ATI Cards..
So I thought I could check if this GLSL function is supported.


Aya~

I aim for my endless Dreams and I know they will come true!
I found out why in the GL_ARB_texture_rectangle spec

Quote: Functionally identical to EXT_texture_rectangle and
NV_texture_rectangle extensions currently shipping, except for
the additions to the OpenGL Shading Language.


ATI only supports EXT_texture_rectangle, all the functions are identical to ARB_texture_rectangle and thus it will also work with the opengl commands for ARB_texture_rectangle defined in glext.h, they all have the same numbers and so on.

Exept for one thing, the additions made to the OpenGL Shading Language for ARB_texture_rectangle, specificly sampler2DRect.
There are lot's of ways around this problem, one of them is ARB_texture_non_power_of_two and another is to resize the textures to a power of two, it depends a little on what you are using it for.
If you tell me then i might help you.
Hi,

I need to display Images (can be any size) in a lossless quality to do calculations on them via GLSL.

So I can't just resize them to a power of two texture.. :(

How does ARB_texture_non_power_of_two work?? And, does it work with ATI and GLSL too?

Aya~
I aim for my endless Dreams and I know they will come true!
well ARB_texture_non_power_of_two works just like any other texture with the exception that you can use any size you want, it works perfectly well with GLSL.
But there is one problem, it only works on Geforce 6 and above and not on ATI(this is one of the reasons i only use NVIDIA cards on my dev comp).

The only failsafe way of doing this is to make a power of two texture that is equal or larger than the size that you need to load, then pad it with the color black or any useful color(do as you want), then use the UV coords to crop the texture to the correct size.

If you only need to use nearest filtering you can chop up the image into smaller bits that will fit the size better, it makes the whole thing more complex, but it can be made to work.

This topic is closed to new replies.

Advertisement