Feature Request: Scaling of Textures/images

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
darC
Posts: 6
Joined: Tue Aug 30, 2005 6:58 am
Location: bangalore
Contact:

Feature Request: Scaling of Textures/images

Post by darC »

It would be very helpful if there was a scale() function for ITexture.

so that when it is set as a image for an object it can be scaled as the object size changes.

even for a splash screen image. i have to have different images for different resolutions.

finaly:the work would be simplified if there was a scale function in ITexture.
there are 10 kinds of people in this world,
one who can read binary and one who cant.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

you should never scale your texture. The hardware does it for you when you render it to something based on Texture Coords. I'd read more about 3D and Texture Coords before continuing with this post
Image
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

I made this GUI skin thing that implements IGUISkin by drawing scaled images.

http://irrlicht.sourceforge.net/phpBB2/ ... sc&start=0


The drawing code is a bug fixed version of this code:

http://www.irrforge.org/index.php/Playi ... h_Irrlicht


Spintz is right. As a 3D engine Irrlicht already supports scaling & rotation 'out of the box'. A flat, 2D image could be called a BillboardSceneNode :). Then you would just set the BillboardSceneNode's scale via IBillboardSceneNode->setScale() function, although you'll have to do some math (or steal mine) if you want to setScale to an exact pixel size.

If you play with the 09.meshviewer example, there is a 'set scale' text box. Try changing the scales to values other than 1.0 and see how the mesh changes.

A 2D image would just be a one rectangle 'mesh' that always faces the camera (orthogonal).

Maybe the 'AnimatedSpriteSceneNode' class should be included as a part of Irrlicht so that people will have a simple way to do 2d scaled images?
darC
Posts: 6
Joined: Tue Aug 30, 2005 6:58 am
Location: bangalore
Contact:

Post by darC »

Thank you for the feedback.

am looking into Texture coords and buzz machine DLL.
there are 10 kinds of people in this world,
one who can read binary and one who cant.
Guest

Post by Guest »

one thing I have found switching from using screenspace 2d Using Draw2DImage to using the flexible emil/zenaku code is that my graphics look rougher around the edges. Before with draw2dimage or guielement draws the alphablending of the edges of my textures used as osi elements were ultra smooth (of course they didn't scale properly and then looked like crap) - but they were perfect at native res.

Now, even at native res, it seems the edges are rougher, the alpha blend is not as smooth, maybe it's the vertex/texture mapping as it is used: 0-1 instead of the "notorious" 1:1 texel/screen mapping which uses a -0.5 offset (can't remember the details now). If not, what else could it be, any ideas what draw2Dimage does differently to keep those edges smooth? setFilter stuff (linear instead of point for example)??

cheers
Post Reply