Author Topic: [SOLVED] Weird graphics artifact using WINDOW  (Read 2926 times)

0 Members and 1 Guest are viewing this topic.

Offline Joshua

  • Newbie
  • Posts: 10
    • View Profile
[SOLVED] Weird graphics artifact using WINDOW
« on: December 31, 2018, 04:09:42 pm »
I like having the Cartesian coordinates with the origin in the lower left for graphics, so I'll use the WINDOW statement like so:
Code: QB64: [Select]
  1. CONST winWidth = 800
  2. CONST winHeight = 600
  3.  
  4. SCREEN _NEWIMAGE(winWidth, winHeight, 32)
  5. WINDOW (0, 0)-(winHeight - 1, winWidth - 1)
  6.  
  7. FOR x = 0 TO winWidth
  8.     LINE (x, 100)-(x, 300), _RGB(127, 127, 127)
  9.  


But you'll notice when you run the code there is some sort of underflow error when the lines are displayed, as there are gaps.  If you remove the WINDOW statement, it correctly makes a solid bar.  Is there another way to move 0,0 to the lower left without this artifact?
« Last Edit: December 31, 2018, 05:01:18 pm by odin »

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Weird graphics artifact using WINDOW
« Reply #1 on: December 31, 2018, 04:22:40 pm »
Remove the WINDOW statement, instead make your Y coordinates a diff to the height:

LINE (x, winHeight - 100)-(x, winHeight - 300), _RGB(127, 127, 127)
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

FellippeHeitor

  • Guest
Re: Weird graphics artifact using WINDOW
« Reply #2 on: December 31, 2018, 04:32:37 pm »
Whatever it is doing, it's just what it's supposed to do since that's exactly what QB4.5 would do.

Code: QB64: [Select]
  1. CONST winWidth = 320
  2. CONST winHeight = 200
  3.  
  4. WINDOW (0, 0)-(winHeight - 1, winWidth - 1)
  5.  
  6. FOR x = 0 TO winWidth
  7.     LINE (x, 100)-(x, 300), 7

The above version will do basically the same (sans QB64 specific commands) and works with QB4.5 - the result is exactly the same type of artifact as you can see below, likely something with stretching or similar:

 [ You are not allowed to view this attachment ]  

Offline Joshua

  • Newbie
  • Posts: 10
    • View Profile
Re: Weird graphics artifact using WINDOW
« Reply #3 on: December 31, 2018, 04:46:59 pm »
Everything is working fine.  I made a mistake.  In the WINDOW statement, the winWidth and winHeight values are backwards

The right code:
Code: QB64: [Select]
  1. WINDOW (0, 0)-(winWidth- 1, winHeight- 1)
  2.  

FellippeHeitor

  • Guest
Re: [SOLVED] Weird graphics artifact using WINDOW
« Reply #4 on: December 31, 2018, 05:02:48 pm »
Good to hear it's solved :-)