Author Topic: PMAP lacks precision  (Read 1361 times)

0 Members and 1 Guest are viewing this topic.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
PMAP lacks precision
« on: August 29, 2021, 02:20:27 pm »
Hi boys and girls of QB64

trying to develope in alternative way my Pong OpenGl demo by using WINDOW and PMAP commands of QB64/QB
I got PMAP with loosing precision!
please try this code:
Code: QB64: [Select]
  1.  
  2. S = _NewImage(800, 600, 32)
  3. Window Screen(-1.0, -1.0)-(1.0, 1.0)
  4. ' translate screen left-top and lower-right into window system
  5. Print PMap(0, 2), PMap(0, 3), PMap(800, 2), PMap(600, 3)
  6.  
  7. 'translate window system left-top and lower-right into screen
  8. Print PMap(-1, 0), PMap(-1, 1), PMap(1, 0), PMap(1, 1)
  9.  
  10.  
  11.  

and here you can see the output
  [ You are not allowed to view this attachment ]  
Well it seems that we cannot use PMAP for NASA calculation.
Please gimme feedbacks.

Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: PMAP lacks precision
« Reply #1 on: August 29, 2021, 02:58:20 pm »
Found the loosing here:
Code: QB64: [Select]
  1.  
  2. S = _NewImage(800, 600, 32)
  3. Window Screen(-1.0, -1.0)-(1.0, 1.0)
  4. ' translate screen left-top and lower-right into window system
  5. Print PMap(0, 2), PMap(0, 3), PMap(799, 2), PMap(599, 3)
  6.  
  7. 'translate window system left-top and lower-right into screen
  8. Print PMap(-1, 0), PMap(-1, 1), PMap(1, 0), PMap(1, 1)
  9.  
  10.  
  11.  

What do you think?

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: PMAP lacks precision
« Reply #2 on: August 29, 2021, 04:33:51 pm »
Found the loosing here:
Code: QB64: [Select]
  1.  
  2. S = _NewImage(800, 600, 32)
  3. Window Screen(-1.0, -1.0)-(1.0, 1.0)
  4. ' translate screen left-top and lower-right into window system
  5. Print PMap(0, 2), PMap(0, 3), PMap(799, 2), PMap(599, 3)
  6.  
  7. 'translate window system left-top and lower-right into screen
  8. Print PMap(-1, 0), PMap(-1, 1), PMap(1, 0), PMap(1, 1)
  9.  
  10.  
  11.  

What do you think?

I think you’re right, as an 800x600 screen runs from 0 to 799 x 0 to 599.  Tempodi’s values were off the chart.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: PMAP lacks precision
« Reply #3 on: August 29, 2021, 07:24:35 pm »
Thanks,
It is always better be helped to find own mistakes.
So I have misunderstood the range of declaration.
My error is that I have thought  about dimensions of screen like we do with array so I have thought 800 is like 0-800 because there is no option base to force to start from 1. And so for the other dimension.
Thanks to point my conceptual error.
Programming isn't difficult, only it's  consuming time and coffee