GETPIXEL and SETORIENTATION

Previous topic - Next topic

PaLe

(Google translated)

GERNOT, I apologize if the problem is already known and being resolved.

Recently doing some testing on Android that creating a screen mode PORTRAIT and setting ORIENTATION = 1 to obtain a screen LANDSCAPE, GetPixel returned incorrect values and this error occurs on Windows creating the same mode screen.

After several tests I was able to understand that the read error occurs when you create a different screen mode from original, for example on a LANDSCAPE screen (then Width>Height and ORIENTATION = 1 or = 3) to obtain a PORTRAIT screen and viceversa if on a PORTRAIT screen (ie Height>Width and always ORIENTATION = 1 or = 3) to obtain a LANDSCAPE screen.

Also on these modes of Orientation I found a mathematical relationship that shows that the command GetPixel in reality can not find the correct value of the memory by the mouse coordinates but in other parts of the screen.

I conclude, therefore, that the problem is probably just mathematics where it reads the graphics memory to take the value of GetPixel in function of incorrect screen coordinates.


spacefractal

This one should been moved into the BUG SECTION. Its property a nice bug you have found.

Also Im have never used GETPIXEL, so he might forgot the orientation calculation as well (which have effected other commands as well and forget this one, which I found a similar bug lasthear, which Im meant its was a VIEWPORT issue).

PS. SETORIENTATION is still a little buggy throught, since ORIENTATION = 1 and 3 can set a PORTRAIT in some devices, due its dosent check its internal value after a hardware orientation. This can been fixed by a java call in this thread: http://www.glbasic.com/forum/index.php?topic=8621.msg73172#msg73172
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MCP

Wow thanks for the link spacefractal that opens up a whole new set of possibilities for me  :)

erico

I sense there is a huge importance on this subject that I´m just not catching  :(
Bookmarked anyway. But android wise... :doubt:

...I set the resolution I want on project settings, and If I set a landscape resolution, it all goes on fine.
Of course If I change it in game then the phone won´t scale nor center it.

The fastest route I think of on this matter, is to use the 9999x9999 solutions posted before +scale routines.
I really know nothing of this, and the actual real solution I think is doing a code for each resolution?
I have set up the game to a number of platforms, and so far, I can keep it all on one code...but I fear changes will lead me to have different projects.

Which leads me to an  :offtopic: question, do you guys keep multiplatform code on a single project? Is it worth to have multiple projects or sources on this matter? What do you recommend? (easy on the recommendations if you would be kind :-[, android is scaring me more then functions... but I´m evolving)

bigsofty

I think this has been already sorted in the V11 beta?

@Pale: Could you please change your avatar from mine? Its a direct copy from my avatar .png file, which in-turn makes it quite confusing when scanning a thread.  :S
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

spacefractal

this issue is more about on GETPIXEL and NOT SETORIENTATION, its a diffent thing. GETPIXELS might just calculate from the first corner and never checked which ORIENTATION its was used (I saw a similar bug in a another command). Also its might even allready been fixed, but I have never use this command.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

PaLe

@spacefractal: ok to move the post in the correct board but do not have the privileges to do (or not do it?)

@bigsofty: also happened on V11.263 (and... finally I changed Avatar!)



Maybe I explained myself badly.
I have attached an example (Pixel.zip) of how it is possible to perform properly GetPixel also in the manner described above, but I see no download.
On Android I need to use the command GetPixel and until GERNOT not solve the problem, in my opinion, is the most efficient way to do it.

spacefractal

PIXEL download is there, just not checked it, and im are also not a mod (and wont to been that as well, im are just a Glbasic user). Its was just to tell a mod to move it.

Anyware files is property only shownable when you are loged in.....
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

bigsofty

Thank you for changing your avatar Pale.  :)

Have you tried manually rotating the coordinates that getpixel uses? X,Y THEN, Y,X, THEN, X,1024-Y etc. to see if you can get it working that way? This would confirm that the command is not following the screen rotation for Gernot to debug.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Ian Price

I came. I saw. I played.

PaLe

#10
TNKS Ian  :)

yes bigsoft, it was so roughly, then I tried it was simpler ... and it was!

The coordinates where correctly read GetPixel are turned through 180° and differ from the original position with the result of the difference between the width and the height of the screen.

So I think both uncomplicated resolution for Gernot.