View Full Version : (pre-)crop texture
10-02-2005, 11:26 AM
is there any way of cropping a texture (say use only 100x100 of an 128x128 texture) without modifiyng geometry's tex coords?
what i want seems kinda the same as add some prescaling for tex coords inside a texture objects' state, glcontext state or maybe TexEnv but not inside the geometry/vertex-shader attributes.
thanks & greets
10-04-2005, 01:32 AM
If your texture coordinates are in the 0.0 to 1.0 range for the 128*128 texture, use a texture matrix with a scale factor
100/128 0 0 0
0 100/128 0 0
0 0 1 0
0 0 0 1Be warned, you won't be able to get the border handling right on the non-zero text coords, unless you use nearest filtering.
Repeating the texture will also not work. You could do that in a fragment shader by calculating the wrapping yourself.
10-05-2005, 02:49 PM
i first made it obsolete by using NPOT rectangle textures but then figured out on radeon they are limited to be multiples of 32 in both axes leading to very strange results otherwise (damaged texture, if height don't match TRASHED geometry DAMN that was looking crazy!)
so i need to clamp to multiples of 32 and need the croping anyway...
thanks a lot
10-06-2005, 12:16 AM
on radeon they are limited to be multiples of 32 in both axes Really? Shocking. That sounds broken. :eek:
10-06-2005, 08:56 PM
Well, that was a driver bug in early FBO implementations, but it was fixed quite a while ago. It ought to be in public driver by now I think. The hardware definitely has no such limitation.
10-07-2005, 11:23 AM
ok, tracked it down to mod 32 for width and mod 8 for height :-)
some better now.. but still not solved.
my current driver is 6.14.0010.6561, about two months old, just one month older then the actuall released. the card is a X300 one.
now i try for newer drivers.
btw. i uploaded some example pics:
width NOT mod 32 results in this:
(the scene is rendered again by a low-res fullscreen quad NOT mod 32 for use of fragment shader post effect)
and, incredible strange, texture height of this NOT mod 8:
-with mod 8:
-likewise scene not mod 8:
http://hirnsohle.de/bild.php?url=pics/sc...WeltenMotor.png (http://hirnsohle.de/bild.php?url=pics/screens/noItsGettingReallyFunny.seltsamerGeheimerWeltenMot or.png)
kinda fun, huh?
thanks a lot
10-07-2005, 07:47 PM
Well, try the latest driver and I bet the bug is gone.
10-08-2005, 03:03 AM
You're right :-)
Yeah, its gone.
that proofs we're a real high tech commumity here :-) if something is older than a month its considered "absolutely outdated" and no one can complain about strange results...
thanks very much,
10-08-2005, 04:42 PM
You should try working for an IHV. For me things sometimes feel outdated before it has even reached the public. ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.