createImage("qgui.myimage.png") broken. [solved]

Chaster

18-01-2008 13:23:49

UPDATE: Turns out I was misinterpreting the constructor argument (it's the name of the widget, not the name of the texture)..
---------------------------------------------
I realize this is probably user error, but I, for the life of me, can't get a custom image via createImage

I'm doing:

myImage = sheet->createImage("qgui.myimage.png");

and it always gives me the default (QuickGUI logo) image. I have deleted the skinset and skinset.qgui.png files (and they regenerated WITH my new image in there). So, I know the skinset is okay..

Also, I tried just using an existing image from within the skinset (sheet->createImage("qgui.textbox.png") ) and that didn't work either.

Can y'all give me a clue?

Chaster

kungfoomasta

18-01-2008 18:02:03

Hey Chaster, your code sample suggests you're using an older version of the library. I haven't been able to release v0.9.7 yet, but can you grab either the latest from SVN, or the v0.9.7 pre release zip? (in sticky thread)

Let me know the problems you encounter with these recent versions.

Chaster

18-01-2008 18:49:41

Odd, I thought I was using the 0.9.7 pre-release (I am using the zip which unzips to the directory "QuickGUIv0.9.7PreRelease").

harumph.. I'll try the SVN version I guess...

Chaster

Chaster

18-01-2008 19:44:59

Okay, this is feeling more and more like a bug in QuickGUI..

I got the latest version from SVN, compiled it and tried my code with it (had to make a few minor changes because of the new singleton interface, but that's nothing to do with my problem I think).

Result: no change.

So, I decided to see if I could duplicate the problem in the QuickGUIDemo. Yup, I can.

Here's what I did:

1) In QuickGUIDemo.h, replace this line (405):

QuickGUI::Image* logoImage = mSheet->createImage();

with this:

QuickGUI::Image* logoImage = mSheet->createImage("qgui.checked.png");

That should replace the default logo with the "qgui.checked.png" image (which is a checkbox with a check mark in it). On my machine, I get no change - it stays the same (i.e. the QuickGUI logo).

Any ideas?

Chaster

kungfoomasta

19-01-2008 00:25:30

Image* Panel::createImage(const Ogre::String& name)

The arguement you are giving is not the name of the texture, but the name of the widget.

With 0.9.7 we no longer use textures, but materials. For the Sheet and Image you can call setMaterial. I will add a convenience method for textures, but for now you can just make a material with the texture and use that.

Chaster

19-01-2008 02:01:53

Ah. I see. Will using setMaterial still make use of the Texture atlas? Or will it be a performance hit?

Also, I guess this is an opportunity to make the all-too-common request for documentation... (but I sympathize with you on that topic... I know how hard it is to do documentation for a project which is still rapidly changing..)

Thanks for the help KungfooMasta,

Chaster

kungfoomasta

19-01-2008 03:12:14

Yah, documentation is needed, and the wiki could use an update. I'll probably update the wiki before the next big release.

Setting the material will add 1 to the batch count. The SkinSet (texture atlas) is wrapped in a material, which is how Skins work. If all the widgets use the same skin, a minimal number of batches are created for rendering.

If you have a lot of unique images, you could create a SkinSet with all the images, and use the "setSkinComponent" function to set their appearance.

mySkinset.image.png
mySkinset.image1.png
mySkinset.image2.png

You could then do something like

image1->setSkinComponent(".image1");
image2->setSkinComponent(".image2");

By default the Skin Component of an Image widget is ".image".

I'm open to suggestions for improving how Skinning works.

mr.Zog

19-01-2008 08:55:40

a question at this point: I remember there has been a discussion about double-ing the skinset texture automatically if the dimension isn't big enough.

sorry for the question (been quite busy lately and somehow lost track of the current enhancements), but is this feature already implemented?

otherwise I think one could get trouble when using multiple (e.g. background) images in one skinset if the texture is set to 1024x1024 or maybe if one image exceeds this dimension.

Chaster

22-01-2008 05:45:24

Yah, documentation is needed, and the wiki could use an update. I'll probably update the wiki before the next big release.

Setting the material will add 1 to the batch count. The SkinSet (texture atlas) is wrapped in a material, which is how Skins work. If all the widgets use the same skin, a minimal number of batches are created for rendering.

If you have a lot of unique images, you could create a SkinSet with all the images, and use the "setSkinComponent" function to set their appearance.

mySkinset.image.png
mySkinset.image1.png
mySkinset.image2.png

You could then do something like

image1->setSkinComponent(".image1");
image2->setSkinComponent(".image2");

By default the Skin Component of an Image widget is ".image".

I'm open to suggestions for improving how Skinning works.


Ah okay. That makes sense. I'll just bunch them up into the same skinset..

Thanks again!

Chaster