[Solved] Widget backgrounds seem to be offset

Apostate

27-07-2012 02:07:18

I'm using OpenGLPlatform with an engine I'm writing and I finally got stuff drawing, but now it looks like the background images for each of my widgets is offset. Pretty sure the texture is loading fine, but I'm guessing I'm doing something wrong with the resource files or something.

I copied the MyGUI_3.2.0\Media\MyGUI_Media folder to ./data/ui/MyGUI and called the function below:

m_platform->getDataManagerPtr()->addResourceLocation("./data/ui/MyGUI", false);


Here's a screenshot (click for bigger). My mouse is hovering over "Test Editbox", otherwise it just has no background at all. The other two are buttons of different sizes.


Any ideas what I'm doing wrong?

Altren

28-07-2012 21:46:28

Well, actually it looks like something wrong with texture, because when something is wrong with resources you can't see anything, it never might cause behavior you got.

I guess texture loader either got wrong size/position, or loaded it with offset somehow.
Try to do next tests:
Create squared ImageBox and set some squared texture on it (setImageTexture(...)) to see if it have offsets, scaled or something else.
Create same ImageBox, but also set to load half of texture (imageBox->setImageCoord(0, 0, imageWidth, imageHeight/2))

Apostate

29-07-2012 05:06:52

Well, it became really obvious what was wrong after I added the ImageBoxes. Apparently the texture data needed to be flipped vertically. I've had that problem before, i don't know why I didn't think of it earlier. At least it works now :D Thanks for the help.