Graphic drawing Qemulator/QPC2

Anything QL Software or Programming Related.
Martin_Head
Aurora
Posts: 846
Joined: Tue Dec 17, 2013 1:17 pm

Graphic drawing Qemulator/QPC2

Post by Martin_Head »

Is there some difference in the graphics drawing between QDOS and SMSQ/E that I don't know about?

In the following two screen shots of a QL program and its conversion to SMSQ/E. In the QPC2 one, the circle looks squashed.
View3A.png
View3A.png (8.5 KiB) Viewed 3469 times
View3B.png
View3B.png (7.85 KiB) Viewed 3469 times
While they are both 512x256, note that the QPC2 window is shorter than the Qemulator window. If stretched, the circle may look right.

Note also that all the drawings are done with the graphics routines, and the circles are drawn with straight lines and not CIRCLE commands.

I need to do some investigations.

P.S. I don't know why the bottom left image is so far off, where the rest look OK.


User avatar
Cristian
Aurora
Posts: 960
Joined: Mon Feb 16, 2015 1:40 pm
Location: Veneto

Re: Graphic drawing Qemulator/QPC2

Post by Cristian »

For what I can see here, all the QPC window is stretched. So it's normal it's also stretched all the graphics inside.
The original modes (8 and 4) have been set to draw round circles on a 4:3 display (rectangular pixels).
This QPC window instead seems to display square pixels.


User avatar
vanpeebles
Commissario Pebbli
Posts: 2813
Joined: Sat Nov 20, 2010 7:13 pm
Location: North East UK

Re: Graphic drawing Qemulator/QPC2

Post by vanpeebles »

I encountered this a lot while doing graphics and converting screens. One emulator is kind of 1 pixel = 1 pixel wide, 2 pixels down, the other is directly 1:1.


Martin_Head
Aurora
Posts: 846
Joined: Tue Dec 17, 2013 1:17 pm

Re: Graphic drawing Qemulator/QPC2

Post by Martin_Head »

I have just tried CIRCLE 50,50,20 on QPC2 and it comes out squashed. So it's QPC2 not drawing correctly.

If you try to draw a square box with LINE it also comes out rectangular. For the box you need to multiply each x value by 0.75 to correct

I had this problem with the manipulation program http://qlforum.co.uk/viewtopic.php?f=3&t=1153&start=30 but I thought is was because I was converting from writing directly to the screen memory, to using the graphics system. So it looks like I will need to make the drawing routines compensate for which system it is running on.

What is SMSQemulator like, does it squash circles as well?


User avatar
tofro
Font of All Knowledge
Posts: 2679
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Graphic drawing Qemulator/QPC2

Post by tofro »

Martin,

The original QL generated slightly rectangular pixels, while all emulators need to live with square pixels on modern monitors.

That means, you either need to live with distorted squares and circles when you do a pixel-exact emulation, or you change the aspect ratio of the graphics- to pixel coordinate transformation (that means that graphics coordinates do not end up on the same pixel coordinates as on the original)

IN SMSQ/E, you can choose between these two evils by POKEing the console aspect ratio ($14a in the CON linkage block, new to SMSQ/E, and normally set to 1.37 if I remember right). See here http://qlforum.co.uk/viewtopic.php?f=3& ... lit=aspect

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
pjw
QL Wafer Drive
Posts: 1280
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Graphic drawing Qemulator/QPC2

Post by pjw »

tofro wrote:<>
IN SMSQ/E, you can choose between these two evils by POKEing the console aspect ratio ($14a in the CON linkage block, new to SMSQ/E, and normally set to 1.37 if I remember right). See here http://qlforum.co.uk/viewtopic.php?f=3& ... lit=aspect
Ahh, thanks for that, Tobias. I knew there was a fix, and spent a long time looking for it in all the wrong places yesterday. G_RATIO is now part of my boot. Thanks to whoever wrote it..


Per
dont be happy. worry
- ?
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Graphic drawing Qemulator/QPC2

Post by mk79 »

