QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: TempodiBasic on August 29, 2021, 02:20:27 pm

Title: PMAP lacks precision
Post by: TempodiBasic 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
  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Well it seems that we cannot use PMAP for NASA calculation.
Please gimme feedbacks.

Title: Re: PMAP lacks precision
Post by: bplus 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?
Title: Re: PMAP lacks precision
Post by: SMcNeill 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.  ;)
Title: Re: PMAP lacks precision
Post by: TempodiBasic 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.