On 31 October 2013 18:24, kilon alios <kilon.alios@gmail.com> wrote:
I created a new subject
About the problem to recreate it all it takes is a demo := AthensDemoMorph new openInWorld . It opens the morph with the Athens grey box, I save the image , close pharo, open pharo which reloads the image automagically and BOOM Red Box of Doom :) My other tries also are based on AthensDemoMorph since I cant find documentation to do things differently.
That one is bad, it does not having session management code. Perhaps because the code there was authored before i figured what is most convenient pattern to deal with it, neither i thought about that at all, because it was too early to think about it. At that stage i was more concerned about that framework is capable of rendering stuff correctly. (see my other reply about that).
So lets get to the questions
1) You say you have morphs using Athens that don't have this problem, care to explain further ?
yes, there is number of morphs which correctly implement session-aware resource management, which you need when working with surfaces. AthensSceneView, AthensWrapMorph
The problem is that right now it is a little incursions (since Athens does not completely replaces old Canvas and runs in parallel to it), and there is no globals, like Display which manages that. This code had to be added at one day, but not before we figure, how we can deliver rendered data directly to OS-level window bypassing Form(s) and unnecessary bit copying here and there between number of double-triple-quadruple buffering which stands between Morphic and OS-level screen, which greatly hinders the screen update performance. (or at least figure our migration plan/path). But for that we also must cut out parts in VM and move responsibility for creating OS-level window(s) into image, not VM. The limitations, which we currently having in VM greatly cripples the number of choices of what can be done using Pharo for making desktop-level application. But it is more general problem, and there's nothing in Athens to blame for it. 2) How do I recreate automatically those surfaces ?
3) Do I need to instruct the image on load to reinitialize those objects ?
4) If yes How I do that ?
see how i did that in AthensSceneView, AthensWrapMorph
You say its a major problem but yet its not an Athens bug. I know this is has to do with how image saves live objects and that NB calls are not part of the image hence creating the problem.
5) Are there ways to avoid the problem ?
yes, use Smalltalk session object to check if session is changed before any attempt of using external resource(s).
6) Also why there is a Red Box of Doom in the first place ?
7) Why the debugger is not triggered as it should be ?
It is a general feature of Morphic: if there's an error during morph's drawing it renders it as red box, but not opens a debugger. because opening debugger implies that you will need to render debugger window, but if that code raising an error, you will enter endless recursion.
If you don't like it, you can disable it in Morph>>fullDrawOn: aCanvas (and then try to put a mistake in any morph's rendering code.. but don't say i didn't warned you ;) 8) Is that critical a failure of Morphic ?
It is not a failure, the red box is the only sane way how to keep things running, even if there's error(s) in code. But sometimes even that doesn't helps. Other choice would be to just leave to OS, because at that stage UI will be unresponsive anyways, but that will be even worse, isn't?
9) Why Athens even though is based largely on Cairo , and taking into consideration the intention to extend to other graphical interfaces, not following the Cairo design more closely so we can use the Cairo tutorials ?
The biggest source for design choices is not Cairo. But OpenVG standard. Cairo was easy to reach, low-hanging fruit which we grasp. A more expanded answer as for why Athens is not copy-paste of Cairo, you can read here: http://computeradventures.wordpress.com/2012/03/07/athens-a-first-babysteps/
[[ In other words, give me 1 week, a lump sum of money, and after 2 weeks [image: ;)] i will deliver you a binding to any C library you want. But do not expect that it will be much easier to use it, only because you can access it in smalltalk. This is because exposing a non-object oriented library in smalltalk does not automagically makes it by a bit more object oriented, especially in terms of smalltalk, not in terms of C++ [image: :)] . ]] 10) Is the Cairo design so prohibiting / limiting for Athens ? Does Cairo
do things so differently than other vector based libraries ?
Most of them providing more or less same set of features. But each of them has own API and own idiosyncrasies to deal with, and Athens here to serve for hiding unnecessary details from users and provide a consistent object-oriented API.
11) How important is Athens to Pharo community , meaning further bug fixes, improvements , tutorials etc ? I hear there is an intention to gradual move Morphic to it. Is this true ?
Yes, it is our future.
I really like Athens, I am asking all these questions because I need to make a fast decision whether I will continue to use Pharo or not for my project. Learning OpenGL and using NBOpenGL produced zero results for me. I was not even able to create a single triangle. My gpu driver because of Macos gave me close to zero errors, and Red Box of Doom made it impossible to debug opengl problems. In short close to zero error reporting made it a no go for me.
Sounds like you surrendered too quickly. :) I know multiple people who managed to do things with it, like importing 3d models and rendering them. But sure thing, it is not easy and requires a lot of effort and broad knowledge in multiple areas and abilities to learn & search for examples and docs and understanding the mechanics behind everything.
So I fall back at much simpler solutions because I want to create my own GUI API. I see several solutions for this
1) Pharo Athens 2) Amber SVG / WebGL based Vector libs like Pixi / Athens / HTML5 + CSS 3) Python + PyQT + QT
I rather stay with Pharo. But I already wasted months of doing nothing and going nowhere with NBOpenGL , I am tried of moving in circles. I am not frustrated cause I knew when I tried that OpenGL was very hard ( I was warned by several opengl people ) so failure was always an option , but I can no longer justify wasting my time getting nowhere.
you can ask Alex, who has working examples of opengl. Roassal 3D.
I dont need much from a graphic lib all I need is
a) Stability . If it crashes regularly its no good
b) Speed, if moving graphic elements around slows down (anything above 20%) dual cores , its no good
c) Basic Feature set like , lines, curves , circles and ellipses , display of raster graphics, simple animations , import export of graphic formats, png , jpg and svg is enough.
Looks like Athens satisfies b and c , I am not so sure about a.
I dealing with Athens for... ?last year? almost every day during my work.. don't have much problems here. And that would be my top-priority taks, if it would be a problem, because it would be blocking my own work.
I am trying to understand Athens code from reading it, once again I am a big failure at understanding code.
ask questions. I will gladly help understanding.
So is there any hope for someone like me , that he is not a very good coder, he is new to Pharo and he has a simple mind to use Athens to make a basic GUI API ?
Definitely yes :)
On Thu, Oct 31, 2013 at 6:07 PM, Igor Stasenko <siguctua@gmail.com> wrote:
On 31 October 2013 16:40, kilon alios <kilon.alios@gmail.com> wrote:
save the image while the morph is displayed, reload the image and in its place there is the big red box with the yellow X , reporting an error with Athens. I have reproduced the error on Windows too with the Athens examples. I assumed my explanation was clear , I hope its clear now.
no. not clear. which morph? what class, how you using it etc. I have morphs which using Athens for drawing and i can save and load image back and i don't have red squares of death.
This means that its impossible to save an image with a morph using Athens displaying and have it reload back when the image is reloaded.
The athens-surface, especially cairo surface is valid only within a single session. if you boot new image, you must recreate (or stop using) surface you used in previous session. Otherwise you will have red box of doom.
And while i agree that this is pretty major problem (in terms of making your morph to be session-aware and in terms of managing external resources) i am far from calling it a bug of Athens of any kind per se.
On Thu, Oct 31, 2013 at 5:05 PM, Stéphane Ducasse < stephane.ducasse@inria.fr> wrote:
On Oct 31, 2013, at 9:55 AM, kilon alios <kilon.alios@gmail.com> wrote:
yes I am aware of the examples already, I am learning from them. Please note I have found a bug with Athens, which looks to me pretty major. If I save a morph using Athens
what do you mean save a morph
and reload the image,
what do you mean?
I see the red box of doom. For example trying your example from stackoverflow. Are you aware of this bug ?
On Thu, Oct 31, 2013 at 2:43 AM, Igor Stasenko <siguctua@gmail.com>wrote:
ah, yes , there's also examples in Athens-Examples package.
On 31 October 2013 01:30, Igor Stasenko <siguctua@gmail.com> wrote:
On 30 October 2013 23:02, kilon alios <kilon.alios@gmail.com> wrote:
well I just asked if there is any kind of Documentation about Athens . Or should I just read the code and ask questions ?
the main source of documentation right now is class comments and tutorial. I've spent quite of a time commenting the central classes of athens, hope that's helpful. Of course this does not replacement for a well written docu, and that needs to be done.
On Wed, Oct 30, 2013 at 11:51 PM, Igor Stasenko <siguctua@gmail.com>wrote:
i hope you satisfied with my answer. you welcome to ask more, if you not :)
On 30 October 2013 22:32, dimitris chloupis <thekilon@yahoo.co.uk>wrote:
http://stackoverflow.com/questions/19694197/how-to-create-lines-with-athens
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.