Request: Setting background color

Previous topic - Next topic

MikeHart

Hi folks,

There is BLACKSCREEN for automatically coloring the background black after each flip. Would be nice if there is something to set the background color to something else.

Thanks
Michael

Ian Price

Well you can USEASBMP (after selecting a bitmap every clear screen will draw that image) or DRAWRECT at the start of every loop.
I came. I saw. I played.

MikeHart

I know I could do that, but it slows down the framerate, which you don't have enough on the IPhone.

In OpenGL(ES) there exist a glClearColor command for this.

Ian Price

Seriously? The framerate is affected by either of those? Just how shit is the iPhone? Both of these work without problem on GP2X and Wiz, which are technically inferior.
I came. I saw. I played.

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Moru

You only need drawrect once to set the background color, then you use "USEASBMP" once and from that point the screen will be cleared to whatever was on the screen when you last called USEASBMP. It should not change the execution-speed of your game at all. (Unless the iPhone is even worse than I thought)

MikeHart

Quote from: Ian Price on 2010-Feb-14
Seriously? The framerate is affected by either of those? Just how shit is the iPhone? Both of these work without problem on GP2X and Wiz, which are technically inferior.

It's not shit! But as you can imagine yourself, drawing a 480x320 image each frame is some kind of overhead when you could get the same result with other functionality. Anyway, I just asked if something like this could be implemented.

We will see when the IPad will be available and someone will recomment drawing an 1024x768 image each frame.  :D

Moru

There is only one recommending drawing the box each frame, did you try the other ideas at all?

MikeHart

Quote from: Moru on 2010-Feb-14
There is only one recommending drawing the box each frame, did you try the other ideas at all?

Moru, thanks for your suggestion. No, I didn't try it because I know the result would be the same like a BLACKSCREEN, just with a different color. My inital request was because drawing a rectangle or an image with all the state changes that might be involved internally will be slower than other possible implementations. Its not a must but a nice to have. So lets end here.

Ian Price

But it won't be slower. The USEASBMP command will change the black CLS to whatever bitmap or rectangle colour you choose. There will be NO impact on gamespeed. If you're getting 60FPS with just a showscreen now, you'd still get 60FPS when using USEASBMP before you're main loop.

You load or create an image and USEASBMP before your main loop, and that's it. All done. You never need to call it again.
I came. I saw. I played.

MikeHart

So you are saying that BLACKSCREEN is basically a combination of drawing a black rectangle and USEASBMP?

Moru

Basicly yes. Try it and see if it does anything to the framerate on your target machine.

MikeHart

If it act the same, then it won't be slower.

Albert

If you use any backbuffer instead of BLACKSCREEN, you get a lower framerate on PC as well. Try on a slow netbook as I do, and you will see.

Kitty Hello

You're right. It totally sucks.
I'll make an optional parameter for the clear colour of BLACKSCREEN in a next update, OK?