To elaborate on the points already made: the QL had a 512x256 pixel array (2:1) on a 4:3 screen. So the pixel had to be rectangular with a longer side in the y direction. On PCs pixel are (almost) always square, so now you have the alternative of either drawing a circle that occupies the same pixels as one drawn on the QL or one that is actually round, but never both. The default is the former because when combined with things that are specified in pixel coordinates (like windows) this is the only way old software looks okay (even if squished).

The aspect ration formula given in the Minerva ROM sources for PAL QLs is "2 / ( (4/3) * (575/512) * (51.2/51.95) )" which would result in 1.355217. QDOS in practise however used 1.355042 for whatever reason and Minerva used 1.355 because its math routines work faster with that one (this is $0801 $56B90000, so the trailing bits in the mantissa are zero). SMSQ/E's graphics code is based on Minerva's code, so it adopted 1.355. Since SMSQ/E v3.00 I made the aspect ratio user changeable.

Marcel
Last edited by mk79 on Sun Feb 18, 2018 2:51 pm, edited 1 time in total.


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Graphic drawing Qemulator/QPC2

Post by mk79 »

pjw wrote:Ahh, thanks for that, Tobias. I knew there was a fix, and spent a long time looking for it in all the wrong places yesterday. G_RATIO is now part of my boot. Thanks to whoever wrote it..
Jens Wildgruber paid some money for the development of the Aurora graphics drivers and as a favor to him I introduced the aspect ratio variable. He created the utility for it.

Marcel


User avatar
pjw
QL Wafer Drive
Posts: 1280
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Graphic drawing Qemulator/QPC2

Post by pjw »

mk79 wrote:
pjw wrote:Ahh, thanks for that, Tobias. I knew there was a fix, and spent a long time looking for it in all the wrong places yesterday. G_RATIO is now part of my boot. Thanks to whoever wrote it..
Jens Wildgruber paid some money for the development of the Aurora graphics drivers and as a favor to him I introduced the aspect ratio variable. He created the utility for it.
Well, then thanks to you both :)
I ended up using:

Code: Select all

10 COLOUR_24
11 ch = FOPEN("con_")
12 wx = SCR_XLIM(#ch): wy = SCR_YLIM(#ch)
13 WINDOW#ch; wx, wy, 0, 0
14 CLS#ch
15 Circ#ch; wx / 2, wy / 2, wy / 2 - 10, $FF, 1
16 PAUSE#ch: CLOSE
17 :
18 rem Circle
19 rem V0.00, pjw, Apr 1996, using graphics scale
20 rem V0.01, pjw, Apr 1996, SINus table
21 rem V0.02, pjw, Jun 1999, for ASCII art
22 rem V0.04, pjw, Jun 2003, Screen coordinates (BLOCK)
23 rem V0.05, pjw, Oct 2006, as above, speedup
24 :
25 DEFine PROCedure Circ(ch, x, y, r, c, f)
26 LOCal i, tx, ty
27 BLOCK#ch; 1, 1, x, y, c
28 IF f THEN
29  FOR i = 0 TO PI / 2 STEP 5 / (2 * PI * r)
30   tx = COS(i) * r: ty = SIN(i) * r
31   BLOCK#ch; tx + tx, 1, x - tx, y + ty, c
32   BLOCK#ch; tx + tx, 1, x - tx, y - ty, c
33  END FOR i
34 ELSE
35  FOR i = 0 TO PI / 2 STEP 16 / (2 * PI * r)
36   tx = COS(i) * r: ty = SIN(i) * r
37   BLOCK#ch; 1, 1, x + tx, y + ty, c
38   BLOCK#ch; 1, 1, x - tx, y + ty, c
39   BLOCK#ch; 1, 1, x - tx, y - ty, c
40   BLOCK#ch; 1, 1, x + tx, y - ty, c
41  END FOR i
42 END IF
43 END DEFine
44 :
How come that is perfectly round, even without the G-factor?


Per
dont be happy. worry
- ?
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Graphic drawing Qemulator/QPC2

Post by mk79 »

pjw wrote:How come that is perfectly round, even without the G-factor?
Block uses pixel coordinates, not graphics coordinates. And with square pixels that looks fine. It would look distorted on an original QL however.

Marcel


Post Reply