The GCOL statement has two forms, one that takes a single parameter and sets the graphics foreground or background colour (analogous with the single-parameter form of COLOUR for text) and a two-parameter form which sets the colour and a 'logical' plotting mode (OR, AND, XOR or invert). GCOL 0,n is equivalent to GCOL n.
Although the two-parameter form is relatively less common, it is a very important feature of BBC BASIC without which many graphics effects would be impossible. For example XOR plotting is invaluable for its property that plotting the same thing twice restores what was originally there, so is ideal for drawing a graphics 'cursor'.
It is therefore very fortunate that the graphics 'backends' used by both BBC BASIC for Windows (WinGDI) and BBC BASIC for SDL 2.0 (OpenGL) support these logical plotting modes, by means of the SetROP2 and glLogicOp functions respectively. Although SDL 2.0 does not expose this functionality, it does allow you to make direct OpenGL calls so you can access it that way.
However such 'logical plotting' support is considered a legacy feature and more 'modern' graphics backends typically don't provide it, for example GDI+ in Windows, OpenGLES (2.0 and later), Metal (as used by Apple) and Vulkan. Apple have already deprecated OpenGL in MacOS (although for the time being it still works) and a time will come when it is not available.
Indeed this has already happened in the case of the new in-browser edition of BBC BASIC for SDL 2.0 which uses WebGL as its graphics backend, and since WebGL is based on OpenGLES it does not support logical plotting. So what to do? Not supporting the GCOL modes in BBC BASIC would be a major limitation, but emulating them isn't practical in an accelerated graphics environment (even if possible it would be hopelessly slow).
So I've decided on a radical 'solution': in the in-browser edition I've mapped the GCOL modes to the nearest operations that are supported by the graphics backend. Specifically GCOL 1 is add rather than OR, GCOL 2 is multiply rather than AND, and GCOL 3 is the closest 'linear' operation to XOR available: a*(1-b) + (1-a)*b. Although these have significantly different effects they are equivalent to the logical operations in the special case that the RGB components of the source and destination colours are all 0.0 (&00) or 1.0 (&FF).
So looking to the future it is likely that GCOL will increasingly work this way. I am hopeful that it won't prove too difficult to adapt programs to work with the revised functionality. Indeed I have been pleasantly surprised by how many programs work acceptably well without any modification, as you can see for yourself in the case of polydots.bbc, snowscene.bbc, persian.bbc and optics.bbc.
The future of GCOL
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: The future of GCOL
I use GCOL 3,colour(x) a lot for my simple drawing programs.
It's the easyest way for me to restore what ever was on the screen before.
I also like the "legacy features" where I made my own simple 3D drawings by using cos, sin and tan.
The "legacy features" also did, that I was able to understand the basics of trigonometry and don't have use advanced graphics libraries.
A year ago I had never come across the unit circle.
It's the easyest way for me to restore what ever was on the screen before.
I also like the "legacy features" where I made my own simple 3D drawings by using cos, sin and tan.
The "legacy features" also did, that I was able to understand the basics of trigonometry and don't have use advanced graphics libraries.
A year ago I had never come across the unit circle.
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
Re: The future of GCOL
If you get an opportunity, try your programs in the new in-browser edition of BBCSDL to see if the revised specification of GCOL 3,n that I have been forced to adopt (since WebGL doesn't support logical plotting modes) is compatible with your usage. You will need to use (up-to-date) Microsoft Edge or Google Chrome.
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: The future of GCOL
I don't know anything about Emscripten.To boil the situation down: Legacy graphics will be changed to advanced graphics and Emscripten is a way to overcome that or have I misunderstood?
I don't use Chrome or Egde but Firefox Release 80.0.1 September 1, 2020 - will Firefox do?
I don't use Chrome or Egde but Firefox Release 80.0.1 September 1, 2020 - will Firefox do?
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
Re: The future of GCOL
I don't think Emscripten comes into this at all, it's not something that a BBC BASIC programmer needs to know about.
I listed the main 'modern' graphics backends that don't support the 'logical' plotting modes (OR, AND, XOR, NOT): OpenGLES (2.0 or later, typically used on Android devices), Metal (Apple's proprietary system, used in iOS and MacOS), Vulkan (cross-platform) and WebGL (used in browsers).
The only edition of BBC BASIC for SDL 2.0 which currently uses any of these backends is the new in-browser edition, which uses WebGL, so it's handy for testing compatibility with the 'revised' specification of the GCOL modes (e.g. GCOL 1 meaning add and GCOL 2 meaning multiply).
No. I am led to believe that it is possible to enable the necessary capability in Firefox by serving some specific headers, but I don't know how to achieve that. Anyway, Firefox is now an unpopular browser and I'd suggest switching to Chrome.I don't use Chrome or Egde but Firefox Release 80.0.1 September 1, 2020 - will Firefox do?
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: The future of GCOL
The "Don't be evel" hypocrisy company - no thanks!
https://en.wikipedia.org/wiki/Don%27t_be_evil
If it is Microsoft or Google - I'll pass.
No problem for me to run good old programs in virtual modes or dedicate an old pc without internet.
https://en.wikipedia.org/wiki/Don%27t_be_evil
If it is Microsoft or Google - I'll pass.
No problem for me to run good old programs in virtual modes or dedicate an old pc without internet.
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
Re: The future of GCOL
I'm more interested in technical merit and popularity than 'politics'. Google Chrome has 66% of the browser market, Android has 74% of the mobile OS market and Google.com has 75% of the search engine market. Microsoft Edge (the second most popular browser) is built around the Chrome engine.
If you want to criticise a company for its ethics I think you should rather direct your attention to Apple!
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: The future of GCOL
I understand your point of view regarding the technic, but I would rather support small companies that don't are full of them selves.
I totally agree about Apple - they are proberly the worst of all.
Take a look of these small companies that Apple try to "kill". They repair Apple products that Appel say can't be repaired or repair Apple products for very small cost. Apple runs a website that only allows threads that Apple likes. If anyone write that data can be recovered that thread will be deleted and Apple say that they violate Apple rules. Especially when someone need help about to start there Iphone - Apple says: If you can't start your phone - data is lost, but that is not true in 95% of the cases.
https://www.rossmanngroup.com/
https://www.ipadrehab.com/
https://www.ifixit.com/
https://repair.org/
I totally agree about Apple - they are proberly the worst of all.
Take a look of these small companies that Apple try to "kill". They repair Apple products that Appel say can't be repaired or repair Apple products for very small cost. Apple runs a website that only allows threads that Apple likes. If anyone write that data can be recovered that thread will be deleted and Apple say that they violate Apple rules. Especially when someone need help about to start there Iphone - Apple says: If you can't start your phone - data is lost, but that is not true in 95% of the cases.
https://www.rossmanngroup.com/
https://www.ipadrehab.com/
https://www.ifixit.com/
https://repair.org/
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.
Re: The future of GCOL
As you will have seen from the other thread, the in-browser edition of BBCSDL now runs in Firefox (version 80), it was not easy!
-
- Posts: 127
- Joined: Tue 07 May 2019, 16:47
Re: The future of GCOL
Thanks for your effort, but I'll think I'll stick with the present system.
BBC Model B - 1984-1989. 6502 assembler, Unicomal 1988-1994, Some C and C++, Pascal 1990-1994. Bought a copy of BBC-BASIC 2007, but started to program at a daily basis 2019. C++ in 2021.