Stretching Textures

Started by Evil-Devil, February 02, 2006, 18:17:44

Previous topic - Next topic

Evil-Devil

Hi,
I`d like to stretch some of my texture i.e. for GUI design.

But to achive that? When i display a small texture on a large field the texture looks odd. I like to have it look like the small version but fitting to the needed size.
Ya know the actual UT2004? Some GUI graphics are only 128*128 and are stretched to screensize but the visual of the texture isn't affected. Each pixel near the borders are as they are at 1:1 and only the inner seems to be stretched. How to achieve this effect?

Does I have to go through all pixels and see if the current pixel has the same color as the last and can add an additional one? And if there are differences i have to left them unchanged?

Hope that someone know how to fix that.

Benny

CaseyB

Try calling GL11.glTexParameterf() with GL11.GL_NEAREST, that will cause the stretched image to use the nearest color instead of trying to blend it.  It may look pixelated, but you can get around this with some creative design!

Evil-Devil

I allready use GL_NEAREST :(

And it shall not look pixelated. I want my xSize*ySize Texture to appear stretched like it were created at the screen resolution of the user ones.

I know that this can't be achieved allways, but somehow the guys at epic did that effect.

jam007

I probably have missunderstood your problem but....
Should not creative use of polygones (rectangles) solve the stretching.
In texture: x=0 to 47 left border, x=80 to 127 right border. Center area uniform colour.
polygones: x=0 to 47 left border rectangle; x=48 to sizex-48 center rectangle; x=sizex-47 to sizex right border rectangle. for all rectangles y=48 to sizey-48. Texture coordinates for the corners set to fit the above texture.
Similar for corners and upper lower border.

Anders M

Evil-Devil

Yea, this way with 9 quads or 18 triangles i also realized after sniffing through the unrealscript code again...and after discussing the question in another forum too.

I hoped there were another way :(

But thanks for the replies :)