Game Development Community

T2dScroller problem with whitespace

by David House · in Torque Game Builder · 12/21/2005 (5:34 pm) · 11 replies

I'm trying to use the t2dScroller to create a scrolling starfield background. My source image is a png file, and it doesn't have a white border at the top or bottom. But when I put it in the scroller, here is what I get:

static.flickr.com/36/76091238_0f98f08272.jpg
Here is the code for the t2dScroller i'm using:

$stars1 = new t2dScroller() { scenegraph = debrisSceneGraph; };
	$stars1.setImageMap( stars1ImageMap );	
	$stars1.setPosition( "12.5 0" );
	$stars1.setSize( "70.5 94" );
	$stars1.setRepeat( "1 1" );
	$stars1.setScroll( "0 -10" );

and the image map

datablock t2dImageMapDatablock(stars1ImageMap)
{
	imageMode = full;
	imageName = "./images/Universe";
};

anyone see anything obviously wrong with this? Any ideas why I get that white block in there? Looks like maybe the scroller isn't calculating the size of the image properly or something. Nothing in the console.log either.

#1
12/22/2005 (12:01 am)
What size is your camera set to? If you increase the size of the scroller to the size of the camera (or a little larger) does it fit better?
#2
12/22/2005 (2:49 am)
David,

More than likely, this is a POT issue. Although T2D has this new nifty imageMap packing routines that work around the POT issues, the t2DScroller wraps the images by using a hardware feature (GL_REPEAT). This will repeat the whole texture and cannot be used to wrap a portion of it so for now, when using t2dScroller, your image must be full and a POT still.

This is an amendment on my very large "to do" list.

Of course, if your "universe" image is POT then I'd like to know as this could be some kind of software bug.

- Melv.
#3
12/22/2005 (5:27 am)
Melv, yeah I had actually thought about that. Its probably not POT, so I'll try to resize it in photoshop and see how it turns out. Thanks!
#4
12/22/2005 (11:28 am)
Sorry for the confusion David. I'll get around to fixing that ASAP.

- Melv.
#5
12/22/2005 (4:35 pm)
Fyi: Just made that file 512x512 and the white space is gone. So thats what the issue was. No rush on fixing it, just now we know to use POT bitmaps for the t2dScroller for now. No biggie.
#6
12/24/2005 (1:04 am)
Thanks for reporting back David. I'll get that fixed-up just as soon as possible.

- Melv.
#7
12/27/2005 (10:12 am)
I have reissued this as a seperate issue#1005 (feature enhancement - do software-wrapping rather than use hardware texture-repetition).

- Melv.
#8
12/27/2005 (3:12 pm)
Sorry, but what does "POT" mean?

from david's comment, it looks like it has to do with using bitmaps of non power of two.....

oh.. i think i just answered my own question. (seriously, i just answered it writing this, so i'm not just writing this email to flame or anything.)

but FYI, it would be nice to spell-out acronyms before using them.
#9
12/27/2005 (3:24 pm)
Power-of-two e.g. 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 etc...

Quote:but FYI, it would be nice to spell-out acronyms before using them

What does FYI mean? *kidding* ;)

- Melv.
#10
06/23/2006 (5:48 pm)
LOL. <- Laugh out Loud

Are non POT bitmaps still an issue ? I tried using a scroller that was 1024 x 768, and it was 2024 pixels wide. It scrolled, but the right 1024 pixels were solid white.
#11
06/24/2006 (5:26 am)
In the case of scrollers, yes. Simply because they use hardware wrapping which currently requires a POT image. You should see this restriction lifted in the future though.

- Melv.