Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / Point(x,y) returns different values on XP and Vista?

Author
Message
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 6th Feb 2011 11:13
i have only 2 pc's so can't say if it is caused because of difference of OS or of some other pc's attributes. However i wont see pc with xp for 2 weeks so plz someone check this out on various machines
i used color RGB(20,20,20) in my bitmap and i suspect that point(x,y) returns these values

XP: -15461356
Vista: 1315860

there is a small program to test it in download

Join The dark Side! We have cookies

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Feb 2011 13:28
Some systems have different defaults for the alpha component. To get consistent results you probably need to set the bitmap format. For example, use



to force the system to use your "XP" version and



for your Vista version.

The choice is up to you.

Here's what the Help file says:

Quote: "Be aware that on some systems the default bitmap format may differ slightly between ARGB and XRGB depending on a number of factors. If you need to depend on a specific bitmap format, you should use this command at the very top of your program."
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 6th Feb 2011 13:44
thanks... that's no bug then

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 6th Feb 2011 14:32
Probably not.

I forgot to add that your code runs like "Vista" on both my old XP laptop and my newer Vista desktop.

If I recall correctly I used to get different results on my much older XP desktop which I no longer have so can't test with your code.

These minor system niggles are just there to annoy us and keep us awake at night.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 7th Feb 2011 11:59
are there many system niggles to learn? maybe You know some threads about them? i could sleep calm, if know about them before they appear

Join The dark Side! We have cookies
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 11th Feb 2011 18:57 Edited at: 11th Feb 2011 19:00
this bitmap setting- it doesn't seem to work:
i added "set bitmap format 22" in my program, but now when i am at "XP", program doesn't work. Could this be connected with hardware, but not with bitmap settings?
If these settings are the same with Gandalf's new XP and Vista, but old XP different so it looks like it's not dependant on OS but on machine itself
My old pc is 6 years old. In these 6 years some pc making technology may have changed.

I am confused what to do... There are now lots of numbers in my program which mean colors, changing all them every week or 2 isn't fun programing experience at all
I tried to make an array of colors but it returns error. even setting array type as dword didn't help. here is a fragment of my code. I make few functions which select buttons depending on pixel colors:



If i put array (lets say color(10) which means rgb(10,10,10)) it returns error on line "Case color(10)"
Making variables for many colors isn't attractive too, but is there any other way?

Thanks in advance

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Feb 2011 19:42
Quote: "i added "set bitmap format 22" in my program, but now when i am at "XP", program doesn't work. Could this be connected with hardware, but not with bitmap settings?"


What goes wrong? Does your original test snippet work?
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 11th Feb 2011 22:16
I had my program in 1st pc "xp", then following Your post, add bitmap format 22 and rewrite color values to be recognized on 2nd pc "vista"- chose this because values are shorter and positive values.
So my code worked on "vista" with setting bitmap to 22, but now when i got back on 1st pc, it doesn't work again. So i guess that setting bitmap format isn't responsible for difference of values in these 2 machines. I will check if there is any difference in output with different bitmap formats (tomorrow, now go sleep )
And yes, my test program outputs "case1-xp value". Maybe there is some way to check what is default bitmap setting? There is no command in manual's bitmaps section for that.

PS i should have checked if bitmap settings change anything earlier, but i was sure it does

Join The dark Side! We have cookies
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 12th Feb 2011 13:36
now i made program to test what is output of color in different bitmap settings...



bitmap if ok from first test program, but u can download full project too.

Now what about the output? it's the same on various bitmap formats for me. Plz test it on your own, maybe u find some more niggles

Join The dark Side! We have cookies

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Feb 2011 02:12
The Help file says:

Quote: "This command will set any future bitmap created to the following format."


Note the word "future". You have to use the set bitmap format command BEFORE loading or creating your bitmaps.

Quote: "I had my program in 1st pc "xp", then following Your post, add bitmap format 22 and rewrite color values to be recognized on 2nd pc "vista"- chose this because values are shorter and positive values.
So my code worked on "vista" with setting bitmap to 22, but now when i got back on 1st pc, it doesn't work again. So i guess that setting bitmap format isn't responsible for difference of values in these 2 machines. I will check if there is any difference in output with different bitmap formats (tomorrow, now go sleep ) "


Please supply the code you used for that test.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 13th Feb 2011 11:40
I didn't notice word "future" which is really important, but in this case changes nothing:
I use function setup() (in functions.dba) to set bitmap format, and then
function loadsprites() (in terrain2.dba) to load all images and bitmaps.
so bitmaps are created AFTER setting bitmap format. Maybe i do something else wrong

here is all the project, to be compiled and tested
it is quite big now, so don't get lost:
all functions that use bitmaps are located in menufunctions.dba and 1 function InGameInterface() in terrain2.dba

