FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

image Problem

3 posters

Go down

image Problem Empty image Problem

Post  LuisLee Mon May 04, 2009 8:54 pm

I will add a png image in the SIO2 program,but it does not work. blank screen.the image loading was done,but it not show. this is my code,I don't know what happened,please help me,beacuse i don't familiar with SIO2.


Loading();
[/code]
SIO2stream *_SIO2stream = sio2StreamOpen( "loading.png", 1 );
if( _SIO2stream )
{

pImage = sio2ImageInit( "loading.png" );
_SIO2widget = sio2WidgetInit( "loading.png" );
sio2ImageLoadPNG( pImage,
_SIO2stream );
sio2ImageGenId(pImage,_SIO2widget->flags,sio2->tfilter);

_SIO2material = sio2MaterialInit( "loading.png" );
_SIO2material->blend = SIO2_MATERIAL_DIVIDE;
_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = pImage;

_SIO2widget->_SIO2material = _SIO2material;
_SIO2widget->_SIO2transform->scl->x =400.0f;
_SIO2widget->_SIO2transform->scl->y =320.0f;
_SIO2widget->_SIO2transform->loc->x = 0.5f;
_SIO2widget->_SIO2transform->loc->y = 0.5f;

sio2TransformBindMatrix( _SIO2widget->_SIO2transform );
sio2EnableState(&_SIO2widget->flags,
SIO2_WIDGET_VISIBLE | SIO2_WIDGET_CENTERED |
SIO2_WIDGET_ALIGNH | SIO2_WIDGET_ALIGNV |
SIO2_WIDGET_ENABLED );


Render();
[code]
sio2WindowEnter2D( sio2->_SIO2window,-1000.0f, 1000.0f );
{
sio2WindowEnterLandscape2D( sio2->_SIO2window );
{

if(pImage)
{
sio2->tfilter = SIO2_IMAGE_BILINEAR;
sio2->afilter = SIO2_IMAGE_ANISOTROPIC_1X;
if( _SIO2widget->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ]->tid )
{
glDisable( GL_CULL_FACE );
sio2WidgetRender( _SIO2widget, sio2->_SIO2window, 1 );
sio2WidgetReset();
sio2MaterialReset();
sio2ResourceUpdateAllWidgetBoundaries( sio2->_SIO2resource,
sio2->_SIO2window );
}

}
}

sio2WindowLeaveLandscape2D( sio2->_SIO2window );
}
sio2WindowLeave2D();

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

image Problem Empty Re: image Problem

Post  sio2interactive Mon May 04, 2009 9:01 pm

By default XCode will compress the .PNG, and then it become invalid when extracting it using sio2StreamOpen, disable in the options to compress .PNG inside the .app
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

image Problem Empty Re: image Problem

Post  LuisLee Mon May 04, 2009 9:14 pm

sio2interactive wrote:By default XCode will compress the .PNG, and then it become invalid when extracting it using sio2StreamOpen, disable in the options to compress .PNG inside the .app

thank you for your help, but could you please say it more concretely, because i don not know how to do about it. thank you!

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

image Problem Empty Re: image Problem

Post  sio2interactive Mon May 04, 2009 9:16 pm

Project -> Edit Project Settings -> Compress .png files
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

image Problem Empty Re: image Problem

Post  LuisLee Mon May 04, 2009 9:34 pm

sio2interactive wrote:Project -> Edit Project Settings -> Compress .png files

I try it,but,It does not work。I think it have other problems.
whether there are some problems with my code? Smile

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

image Problem Empty Re: image Problem

Post  sio2interactive Mon May 04, 2009 9:45 pm

Where GDB breaks?
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

image Problem Empty Re: image Problem

Post  spekkio Mon May 04, 2009 9:50 pm

I had the same issue happen to me and I was able to resolve it with these two steps:

1) In Xcode, rename the extension of your PNG image. For example: myimage.ppng. This will bypass the weirdness with Xcode loading the PNG image to the iphone when it installs your app.

2) Make sure your image is a power of 2 in size, e.g: 64x64, 128x128, 256x256 etc. It wont display unless the image meets this size requirement. You can resize the size of your widget to the desired resolution, or you can create a larger then needed image (like 128x128) and then only use the amount you need for your graphic with the rest blank. Take a look at the poweredby images included with the SDK for an example of this.

Hope this helps!

spekkio

Posts : 1
Join date : 2009-05-04

Back to top Go down

image Problem Empty Re: image Problem

Post  sio2interactive Mon May 04, 2009 9:57 pm

1) In Xcode, rename the extension of your PNG image. For example: myimage.ppng. This will bypass the weirdness with Xcode loading the PNG image to the iphone when it installs your app.

>> Its not weird... you just have to disable the option (check above) and everything work like a charm Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

image Problem Empty Re: image Problem

Post  LuisLee Mon May 04, 2009 10:42 pm

thanks,I will try my best to do this.thank you !

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

image Problem Empty Re: image Problem

Post  LuisLee Mon May 04, 2009 10:49 pm

Thank you very much! It work perfect!

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 37

Back to top Go down

image Problem Empty Re: image Problem

Post  sio2interactive Mon May 04, 2009 11:20 pm

hehe told ya Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

image Problem Empty Re: image Problem

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum