How to zoom ITexture to 1:1 pixel size? [Solved]

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Nyxojaele
Posts: 98
Joined: Mon Sep 18, 2006 4:06 am

How to zoom ITexture to 1:1 pixel size? [Solved]

Post by Nyxojaele »

Any ideas on how I might go about zooming an object (the scale of said object can be changed if need be) on screen in such a way that the texture on the object is displayed at a 1:1 texel:pixel size ratio?

I'm aware that you could use IVideoDriver::draw2DImage to achieve that, but I'm working on an advanced graphical editor that needs the ITexture to be displayed on an IMesh in order to achieve many of the features/effects being used elsewhere, so I'm looking for a way to just position/scale that ISceneNode, or perhaps the ICameraSceneNode in such a way so as to achieve my desired result.

Any thoughts?
Last edited by Nyxojaele on Wed May 06, 2009 4:47 am, edited 1 time in total.
Nyxojaele
Posts: 98
Joined: Mon Sep 18, 2006 4:06 am

Post by Nyxojaele »

So for anybody interested, what I ended up doing was switching the camera to orthogonal mode, then it was simple:
  1. Set the ISceneNode up with a custom Mesh (a flat mesh 1 unit x 1 unit in size).
  2. Scale the custom mesh to the dimensions of the texture.
  3. Set the camera's orthogonal viewable dimensions to the physical dimensions of the window irrlicht is rendering in.
  4. Voila, texture rendering at pixel perfect size. Zoom in/out by changing the camera's viewable dimensions.
Post Reply