Join The dark Side! We have cookies

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 13th Feb 2011 16:52
The following snippet illustrates your problem (and I agree it isn't obvious from the Help file this time):



It seems you need to put the set bitmap format command after the change to the display. I guess the set display mode command restores everything including the bitmap defaults. The problem is in your setup() function in the functions.dba file. I haven't checked the rest of your code though. Hopefully this will fix your problem.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 13th Feb 2011 17:08
hmm.. i am at my "vista" again... will check if this works on "old xp" after 2-3 weeks
if it solves the problem will let U know
thanks a lot

Join The dark Side! We have cookies
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 27th Feb 2011 14:58
Kiaurutis

I checked out the download and I like what you did

If a thought is Just a thought ~ so whats the main thought ?
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 22nd Jun 2011 17:36 Edited at: 22nd Jun 2011 17:44
soz, i was off programming for a long time.
Bitmap setting didn't solve the problem even if that setting is added after video settings

Join The dark Side! We have cookies
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 23rd Jun 2011 02:02
sorry to hear that Kiaurutis

before the end of august I plan on getting a
laptop made by dell and parts recommended by alienware

my only problem is not know if the windows 7 that comes with it
will be DBP Friendly or anther dumb vista problem

Kiaurutis

DBP 7.61 Official has been released

how vista friendly it is I do not know

If a thought is Just a thought ~ so whats the main thought ?
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Jun 2011 05:05
When I use Point() I have to add (255*16777216) to get a value that matches up with RGB() results.

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Jun 2011 13:05
From the DBPro Help file for set bitmap format code 22:

Quote: "22 32-bit RGB pixel format, where 8 bits are reserved for each color."


So what happens to the other 8 bits?

Quote: "When I use Point() I have to add (255*16777216) to get a value that matches up with RGB() results."


Full alpha in other words? What do you do if you don't want that?

Some simple sample code would be helpful.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 23rd Jun 2011 17:40 Edited at: 24th Jun 2011 15:06
I can't understand why my old pc returns negative values for colors. Eg black color is -16777216.

Omg it is the number what you multiply of 255 in previous post
The other colors are gray:



it looks that the lighter color the smaller difference is, so IMHO 8 bits isn't alpha, coz it would be constant. I take color from a bitmap with no alpha layer

PS this page stolen my spaces... the table was so nice, but now is ruined

PPS Tags worked

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 24th Jun 2011 12:00
Quote: "PS this page stolen my spaces... the table was so nice, but now is ruined"


Try putting it inside the code tags. That should keep the spacing.

Make sure you haven't confused dwords with integers. Try this:

Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 24th Jun 2011 15:24
I didn't set type of variable earlier. Just put "ColNum = Point(Mx,My)"
As I insert "global ColNum as dword" nothing changed...

If none type of variable is set, what is default? I was somehow hoping it automatically selects according to value it gets

I may make 2 arrays of gray color with different values for both cases, and make a check at beginning of program. If black is 0 then use 1 array to compare colors, else use another... but that doesn't look like a 5 minutes work.

It is so strange for me that only 1 person encountered the same problem...

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jun 2011 01:41
Quote: "If none type of variable is set, what is default?"


myVar is integer by default.

myVar# is float by default.

myVar$ is string by default.

For all types it's safer to use explicit declarations although most of us use the defaults for a limited set of types.

Quote: "As I insert "global ColNum as dword" nothing changed..."


That's impossible as dwords are non-negative (unless you assign them to another integer). Perhaps we need to see a short complete example program?

Quote: "I was somehow hoping it automatically selects according to value it gets"


It doesn't.
tiresius
21
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 25th Jun 2011 03:56
I used point() for collision in a lunar lander game in a competition (yeah I know a bit weird, but it was a 2D function I was hoping to highlight for his tutorial). It didn't work on the guy's Vista computer and I had to change it to checking an array of height values. So I'd be interested to know how it gets fixed.

The set bitmap stuff sounded really promising.


A 3D marble platformer using Newton physics.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 25th Jun 2011 09:41
It is kinda difficult to show you an example Gandalf... you would need to find 2 PC's which return different color values on simple program (like the one i put in first post ). After you found them, make some changes to that simple program to check if both PC's return only one value. Unfortunately my 2nd pc is about 150 km away from me so cant go check every change, but i still have some values from it- few gray shades (half of them are in table in previous post)

Join The dark Side! We have cookies
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 25th Jun 2011 10:19
About the impossible... it's magic i guess



It does compile and work on my old pc. For other pc I would put "//Vista..." values

I add whole updated program but it may not work on your pc if values be "vista" type- when you click on buttons nothing happens.

Join The dark Side! We have cookies

Attachments

Login to view attachments
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 25th Jun 2011 10:27
I can't believe it

When i put "text 860,85, "ColNum: "+str$(ColNum)" it prints a value of 4278190080 for black color which is NOT in my select cases... but program still works, when click on buttons they respond.

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Jun 2011 17:30
Quote: "which is NOT in my select cases"


Are you sure? What is the dword equivalent of INTEGER values such as -11513776 ?

How many times do I need to say this?

I guess DBPro will convert the two values to the same type before doing the comparisons required by the select/case statements.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 26th Jun 2011 16:26 Edited at: 26th Jun 2011 17:36
So I should use dword variables instead of simple numbers.

Solution is to perform a check of color values at a beginning of program:
1)Load a bitmap with all the colors that are used in program (only ~20 in my program)
2)Take every color value with Point(x,y) from that bitmap into an array- GrayCollor[255] could hold black, white and every gray shade

