## News:

*NEW* Current Version on STEAM16.793

Webchat:
Visit the chat

## Bottleneck of my current project

#### S.O.P.M.

#15
Have to say sorry, my understanding for mathematics is quite limited so programming can easily become a running the gauntlet for me. Finally I found the right formula and my checkerboard background can be drawn correctly:

Code (glbasic) Select
`FOR i = 0 TO 16 STEP 16    FOR j = 0 TO 16 STEP 16        FOR k = 0 TO 7            FOR l = 0 TO 7                Ima[(i * 32) + j + (k * 32) + l] = 0xFF444444                Ima[(i * 32) + 8 + j + (k * 32) + l] = 0xFF323232                Ima[256 + (i * 32) + j + (k * 32) + l] = 0xFF323232                Ima[256 + (i * 32) + 8 + j + (k * 32) + l] = 0xFF444444            NEXT        NEXT    NEXTNEXT`

But one thing I noticed though. Normally the color value 0x222222 that I used is clearly visible. In this case, if I set it as 0xFF222222 for MEM2SPRITE I got black pixels. Why?

[EDIT]

Fortunately this method works on Android nice and smooth, so it's an acceptable solution for me, even if a bit unlikely. Please pardon the inconvenience!
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

#### Hemlos

0xFF222222

Hex is basically 6 characters long not 8 (not including the 0x part of course)

R G B red green blue  each is 2 chars long

This color should look pink.
Bing ChatGpt is pretty smart

#### fuzzy70

#17
Quote from: Hemlos on 2014-Sep-08
0xFF222222

Hex is basically 6 characters long not 8 (not including the 0x part of course)

R G B red green blue  each is 2 chars long

This color should look pink.
MEM2SPRITE colours in array are 8 chars(32bit), 2x each of Alpha, Blue, Green, Red. 0xAABBGGRR.

I should be home soon so will have a look at your code more closely S.O.P.M when there. Also 0xFF222222 is a very very dark gray. Does it look black on windows or android as don't forget nearly all android devices are 16bit colour & not 24bit like pc's etc.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

#### Hemlos

hmm
Bing ChatGpt is pretty smart

#### S.O.P.M.

Quote from: fuzzy70Also 0xFF222222 is a very very dark gray. Does it look black on windows or android as don't forget nearly all android devices are 16bit colour & not 24bit like pc's etc.
Yes, it's a quite dark gray but it was cleary visible on a black ground under Win and also on my Android phone. I still believe 0xFF222222 should be exactly the same color value than without the transparency declaration 0x222222. So I don't understand why DRAWRECT x, y, w, h, 0x222222 is visible and 0xFF222222 if saved for MEM2SPRITE absolutely not.

However, this is not a problem because I was able to get a similar grey with other values. And that's all I need. Would still nice to understand the mathematical or other background, though.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

#### fuzzy70

Interesting, I just done a test with the following code
Code (glbasic) Select
`LOCAL spritemem%[]LOCAL loop%DIM spritemem[76800]FOR loop = 0 TO 76799 spritemem[loop]=0xFF222222NEXTMEM2SPRITE(spritemem[],1,320,240)DRAWSPRITE 1,321,0DRAWRECT 0,0,320,240,0x222222SHOWSCREENMOUSEWAIT`
which basically draws 2 rects the same colour, 1 using DRAWRECT & other with a sprite made from MEM2SPRITE & the result was as expected, 2 rects the same colour.

Tested on both Windows & Android.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

#### S.O.P.M.

Impossible... your code is working. Now I've changed my code again and it works also. Don't ask me what was wrong the last time.

Another thing puzzles me now. The CPU load is very different in same situations. One time I start the program it goes not above 10%, another time it's at 20-25% permanently. Sometimes the load reduces by itself while the app is running and nothing else changes. I can minimize the window and if I bring it back the load can be very low while I can use the app on any screen. How can that be? My graphics driver is up to date.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

#### fuzzy70

Welcome to windows lol. No seriously though I have that problem with non glb apps as well & never really got to the bottom of it.

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

#### S.O.P.M.

I don't think it's windows. Not that I observed the overall load, no, the load of exactly my app. I'm sure it's an issue with OpenGL.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium

#### MrPlow

#24
You can significantly reduce all draw calls by drawing 1 large rect of black then draw white tiles using a step in you loop calculations

You dont need to draw all 64 squares - Just 17
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

#### MrPlow

#25
duplicate...
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

#### S.O.P.M.

Luckily, all problems are gone. The app currently runs perfectly fine, even if there's a lot to do before it's finished. Programming is always a great learning experience for me.
Notebook PC Samsung E372 Core i5 @ 2,6 GHz; 4 GB RAM; Win 7 Home Premium