About Store Forum Documentation Contact



Post Reply 
image_back texture distorted
Author Message
rndbit Offline
Member

Post: #1
image_back texture distorted
i use dynamically created Image object as image_back for Window.
both texture and window is of same size (window size is set to be D.pixelToScreenSize(texture_x, texture_y)).
now when back_fit=true then picture looks perfectly fine:
[Image: goodb.png]

but when back_fit=false then image becomes distorted like this:
[Image: badrp.png]

should not image of same size as window cover entire back of the window without distortions?

EDIT:
looks like if back_fit=false then image_back is squeezed into a square image and distorted. image_back completely does not respect size of texture.
(This post was last modified: 06-09-2011 11:01 AM by rndbit.)
06-08-2011 11:21 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: image_back texture distorted
Use back fit

If it's not enabled it works by stretching the image so you can have tiled wrapped background- load some GUI style from erpg2 in GUI editor to some window and resize the window you will see how it works. This stretching assumes image is square so you see that non uniform stretch effect
06-09-2011 11:03 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #3
RE: [bug] image_back texture distorted
why image is assumed to be square? maybe its just me, but it seems much more logical that it would be tiled while taking image size into account. would be cool if there was ability to tile image of size that it really is. also would be even better to just be able to have image of its size sitting in top left corner and not tile it. it would solve some window resizing problems when working with 3rd party GUI library.
06-09-2011 07:18 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: [bug] image_back texture distorted
will be in next SDK: "-Image::drawTile and GuiStyle::image_back will now use image aspect information when drawing the tiled image"
06-10-2011 12:50 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #5
RE: [bug] image_back texture distorted
Thank you. Could you also add option to not tile image, just have one copy of it at top left corner too? No rush, but would be nice to have sometime.
06-10-2011 12:58 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #6
RE: [bug] image_back texture distorted
uhm why now it does respect only texture aspect ratio but not texture size? it produces images that are sort of blurred a bit.. not sharp-looking.
06-16-2011 08:11 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: [bug] image_back texture distorted
You need to set correct Tex scale
1 uv is used for 1 screen unit by default
If backfit worked correctly then just use it
06-17-2011 11:58 AM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #8
RE: [bug] image_back texture distorted
oh scale i see. i will try playing with it. thing is that using back_fit has some glitches when resizing window. in example if window size becomes smaller than actual texture size then instead of texture edges that are outside of window frame being invisible whole texture starts becoming transparent, thats why i try to avoid back_fit.
06-17-2011 12:05 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #9
RE: [bug] image_back texture distorted
well this still behaves somehow odd. idea is to have background image at the top-left corner, ideally it should not tile but as i understand at least for now this kind of thing is not supported. i did test the scale property. i found scale constant 1.168f that made my window look perfect.
http://img850.imageshack.us/img850/4679/...bfb538.png

but as soon as i resized my window it is displayed incorrectly, even if back_image is correct (exported image on the right)
http://img823.imageshack.us/img823/5892/...5cbdd7.png

so how this all works? why image can not just remain of static size when rendered on window background?
07-20-2011 10:02 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #10
RE: image_back texture distorted
if you resize the window, shouldn't you resize also the texture size (pixels) and/or texture coordinates scale?
07-23-2011 01:20 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #11
RE: image_back texture distorted
that is what i do. if you see second screenshot - image opened in irfan view is exported back_image of the window on the left. so back_image is of correct size, but displayed incorrectly. this is probably due to scaling of back_image, but i have no clue how that system works thanks to no docs. or maybe its another bug?
07-23-2011 03:38 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: image_back texture distorted
1 uv is used for 1 screen unit by default
what's your code? for both cases (screens)

Code:
v[0].pos.set(rect.min.x, rect.max.y);
      v[1].pos.set(rect.max.x, rect.max.y);
      v[2].pos.set(rect.min.x, rect.min.y);
      v[3].pos.set(rect.max.x, rect.min.y);
      Flt w=rect.w()*tex_scale,
          h=rect.h()*tex_scale*aspect();
      v[0].tex.set(0, 0);
      v[1].tex.set(w, 0);
      v[2].tex.set(0, h);
      v[3].tex.set(w, h);
this is pseudo-code for the drawing code
v[4] are vertexes
07-27-2011 01:01 PM
Find all posts by this user Quote this message in a reply
rndbit Offline
Member

Post: #13
RE: image_back texture distorted
uh? what drawing code? there is no special drawing code. we are talking about back_image of a window, so GUI system does all the drawing.
07-27-2011 04:44 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: image_back texture distorted
I've posted the code from EE gui system back_image drawing, so you now know how it works
08-06-2011 01:12 PM
Find all posts by this user Quote this message in a reply
Post Reply