sQLux v1.0 (The Xmas Turkey)

Discussion and advice about emulating the QL on other machines.
User avatar
pjw
QL Wafer Drive
Posts: 1608
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: sQLux v1.0 (The Xmas Turkey)

Post by pjw »

stevepoole wrote:<>
Per's RPIX% seems to get that problem right, but the returned (16 bit ?) colours cannot be reused as INK values for shading...

So, is there a way of getting the original 256 INK colours from the 16 bit returned values when using QPC2?
<>
Any suggestions ? Steve.
________________________
The Knoware RPIX% always returns the "native" colour code, so in mode 16 the value is the 1 byte colour code, and in mode 32/33 the corresponding two byte code. To use those codes to set ink, paper, block colour etc you need to first set the per job colour definition, ie in this case COLOUR_NATIVE. (For the RPIX24 function, set the colour definition to COLOUR_24.)

The colour definition setting is only valid until it is changed, so if you need to switch back to COLOUR_QL you can.

HTH


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
User avatar
XorA
Site Admin
Posts: 1620
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: sQLux v1.0 (The Xmas Turkey)

Post by XorA »

Derek_Stewart wrote:
XorA wrote:
Derek_Stewart wrote:Hi,

You could also try RPIXL in the QPTR toolkit, does the same thing, and probably written before all the above.
considering this is sQLux could also add an extension to it to do this in emulator space much faster.
HI,

Sounds interesting, can you outline how the emulator space cab be extended?
Look in QL_baseext.c file for examples of basic extensions. I recently added scr_base extension.


Exile
Chuggy Microdrive
Posts: 51
Joined: Sat Jan 15, 2022 8:55 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by Exile »

stevepoole wrote:Hi Folks,

Following the various suggestions about getting Pixel colours, I have cobbled together a prototype shader for 3d perspective windowing.

It works fine using the DIY Tk PIXEL% under SGC, but on QPC2 it does not seem to fathom out where in memory to look, and returns garbage values. (Screen set to 512x256).

Per's RPIX% seems to get that problem right, but the returned (16 bit ?) colours cannot be reused as INK values for shading...

So, is there a way of getting the original 256 INK colours from the 16 bit returned values when using QPC2?

The prototype is slow under QDOS, faster with SMSQ/E, but nips along under QPC2. But I need to find the solutions to these colour problems...

Any suggestions ? Steve.
________________________
Steve, I presume that when you mention a shader, you are referring to either SBasic or M68k code that runs within the emulator, rather than the OpenGL shaders that have been added to sQLux, which run on the host gpu? The OpenGL shaders have access to colour information at each pixel position.

Are you able to share your prototype code please?


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by stevepoole »

Hi Folks,

Thanks to Dilwyn's site, and advice from Per, I now have a working shader prototype, which is mainly SuperBasic code, and now runs OK under QDOS or QPC2.

I need to tweak it still further to make it fully adaptable. (Pity I haven't seen how the SQLUX shaders operate. Do they ray-trace for example ?).

At present it lifts images off the #2 screen, and wraps them onto any 3d perspective surface orientation, (but only flat ones for the moment).

The code is short and well-tested, and I will put it on the forum as soon as I am sure that it will be fully user-friendly.

But only being one day old, I need a little time before releasing it, as it covers some new ground to me.

Steve.
Capture d’écran (653).png
_________________


Exile
Chuggy Microdrive
Posts: 51
Joined: Sat Jan 15, 2022 8:55 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by Exile »

stevepoole wrote: Pity I haven't seen how the SQLUX shaders operate. Do they ray-trace for example ?
_________________
Steve, I think what you are doing is different, but complimentary, to the sQLux shaders.

The sQLux shaders perform an in place transformation on the whole QL screen. The output is then displayed instead of the original image, in the screen space that the original image would have occupied. They run at real time, 50 times per second if the screen is being regularly updated. As they are modifying the output in the x-y plane, there is no need for ray tracing. When generating the full set of effects (Scan lines, Shadow mask, Bloom and Screen curvature) the shaders pretty much max out the GPU performance of a Pi0, but I expect that the average PC GPU is barely ticking over ;-)

So, you could run your shader program in sQLux, and then run the sQLux shaders as well, to make your output look like it was being displayed on an 80s, CRT, rather than a modern LCD.


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by stevepoole »

Hi Exile,

Thanks for the SQLUX info. I suppose my SuperBasic program should not be called a shader, to avoid confusion. A Texture_Wrapper, perhaps ?

Work is progressing though, and I have included the possibility to wrap photos, using photon's FPIC_LOAD function.

The photo used is a screen shot of an '80s program on my SGC QL to display text at any angle ! (But not in perspective ...).

Next I hope to wrap any textures onto multiple surfaces. Many thanks again to Per for his excellent RPIX.bin !

Steve.
Capture d’écran (657).png


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by stevepoole »

Hi Folks,

Here is a first version of the shader program, now renamed as WRAPPER3D_bas for you to tinker with. First UNZIP to your selected device. (say dos4_)

Then LRESPR RPIX.bin and PHGTK.bin. Type er%=FJPEG(dos4_YourPhoto.jpg,dos4_pic_pic) , with YourPhoto.jpg being smaller than 20ko so as to fit.

RUN, or change the variables sc (.5 1 2 4) , direction (-360 to 360) , angle ( 10 to 90 ) , slope ( +/- 10 to 85 ), xs (+/- .75 ) , ys ( +/- 1 ) ;

SC is scale factor : DIRECTION to look at the image : ANGLE step clockwise around image : SLOPE to look up or down : XS and YS invert the images...

Row and column details can also be changed, but for the moment I have not implemented them. (future versions will). <<< Tested on QPC2 >>>

Experiment by modifying the Channel#2 screen background in INIT... Regards, Steve.
wrapper.zip
(17.53 KiB) Downloaded 150 times


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: sQLux v1.0 (The Xmas Turkey)

Post by stevepoole »

Hi Folks,
Here is a QL image you have all seen, converted ready for the Wrapper 3D program, (to save you reducing jpegs using PAINT).

Steve. PS: All acknowledgements to Per and Photon for their excellent toolkits.....
pic_pic.zip
(16.54 KiB) Downloaded 158 times


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

Re: sQLux v1.0 (The Xmas Turkey)

Post by pjw »

stevepoole wrote:Hi Folks,

Here is a first version of the shader program, now renamed as WRAPPER3D_bas for you to tinker with.<>
Nice one, Steve :)
But I cant help thinking that it would be easier to "tinker" if youd tidy your code a bit so those of us who didnt write it can see whats going on ;)
Im sure theres room to speed things up a little, like by keeping repeated calculations outside of loops (PI*2 leaps out at one but I suspect theres more..) It may not amount to much in the end, but every little helps.
And whats the issue with ATAN? If there are bugs we should know - and try to fix them.
Perhaps time to move this thread elsewhere?
Keep QLing!


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Derek_Stewart
Font of All Knowledge
Posts: 4668
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: sQLux v1.0 (The Xmas Turkey)

Post by Derek_Stewart »

Hi,

I can not get this to run on sQLux, czn you give me some hints how to get more colours on sQLux?


Regards,

Derek
Post Reply