This way i would use values from array (but not a constant numbers), to perform "case" comparisons. Whatever value point(x,y) returns, it still correspond to value in case statement

[EDIT]

Nope, this doesn't work. CASE statement don't take my variable... it needs "literal parameter" Is there any way to fool CASE so it would eat my variable? or somehow transform variable into literal?

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Jun 2011 13:25
Use hex constants as in the following snippet.



Note that it doesn't matter whether you use the dword dw or the integer i in the cls and select statements - they refer to the same value. The difference is mainly one of interpretation and presentation of the 32 bits.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 27th Jun 2011 17:14
I don't even know what hex is, maybe it's some kinda evil?

No joke- I really don't know how to read or write in hexadecimal

Join The dark Side! We have cookies
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 28th Jun 2011 01:37 Edited at: 29th Jun 2011 12:55
Hex, or hexadecimal in full, refers to numbers expressed in base 16 rather than 2 or 10. The usual convention is that the 16 different digits are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F.

The compiler recognizes these if you precede the number with the characters 0x. So, for example, 0xff and 0x12 represent respectively the decimal numbers 15*16+15 and 1*16+2, i.e. 255 and 18. They are often used to represent colours as successive pairs of hex digits correspond to the four components alpha, red, green and blue. For example 0xff00ff00 is full alpha full green, and 0xffffff00 is full alpha full yellow.

The compiler seems to recognize them as dword values rather than integers.

Edit A more complete account of hexadecimal numbers can be found here:

http://en.wikipedia.org/wiki/Hexadecimal

DBPro seems to use the C++ convention for writing hexadecimals.
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 1st Jul 2011 12:17
there is another way, without hexes. I found it accidently

While creating interface I came into a need of appearing-hiding buttons box. It only appears when my selected unit can produce other unit or building, else it disappears for not stealing field of view.
I could load another full screen bitmap to check colors, but another 2Mb for RAM- i think it is a crime ...after a lot of thinking I remember that there is a function to separate Red Green and Blue values of color. Heureka!


I check Blue color for my interface:

set current bitmap InGameMenuBitmapNumber
ColNum = RGBB(Point(Mx,My))

If blue is 0 it means mouse is over a pixel that can be only 3D world, if Blue is 100, it can be over some buttons so check if buttons box is active.

if (ColNum=0 || (ColNum =100 && ConstructingWindow=0))
do the 3D world stuff
else
lots of cases for all the buttons
endif

This way I am sure that any of pc's would return the same color value as alpha is left aside and the value is always integer (though it should be byte IMO)

I'm so curious to check this variant on my other pc, if it works I let U know

Join The dark Side! We have cookies

Attachments

Login to view attachments
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 4th Jul 2012 16:16
This thread was so forgotten by me... It did worked what I told on last post. That's the last version of my project. I did stuck on pathfinding and forgot it

Join The dark Side! We have cookies

Attachments

Login to view attachments
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 5th Jul 2012 01:41
@Kiaurutis

looks like a lot of us forgot about this

this looks like it has a lot of to offer ;o)

to move side ways - is to move forward
Since a Strait line gets thin fast
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 5th Jul 2012 02:17
I ran the example first post on windows 7 64bit home home premium

I got "Case 1- 'XP value" message

to move side ways - is to move forward
Since a Strait line gets thin fast
Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 5th Jul 2012 12:36
Do DBP developers read these forum articles? They could easily check where those values for "point" are taken from, and how they depend on different machines...

Join The dark Side! We have cookies
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 12th Jul 2012 13:38
That's interesting. I'll try it on XP and 7 and post results later.

«It's the Pony, pony me this, pony me that» — Bronies
«Socks are sexy. You should wear them!» — Bronies
«I sell apples and apple accessories» — Applejack

Login to post a reply

Server time is: 2024-03-29 12:24:43
Your offset time is: 2024-03-29 12:24:43