Hi I discuss with an graphics expert and he asked me why we went to use cairo vs opengl And I could not answer. Stef
Cairo is a 2D SVG library, OpenGL it is not (is 3D, etc.). Of course it can be done with OpenGL (and if I succeed on annoying Igor asking for it enough, it will be there :) ), but OpenGL is about describing small triangles. Cairo, however, is easier... I suppose that's the main reason why is made with it. Esteban On Jun 12, 2013, at 11:22 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Hi
I discuss with an graphics expert and he asked me why we went to use cairo vs opengl And I could not answer.
Stef
On Jun 12, 2013, at 11:22 AM, Stéphane Ducasse wrote:
Hi
I discuss with an graphics expert and he asked me why we went to use cairo vs opengl And I could not answer.
Stef The question needs more context to make sense. Cairo and OpenGL are different tools (2D vs 3D), and the answer of which to use is defined by what you are doing.
If what you are doing, is building scalable, flat interfaces, it makes no sense to implement that using OpenGL directly (though making an OpenGL backend to some frontend 2D-library like Athens, in order to have the operations hardware-accellerated on the GPU, is certainly possible). If what you are doing, is building a VR simulation of a meeting room, it makes no sense to implement that in Cairo. Cheers, Henry
I think its a smart move you started from cairo and then moved to opengl. Its possible afterall to mix cairo with opengl. I think its inevitable . It does not matter that opengl does not specialize on vector graphics, it can do vector graphics and offer massive accelerations in the process. As soon as I learn opengl my focus will be shifted to porting morphic (at least the base part) and drag Athens in the process. So tell your friend that opengl support is definetly coming ;) . Just dont tell him "soon" :D I am not going to be rewriting Cairo into smalltalk of course, or doing any kind of major coding / rewrite , just using the existing methods Cairo has for communicating with opengl. From the little I know it creates a quad polygon in opengl ,apply a texture on it and Cairo is used to draw the texture. One of things people who are not familiar with graphics is general are not aware of is the massive acceleration a GPU can give, that in some cases can outperform CPUs by 100 times. But thats not the mind blowing stuff, the mind blowing stuff is that this acceleration is not even graphics specific. CUDA technology is already used in physics, maths and other extremely demanding computing tasks. Pharo can tap on this massive power (eg . language parsers ) that is even available even on 100 euros nvidia cards and soon will be available for every pc and mac out there for peanuts. Probably its a matter of time before penetrate the mobile market too. We coders in blender (3d app) have already seen blender's new render engine offer the unthinkable , real time full renders with minor delays using the CUDA technology through the new render engine called "cycles". The previous render engine would take at least minutes to offer a same quality render, so its a massive move forward. So my conclusion is that eveything has its place . Cairo + Opengl + CUDA , makes a trio of ustopable benefits that pharo cannot afford to ignore in any case. I will try to offer my little part in this process, it wont be easy I know , it could take years, but it will certainly be a lot of fun . -- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4692975.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
I asked Igor a few weeks ago. Basically his answers were : Cairo is for 2D. OpenGL is for 3D. If you do 2D with openGL it is possible but much more complex : a lot of API are missing fr 2D rendering. Moreover, Cairo is faster for 2D. Then other guys than me can give other explanations. 2013/6/12 kilon <thekilon@yahoo.co.uk>
I think its a smart move you started from cairo and then moved to opengl. Its possible afterall to mix cairo with opengl. I think its inevitable . It does not matter that opengl does not specialize on vector graphics, it can do vector graphics and offer massive accelerations in the process.
As soon as I learn opengl my focus will be shifted to porting morphic (at least the base part) and drag Athens in the process. So tell your friend that opengl support is definetly coming ;) . Just dont tell him "soon" :D
I am not going to be rewriting Cairo into smalltalk of course, or doing any kind of major coding / rewrite , just using the existing methods Cairo has for communicating with opengl. From the little I know it creates a quad polygon in opengl ,apply a texture on it and Cairo is used to draw the texture.
One of things people who are not familiar with graphics is general are not aware of is the massive acceleration a GPU can give, that in some cases can outperform CPUs by 100 times. But thats not the mind blowing stuff, the mind blowing stuff is that this acceleration is not even graphics specific. CUDA technology is already used in physics, maths and other extremely demanding computing tasks. Pharo can tap on this massive power (eg . language parsers ) that is even available even on 100 euros nvidia cards and soon will be available for every pc and mac out there for peanuts. Probably its a matter of time before penetrate the mobile market too.
We coders in blender (3d app) have already seen blender's new render engine offer the unthinkable , real time full renders with minor delays using the CUDA technology through the new render engine called "cycles". The previous render engine would take at least minutes to offer a same quality render, so its a massive move forward.
So my conclusion is that eveything has its place . Cairo + Opengl + CUDA , makes a trio of ustopable benefits that pharo cannot afford to ignore in any case. I will try to offer my little part in this process, it wont be easy I know , it could take years, but it will certainly be a lot of fun .
-- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4692975.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
-- Clément Béra Mate Virtual Machine Engineer Bâtiment B 40, avenue Halley 59650 *Villeneuve d'Ascq*
+1. Cairo for 2D and OpenGL for 3D / ( 2D if what Cairo provides is inadequate for that use case.. ) http://artgrammer.blogspot.in/2011/05/drawing-nearly-perfect-2d-line-segment... On Wed, Jun 12, 2013 at 5:45 PM, Clément Bera <bera.clement@gmail.com>wrote:
I asked Igor a few weeks ago. Basically his answers were :
Cairo is for 2D. OpenGL is for 3D.
If you do 2D with openGL it is possible but much more complex : a lot of API are missing fr 2D rendering. Moreover, Cairo is faster for 2D.
Then other guys than me can give other explanations.
2013/6/12 kilon <thekilon@yahoo.co.uk>
I think its a smart move you started from cairo and then moved to opengl. Its possible afterall to mix cairo with opengl. I think its inevitable . It does not matter that opengl does not specialize on vector graphics, it can do vector graphics and offer massive accelerations in the process.
As soon as I learn opengl my focus will be shifted to porting morphic (at least the base part) and drag Athens in the process. So tell your friend that opengl support is definetly coming ;) . Just dont tell him "soon" :D
I am not going to be rewriting Cairo into smalltalk of course, or doing any kind of major coding / rewrite , just using the existing methods Cairo has for communicating with opengl. From the little I know it creates a quad polygon in opengl ,apply a texture on it and Cairo is used to draw the texture.
One of things people who are not familiar with graphics is general are not aware of is the massive acceleration a GPU can give, that in some cases can outperform CPUs by 100 times. But thats not the mind blowing stuff, the mind blowing stuff is that this acceleration is not even graphics specific. CUDA technology is already used in physics, maths and other extremely demanding computing tasks. Pharo can tap on this massive power (eg . language parsers ) that is even available even on 100 euros nvidia cards and soon will be available for every pc and mac out there for peanuts. Probably its a matter of time before penetrate the mobile market too.
We coders in blender (3d app) have already seen blender's new render engine offer the unthinkable , real time full renders with minor delays using the CUDA technology through the new render engine called "cycles". The previous render engine would take at least minutes to offer a same quality render, so its a massive move forward.
So my conclusion is that eveything has its place . Cairo + Opengl + CUDA , makes a trio of ustopable benefits that pharo cannot afford to ignore in any case. I will try to offer my little part in this process, it wont be easy I know , it could take years, but it will certainly be a lot of fun .
-- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4692975.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
-- Clément Béra Mate Virtual Machine Engineer Bâtiment B 40, avenue Halley 59650 *Villeneuve d'Ascq*
Here is mine explanation: Cairo provides much higher abstractions comparing to OpenGL. In OpenGL , a basic element is triangle. There is a polygons, textures, etc, but no things like gradients, patterns etc. And no (or very little) support for text rendering. That means it is possible to implement full vector graphics engine using opengl, but not otherwise because functionality of opengl is much wider than of cairo. @ Kilon, if you interested in dragging athens on top of opengl, you can look at OpenVG one of them, is open-source and based on opengl: http://ivanleben.blogspot.fr/2007/07/shivavg-open-source-ansi-c-openvg.html this one, i think might be the best thing to learn how to implement Athens backend for opengl. -- Best regards, Igor Stasenko.
No , No and No. If you say to opengl coders that Cairo is for 2d and Opengl is for 3d they will start tearing their hair out. :D Cairo is library for Vector Graphics , period. Opengl is the GOD of graphics :D Opengl is a library for a direct access to GPU. True many of its functions are 3d orientated but especially with the new architecture which is a pain to use, opengl is having as the basic component the fragment shader which is little program that defines of the behavior of a single pixel. Fragment shaders are written by coders with the new architecture where everything are shaders. Shaders are just little programms that GPU can run and operate on GPU data. Anything that opengl is doing ends in the fragment shader which the last stage of opengl rendering. So opengl is perfect for 2d of any kind. Its just hard and very low level to use. Hence why we need Cairo. Actually Opengl is by far the most popular for 2d graphics. For example you use Pharo, Pharo uses Morphic for GUI, Morphic uses MACOS Carbon , which in turn based on Opengl. The entire macos GUI is based on opengl, same story for Linux GUIs too. So openg is THE MATRIX. Blender for example uses Opengl 1.1 for its GUI which is all vector based, scalable , etc etc. Windows is not opengl based or even DirectX , they use their own internal software api called the GDI. And Igor coming to you. Yes I am aware of opengVG, but unless I misunderstood what I read the first time I visited the website few months ago and it wont be the first time, its NOT based on opengl. What I am trying to avoid here is promising you guys that I will implement my own vector graphics library, which of course I wont because I dont have the knowledge or the time for it. I have seen how one can use Cairo to draw on opengl surfaces and looks like a easy enough thing to do in the short run. So I am more in favor of quick solutions.
From what I read on the website OpenVG is not related to Opengl , and its hardware accelaration depends on whether the hardware itself implement hardware acceleration for openvg which from the list in the website there are only a handful of hardware that does so. So unless I am missing something here I dont think its a good idea.
From the time being my only focus is learning Opengl and continue contributing tutorial classes to NBOpengl repository. Then start moving Morphic to Athens , using existing cairo binding with NBOpengl. Looks to me like the easiest choice right now. But as always I am open to suggestions and corections.
-- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4693039.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
On 12 June 2013 17:15, kilon <thekilon@yahoo.co.uk> wrote:
No , No and No.
If you say to opengl coders that Cairo is for 2d and Opengl is for 3d they will start tearing their hair out. :D
Cairo is library for Vector Graphics , period.
Opengl is the GOD of graphics :D
Opengl is a library for a direct access to GPU. True many of its functions are 3d orientated but especially with the new architecture which is a pain to use, opengl is having as the basic component the fragment shader which is little program that defines of the behavior of a single pixel. Fragment shaders are written by coders with the new architecture where everything are shaders. Shaders are just little programms that GPU can run and operate on GPU data. Anything that opengl is doing ends in the fragment shader which the last stage of opengl rendering. So opengl is perfect for 2d of any kind. Its just hard and very low level to use. Hence why we need Cairo.
Actually Opengl is by far the most popular for 2d graphics. For example you use Pharo, Pharo uses Morphic for GUI, Morphic uses MACOS Carbon , which in turn based on Opengl. The entire macos GUI is based on opengl, same story for Linux GUIs too. So openg is THE MATRIX. Blender for example uses Opengl 1.1 for its GUI which is all vector based, scalable , etc etc. Windows is not opengl based or even DirectX , they use their own internal software api called the GDI.
And Igor coming to you.
Yes I am aware of opengVG, but unless I misunderstood what I read the first time I visited the website few months ago and it wont be the first time, its NOT based on opengl. What I am trying to avoid here is promising you guys that I will implement my own vector graphics library, which of course I wont because I dont have the knowledge or the time for it. I have seen how one can use Cairo to draw on opengl surfaces and looks like a easy enough thing to do in the short run. So I am more in favor of quick solutions.
From what I read on the website OpenVG is not related to Opengl , and its hardware accelaration depends on whether the hardware itself implement hardware acceleration for openvg which from the list in the website there are only a handful of hardware that does so. So unless I am missing something here I dont think its a good idea.
OpenVG is an open standard for guess what , yes! Vector Graphics. It defines the standard in terms of C API. Then implementation.. it can use anything, and , of course, can be implemented opengl. That's what i wanted to say about ShivaVG. There are other implementations of OpenVG which using CPU. Athens is vector graphics framework, and its backend (read implementation) can use opengl as well.. (see the similarity?)
From the time being my only focus is learning Opengl and continue contributing tutorial classes to NBOpengl repository. Then start moving Morphic to Athens , using existing cairo binding with NBOpengl. Looks to me like the easiest choice right now. But as always I am open to suggestions and corections.
-- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4693039.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
-- Best regards, Igor Stasenko.
Yeap Igor already knew all that when I first visited the website awhile ago. My only concern is how much time will it take to make this work under opengl. If it take less than 60 hours of effort , sure I could do that, if it would take more than that then I am afraid Vector graphics is not such a big deal for me to justifying investing that amount of time. 3d graphics is my focus. But anyway as I said, that is something I will deal with after I have sufficient knowledge of the basics of opengl and finish the NBOpengl tutorial classes. -- View this message in context: http://forum.world.st/Pharo-dev-Cairo-vs-openGL-tp4692947p4693051.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (8)
-
btc@openinworld.com -
Clément Bera -
Esteban Lorenzano -
Henrik Johansen -
Igor Stasenko -
kilon -
S Krish -
Stéphane Ducasse