Hi,
is it possible to use rectangular textures in Irrlicht?
I'd like to use sample2DRect and texture2DRect in my GLSL shader, but texture coordinates seem to be floats in [0,1]x[0,1] instead of integers in [0,texWidth]x[0,texHeight].
I saw in the Irrlicht source code, that textures are always bound by GL_TEXTURE_2D, but GL_TEXTURE_RECTANGLE_ARB seems never been used, is that right?
rectangular textures
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
That's correct. We don't have support for this extension, and the hope was that NPOT support would become so good that it wouldn't be needed. I guess you'd have to create a new texture creation flag and signal usage of the extension that way. Can you provide an example application which uses Irrlicht's existing API and add comments to the places where you'd like to use a different way? I guess that 3d support at least could be feasible, the 2D and GUI parts are likely to support it less easily.
I took the XEffects project by BlindSide (see http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=30631) and wanted to replace SSAO by the way Unity engine does it.
Download my project at
http://rapidshare.com/files/411909598/S ... _forum.zip
It's still in development...blurring is commented out e.g. Maybe there's still a problem with depth and normal encoding/decoding from a single texture.
See SSAO.glsl for the pixel shader, in which I'd like to use a rectangular texture and integer texture coordinate access.
Download my project at
http://rapidshare.com/files/411909598/S ... _forum.zip
It's still in development...blurring is commented out e.g. Maybe there's still a problem with depth and normal encoding/decoding from a single texture.
See SSAO.glsl for the pixel shader, in which I'd like to use a rectangular texture and integer texture coordinate access.
Re: rectangular textures
I'm not sure if you understand texture coordinates !?!?!drhenry wrote:but texture coordinates seem to be floats in [0,1]x[0,1] instead of integers in [0,texWidth]x[0,texHeight].
well, just in case:
yes, they go from 0.0 to 1.0 !!!
this is a percental value, where 1.0 is 100%
so you would use something like this:
Code: Select all
// get texture coordinate from pixel
f32 toX = texX / texWidth;
f32 toY = texY / texHeight;
// get pixel from texture coordinate
u32 texX = toX * texWidth;
u32 texY = toY * texHeight;while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:

http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: rectangular textures
Just in case you never heard aout teh rectangular texture handling on gfx cards: This is an extension that was developed somewhat before full NPOT handling. It allows to use a texture with arbitrary ratio, but without tiling (and also with some other restrictions). The thing is, that you have to use non-normalized texture coords. That's why a lot of additional stuff needs to happen in the texture classes and in the render methods.Acki wrote:I'm not sure if you understand texture coordinates !?!?!drhenry wrote:but texture coordinates seem to be floats in [0,1]x[0,1] instead of integers in [0,texWidth]x[0,texHeight].
well, just in case:![]()
Use google if you need to know more.