USEASBMP in combination with SETORIENTATION... bug?

Previous topic - Next topic

BdR

I think there's a bug in USEASBMP when used in combination with SETORIENTATION.

You can draw an image and then do USEASBMP to "save" it to the backbuffer. From then, every SHOWSCREEN will use that saved image as the default background screen, which is great for rendering a non-moving background only once (saves CPU, compared to rebuilding it every frame).

However, when you use SETORIENTATION something goes wrong. For example, when you do SETORIENTATION 2 it will flip the screen 180 degrees. When you now use USEASBMP the first frame will be good but the frames after that will have a screwed up background.

Here is a program to test and reproduce it on Windows, also see screenshots in attachement.
Code (glbasic) Select

// the first test, normal
DEBUG "TEST 1 - a-okay"
SETORIENTATION 0
DrawBackground()
PRINT "TEST 1 - a-okay .. press any key", 160 ,0
SHOWSCREEN
KEYWAIT

// test 2, the first frame will work
SETORIENTATION 2
DEBUG "TEST 2, first - using USEASBMP"
DrawBackground()
USEASBMP
PRINT "test 2-1 ... press any key", 160 ,0
SHOWSCREEN
KEYWAIT

// test 2 second frame, now it's screwed up
PRINT "test 2-2 screwed up... press any key", 160 ,0
SHOWSCREEN
KEYWAIT

// -------------------------------------
// draw test background
// -------------------------------------
FUNCTION DrawBackground%:

  // draw colored rectangles
  DRAWRECT       0,   0, 640, 240, RGB(192,   0,   0) // red top
  DRAWRECT       0, 240, 640, 240, RGB(  0,   0, 192) // blue bottom
  DRAWRECT       0, 120, 160, 240, RGB(  0, 192,   0) // green left
  DRAWRECT 640-160, 120, 160, 240, RGB(192, 192,   0) // yellow right
 
  // draw texts
  PRINT "top",         0,   0
  PRINT "bottom",      0, 360
  PRINT "left",        0, 120
  PRINT "right", 640-160, 120

ENDFUNCTION


[attachment deleted by admin]

BdR

Also, I suspect that the default GLBasic code for HP TouchPad uses the SETORIENTATION somewhere.

In my program, I use USEASBMP and I never use SETORIENTATION, but still the background is rotated 90 degrees. See screenshots in this thread -> http://www.glbasic.com/forum/index.php?topic=7661.msg63500#msg63500

Kitty Hello

Blimey! You're right.
Please use CREATESCREEN/DRAWSPRITE instead. Also use CLEARSCREEN -1 when you paste an background image yourself. So sorry. I'll try to fix it.

BdR

Excellent, I hope you can fix it. Btw do you think this also caused my TouchPad problem?

spacefractal

It's did work on iPad, so it's mightbeen in some systems. There is workinrounds for that. It's however might not used rotation... 
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

BdR

I've just updated from version 10.244 to version 10.283. Was the USEASBMP command maybe fixed/updated for the WebOS or does it still work the same?

Kitty Hello

I thought I fixed USEASBMP for all platforms. But since SETORIENTATION this command is really hard and totally twist my mind. I hope to be able to fix it if it's broken. ...once I find the time. It's on the TODO.