StaticImage rendering stretched to wrong size

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

StaticImage rendering stretched to wrong size

Postby Armitage1982 » Wed Dec 10, 2008 14:33

Hi
I'm using CEGUI last version with BlitzMax via a wrap nearly complete.

I need to create a 2D Tile Selector for a Map Editor.
I use a scrollablePane and put my full TileSheet Inside.
Then using the mouse position, scrollbar position and CoordConverter I get the right Tile Number to paint my level.

The code work well with 24x24 tiles and for ex. 240x480 TileSheet.

Unfortunately this won't work with 200x200 tiles and for ex. 800x1000 TileSheet.

The problem is located when loading my Image Set.

While my staticImage must be 800x1000 it render like 800x770 and is considered by the scrollablePane like 800x1000 (which lead to blank spaces at the end of the vertical scroll).

I try setAutoScalingEnable, manually set every size at correct pixel size or set different staticImage formatting without success.

I suppose there is a problem of power of 2 causing this somewhere, but 770 make no sense to me.

What can I do to resolve this problem :?:

Except of that CEGUI is the best in-game GUI I ever try !
Thanks :D

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Wed Dec 10, 2008 20:24

Hi, and welcome :)

Which renderer module is this using? Does BlitzMax have it's own or is it done via one of the other modules?

I agree that it's likely to be something to do with image / texture size and powers of two - the exact solution will depend upon the renderer as there are unfortunately differences in how such things are handled. The bit about having blank space seems to indicate it's a renderer that does not stretch the image, though in these cases the "full_image" image is supposed to be set to the 'used' part (i.e. the right size). I'll have a look tomorrow to confirm this one way or the other. You might end up defining a new image on the imageset with the 'right' size (if the "full_image" size turns out to be done wrong).

I think for this type of usage, you will almost certainly want autoscaling to be off.

If you could maybe post a little code showing what you're doing as far as imageset creation and such, this might assist in narrowing the issue down.

Except of that CEGUI is the best in-game GUI I ever try !

Glad you're liking CEGUI (save for this issue, of course ;) ).

CE.

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

Postby Armitage1982 » Sun Dec 14, 2008 19:44

Hi

Thanks for your answer and interest in this problem :)

I'm currently using CEGUI in a OpenGl context with max2D module which is only a simplified and unified layer onto OpenGl (I suppose).

So this time I load a 384x1248 complete tile map (I know it's huge :D) and the same problem appear : Only the first 770 px in height showed up !

Unfortunately by design I can't use multiple 770 px in Height textures :(

Note that using this staticImage in a root location layout result in a complete display of my texture !
Maybe there is a problem in my look'n'feel theme file.
I will investigate :)

Won't be easy to extract portions of code that load up this tile set and all but I will try as soon as possible.

This is probably the last bug in my level editor... too bad :P

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

Postby Armitage1982 » Mon Dec 15, 2008 00:30

Ok I try to reproduce a full scrollpane with ClippedContainer and scrollbars but obviously the Clipped Container act similarly and fail rendering more than 770 pixels height :?

And I found why ! :)

My openGL windows is 1024x768
It's not exactly 770 pixel height but 768 pixels !
If I set a smaller window size, then my image is cut down a little bit more.

With these new informations, I don't know well how I can fix this problem :?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Dec 15, 2008 10:07

Can you show the layout xml / code where you create and setup both the ScrollablePane and the StaticImage widgets?

Also, you don't have some odd graphics card that can't create textures larger than the frame buffer or something? (I think this is doubtful, myself, although it's a consideration).

CE.

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

Postby Armitage1982 » Mon Dec 15, 2008 11:36

Ok

I'm using Aqualook theme and Nvidia GeForce 7600 GS

This is the Scrollable Pane with staticImage nested inside.

Code: Select all

          <Window Type="AquaLook/ScrollablePane" Name="spaneTileSet" >
                <Property Name="ContentArea" Value="l:0 t:0 r:100 b:100" />
                <Property Name="HorzStepSize" Value="0.1" />
                <Property Name="VertStepSize" Value="0.1" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="HorzOverlapSize" Value="0.01" />
                <Property Name="UnifiedAreaRect" Value="{{0,10},{0,128},{0,410},{0,350}}" />
                <Property Name="VertOverlapSize" Value="0.01" />
                <Property Name="HorzScrollPosition" Value="0" />
                <Property Name="VertScrollPosition" Value="0" />
                <AutoWindow NameSuffix="__auto_container__" >
                    <Property Name="ContentArea" Value="l:0 t:0 r:100 b:100" />
                    <Property Name="ChildExtentsArea" Value="l:0 t:0 r:100 b:100" />
                    <Window Type="AquaLook/StaticImage" Name="TileSetImage" >
                        <Property Name="FrameEnabled" Value="False" />
                        <Property Name="HorzFormatting" Value="LeftAligned" />
                        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                        <Property Name="VertFormatting" Value="TopAligned" />
                        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,100},{0,100}}" />
                        <Property Name="BackgroundEnabled" Value="False" />
                    </Window>
                </AutoWindow>
            </Window>

Then in BlitzMax (take it like pseudo basic code) I do something like :

Code: Select all

If TCEImagesetManager.isImagesetPresent("MGTileSet") Then TCEImagesetManager.destroyImageSet("MGTileSet")
TCEImagesetManager.createImagesetFromImageFile("MGTileSet", "c:/mytilesheet.png").setAutoScalingEnabled(False)
Local TileSetWindow:TCEWindow = TCEWindow(TCEWindowManager.getWindow("TileSetImage"))
TileSetWindow.setProperty("Image", "set:MGTileSet image:full_image")
TileSetWidth = TCEImagesetManager.getImageset("MGTileSet").getImageWidth("full_image")
TileSetHeight = TCEImagesetManager.getImageset("MGTileSet").getImageHeight("full_image")
TileSetWindow.SetHeight(TileSetHeight)
TileSetWindow.SetWidth(TileSetWidth)


createImagesetFromImageFile if because we cannot directly wrap polymorph methods in BlitzMax (supposed).
It's like doing

Code: Select all

CEGUI::ImagesetManager::getSingleton().createImagesetFromImageFile(name, filename, resourceGroup);

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

Postby Armitage1982 » Mon Dec 15, 2008 13:55

Well I probably did a mistake in the staticImage definition

I try

Code: Select all

<Property Name="UnifiedMaxSize" Value="{{0,2048},{0,2048}}" />

Just because you tell me to have a look at my xml code and with this my tileSheet is fully rendered :D

I didn't know that CELayouteditor write a unifiedMaxSize and so that's why I couldn't load any larger image :)

Just one thing is that my background staticImage is now black rather than transparent but it's not an issue for me.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Mon Dec 15, 2008 14:08

:lol: Cool. I'm glad you managed to get it working. I have to admit that I did not spot this, and was about to reply with some other possible ideas - but no need now :)

Not sure about the StaticImage background issue, though if it's not an issue, then it's best not to worry ;)

CE.

Armitage1982
Not too shy to talk
Not too shy to talk
Posts: 43
Joined: Wed Dec 10, 2008 14:15
Location: Belgium

Postby Armitage1982 » Mon Dec 15, 2008 14:55

Thanks again for your help crazyEddie :D
I wish you the best for 2009 with CEGUI :o (yeah already)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests