You are not logged in.

#1 2010-07-28 20:54:15

Double_A
Member

[RESOLVED] More than 3 Draws don't work

Hi,

If i make more than 3 Draws before the Render the screen remains black.

This is my Code:

Code:

int printLoadingBar(const char* msg, const f32 percent) {
    GRRLIB_DrawImg(0, 0, tex_background_jpg, 0, 1, 1, 0xFFFFFFFF);
    GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, 0xFFFFFFFF);
    GRRLIB_PrintfTTF((640-strlen(msg)*9)/2, 256, myFont, msg, 20, 0x00000000);
    
    GRRLIB_DrawPart(52, 342, 0, 0, floor(536/100*percent), 36, tex_loadingbarblue_png, 0, 1, 1, 0xFFFFFFFF);
    GRRLIB_DrawPart(52+floor(536/100*percent), 342, floor(536/100*percent), 0, 536-floor(536/100*percent), 36, tex_loadingbargrey_png, 0, 1, 1, 0xFFFFFFFF);
    
    GRRLIB_Render();  // Render the frame buffer to the TV
    return 0;
}

That doenst work.
But if I remove for example this line:
GRRLIB_DrawImg(256, 112, tex_Refreshicon_png, 0, 1, 1, 0xFFFFFFFF);


It works perfectly.
But the same line alone also works.


The total size of the images is 341KB that should be ok, right?

Offline

 

#2 2010-07-28 21:06:23

Crayon
Bad Mother Fucker

Re: [RESOLVED] More than 3 Draws don't work

Double_A wrote:

The total size of the images is 341KB that should be ok, right?

There is no problem with size on the hard drive, but what is the actual size (width and height) of your image?
Does your png uses a palette or is it 24/32bits?

Offline

 

#3 2010-07-28 21:24:56

Double_A
Member

Re: [RESOLVED] More than 3 Draws don't work

The biggest image is 640x480.
All the other images are smaller and all Pixel are divisible by 4.

And the bit depth is 32 for pngs and 24 for jpgs... Is that the problem?
And I dont know  what you mean by "palette"...

Offline

 

#4 2010-07-28 21:31:29

Crayon
Bad Mother Fucker

Re: [RESOLVED] More than 3 Draws don't work

Your images seems ok, so it must be something with your code. But I have no idea sad Could it be possible to put your whole project in download so I can debug it?

If you need more info on the word palette: http://en.wikipedia.org/wiki/Palette_%28computing%29

Offline

 

#5 2010-07-28 21:49:15

Double_A
Member

Re: [RESOLVED] More than 3 Draws don't work

Hi,

This is the source.
http://www.mediafire.com/?q8onyx9wdov8b15

Pls look at it...

Offline

 

#6 2010-07-28 22:03:26

Crayon
Bad Mother Fucker

Re: [RESOLVED] More than 3 Draws don't work

Simply put this code:

Code:

printLoadingBar(sometext, 65);

inside the while loop.

Offline

 

#7 2010-07-28 22:32:35

Double_A
Member

Re: [RESOLVED] More than 3 Draws don't work

I can't do that...
I need the GUI later and other calculations should be done while it's displayed.
That doenst work if there ia an endless loop.

And normally is works fine if printLoadingBar(sometext, 65); is not in the while loop...

Offline

 

#8 2010-07-28 22:52:27

Crayon
Bad Mother Fucker

Re: [RESOLVED] More than 3 Draws don't work

Just make a small "state machine" inside the while do to every tasks?

If that's not a valid answer, you could wait for NoNameNo to pass by, maybe he could help with this.

Offline

 

#9 2010-07-28 23:05:50

NoNameNo
Administrator

Re: [RESOLVED] More than 3 Draws don't work

Double_A wrote:

And normally is works fine if printLoadingBar(sometext, 65); is not in the while loop...

NO, if you do not redraw it each VBL you wont see it,
i think you can have a look at compositing sample if you need to precalc stuff
or like crayon said, have a simple machinestate if you absolute need real time rendering.

Offline

 

#10 2010-07-29 00:12:28

Double_A
Member

Re: [RESOLVED] More than 3 Draws don't work

It works outside a while loop...
I've tried. But it only works if there max. 3 Draws.

I don't need realtime rendering.
I need a static picture.

Like this:
- Display Picture 1.
- Do some calculations in background while Picture 1 is still displayed.
- Display Picture 2.
...

Isn't that possible?

Offline

 

#11 2010-07-29 00:22:41

Crayon
Bad Mother Fucker

Re: [RESOLVED] More than 3 Draws don't work

But if you want to show a progress bar you will need to update the picture, no?

If you combine all you're drawings inside a texture, then you just need to draw one texture. So the limits of 3 draws is ok. Look at the GRRLIB_Screen2Texture function.

Offline

 

#12 2010-07-29 00:37:40

Double_A
Member

Re: [RESOLVED] More than 3 Draws don't work

The progress bar makes just bigger "jumps". Can live with that  ^^

And I solved it very easily -.-
I just had to call  printLoadingBar(sometext, 65) 3 times...

Now I've just put the function content into  for (i = 0; i < 3; i++) { ... } and it works fine with more than 3 draws. ^^

Offline

 

Board footer

Powered by FluxBB