Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » About Painter vs OpenGL
About Painter vs OpenGL [message #31462] Fri, 04 March 2011 10:29 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, it was suggested in the past that Painter should be HW accelerated with OpenGL.

I have always seen this as impossible, as drawing models are not compatible.

Today I stumpled on this little info:

http://my.safaribooksonline.com/book/programming/cocoa/06723 22307/cocoa-additions-in-mac-os-x-version-10dot2/app04lev1se c2

Quote:


The 2D line and font drawing features of Quartz are not accelerated by Quartz Extreme. The highquality, device-independent PDF imaging model used by Quartz is incompatible with the accelerated
drawing features supported by OpenGL and common graphics hardware. Graphics cards are optimized to simply draw graphics on a single device, the computer screen, as fast as possible. Features
such as What You See Is What You Get (WYSIWYG) drawing that can be output to high-resolution
printers as well as the computer screen are not supported by the current generation of graphics
cards.



which is exactly what I always thought...

So I guess we can put this issue to the rest. SW Painter is fast enough anyway... Smile

[Updated on: Fri, 04 March 2011 10:32]

Report message to a moderator

Re: About Painter vs OpenGL [message #31466 is a reply to message #31462] Fri, 04 March 2011 17:31 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Quote:

The 2D line and font drawing features of Quartz are not accelerated by Quartz Extreme.


People actually do that. For example: OpenGL accelerated Flash Player.

These guys draw 2D lines and fonts using OpenGL. Actually, they do all 2D UI using OpenGL.


Regards,
Novo
Re: About Painter vs OpenGL [message #31467 is a reply to message #31466] Fri, 04 March 2011 17:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 04 March 2011 11:31

Quote:

The 2D line and font drawing features of Quartz are not accelerated by Quartz Extreme.


People actually do that. For example: OpenGL accelerated Flash Player.

These guys draw 2D lines and fonts using OpenGL. Actually, they do all 2D UI using OpenGL.


Well good for them. However, it is impossible to achieve "svg/pdf" quality of rendering using OpenGL. That is all.

Also, I doubt they are really doing text rendering using OpenGL polygons.
Re: About Painter vs OpenGL [message #31469 is a reply to message #31467] Fri, 04 March 2011 19:52 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Fri, 04 March 2011 11:56

Novo wrote on Fri, 04 March 2011 11:31

Quote:

The 2D line and font drawing features of Quartz are not accelerated by Quartz Extreme.


People actually do that. For example: OpenGL accelerated Flash Player.

These guys draw 2D lines and fonts using OpenGL. Actually, they do all 2D UI using OpenGL.


Well good for them. However, it is impossible to achieve "svg/pdf" quality of rendering using OpenGL. That is all.

Also, I doubt they are really doing text rendering using OpenGL polygons.



What is so special about "svg/pdf" quality of rendering?

And I know for sure they are using OpenGL to render text. Small size text is rendered from bitmaps.


Regards,
Novo
Re: About Painter vs OpenGL [message #31473 is a reply to message #31469] Fri, 04 March 2011 22:15 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 04 March 2011 13:52

mirek wrote on Fri, 04 March 2011 11:56

Novo wrote on Fri, 04 March 2011 11:31

Quote:

The 2D line and font drawing features of Quartz are not accelerated by Quartz Extreme.


People actually do that. For example: OpenGL accelerated Flash Player.

These guys draw 2D lines and fonts using OpenGL. Actually, they do all 2D UI using OpenGL.


Well good for them. However, it is impossible to achieve "svg/pdf" quality of rendering using OpenGL. That is all.

Also, I doubt they are really doing text rendering using OpenGL polygons.



What is so special about "svg/pdf" quality of rendering?



E.g. you often want to achieve subpixel accuracy...

Quote:


And I know for sure they are using OpenGL to render text. Small size text is rendered from bitmaps.


Which is exactly the point...

In Painter (and I believe Quartz and other similiar systems too), even regular text is rendered as curves. That has one nice advantage that you can use the text to define path.

You can only afford that with subpixel accuracy.
Re: About Painter vs OpenGL [message #31476 is a reply to message #31462] Sat, 05 March 2011 13:38 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
mirek wrote on Fri, 04 March 2011 17:56


Well good for them. However, it is impossible to achieve "svg/pdf" quality of rendering using OpenGL. That is all.


Not true, you can achieve pixel perfect quality with Opengl by using programmable shaders, even for the problematic font rendering.

Also you can render flash content with opengl by using the library gameswf, however i noticed that a real life application of this is hard to use.

If you want to see opengl in action for gui take a look at sublime text. The gui is using opengl entirely, except for the menu bar.

Raxvan.

Edit: For rendering text the font can be rendered as a bitmap with mipmapping and antialiasing. This can give you very good quality. However there is technique for improved alpha testing when scaling up. Valve describes this in a article.


92b48bf94855483bb4cec8bcc8c0c933

[Updated on: Sat, 05 March 2011 13:54]

Report message to a moderator

Re: About Painter vs OpenGL [message #31477 is a reply to message #31476] Sat, 05 March 2011 14:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Sat, 05 March 2011 07:38

mirek wrote on Fri, 04 March 2011 17:56


Well good for them. However, it is impossible to achieve "svg/pdf" quality of rendering using OpenGL. That is all.


Not true, you can achieve pixel perfect quality with Opengl by using programmable shaders, even for the problematic font rendering.



Pixel perfect is not subpixel.

Quote:


Edit: For rendering text the font can be rendered as a bitmap with mipmapping and antialiasing. This can give you very good quality.



This is still "rendering text".

In pdf/svg/quarts/Painter, text only defines a path. You can then stroke the path, fill the path, clip the path or whatever.

If you start talking about "bitmap", you are nowhere near what is required.

Mirek
Re: About Painter vs OpenGL [message #31478 is a reply to message #31477] Sat, 05 March 2011 15:01 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
You would be surprised what can be done by using programmable shaders. The ideas is to drop your conventional way of thinking and adopt new techniques that are used today. By using antialiasing you can get the "sub-pixel" quality needed, and i can guarantee that you can get the same or even better quality with opengl rendering, not to mention the extra speed.

Raxvan.


Edit: I believe the future of gui is heading trough this path. Opengl accelerated systems kill everything that is cpu bound.


92b48bf94855483bb4cec8bcc8c0c933

[Updated on: Sat, 05 March 2011 15:09]

Report message to a moderator

Re: About Painter vs OpenGL [message #31480 is a reply to message #31478] Sat, 05 March 2011 15:30 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

SW painter has no dependencies on Unix systems. It uses rather small amount of memory and has very predictable scalability and execution speed. So it can easuly be applied to web servers. Wich is very cool, as it is many times faster than calling ImageMagick.

If we talk about desktop systems like Windows or Android/Mac OS/iOS - yes, videocard help could possibly optimize GUI output in that case.

I suggest considering these approaches equally optimal for their own cases: one - for drawing some elements or servers, another - solely for desktop GUI.
Re: About Painter vs OpenGL [message #31481 is a reply to message #31462] Sat, 05 March 2011 17:45 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
I think all recent mobile devices have "gpu" acceleration (trough opengl ES). In this case it would be stupid not to use it for gui as it is more efficient than cpu, thus making the battery last longer.

In my opinion there really is no other outcome in the future: all user interfaces will be accelerated in some way: openGl, openCl,etc; I know that porting current technology to that is really hard right now, but this should not be left aside.

Raxvan.


92b48bf94855483bb4cec8bcc8c0c933
Re: About Painter vs OpenGL [message #31482 is a reply to message #31478] Sat, 05 March 2011 18:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Sat, 05 March 2011 09:01

You would be surprised what can be done by using programmable shaders. The ideas is to drop your conventional way of thinking and adopt new techniques that are used today.



You cannot if you want pdf.

Quote:


By using antialiasing you can get the "sub-pixel" quality needed,
and i can guarantee that you can get the same or even better quality with opengl rendering, not to mention the extra speed.



Antialiasing, if we are speaking about what is used in 3D games, is again nowhere near what is required/provided by quartz and similiar system.

Quote:


Edit: I believe the future of gui is heading trough this path. Opengl accelerated systems kill everything that is cpu bound.


Do not get me wrong - I do not say that OpenGL is slow. Nor that you cannot do very shiny GUI in it.

My only claim is that it is svg/pdf incompatible. And the link I have posted here seems to support it.

I would say I have quite deep knowledge of Painter/pdf/svn graphics (hell, I should found some common name for it Smile - because I have implemented it and I also have quite a good info about OpenGL. From that perspective I can say for sure that those models are not very compatible.
Re: About Painter vs OpenGL [message #31483 is a reply to message #31481] Sat, 05 March 2011 18:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
raxvan wrote on Sat, 05 March 2011 11:45

I think all recent mobile devices have "gpu" acceleration (trough opengl ES). In this case it would be stupid not to use it for gui as it is more efficient than cpu, thus making the battery last longer.

In my opinion there really is no other outcome in the future: all user interfaces will be accelerated in some way: openGl, openCl,etc; I know that porting current technology to that is really hard right now, but this should not be left aside.

Raxvan.


Please, the whole rant is about the idea that Painter should be accelerated by OpenGL.

It has nothing to do with using OpenGL for GUI. Actually, Draw model is in fact easily compatible with OpenGL and in the end, U++ GUI is rendered using Draw.
Re: About Painter vs OpenGL [message #31486 is a reply to message #31483] Sun, 06 March 2011 08:44 Go to previous messageGo to next message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
mirek wrote on Sat, 05 March 2011 18:29


Please, the whole rant is about the idea that Painter should be accelerated by OpenGL.

It has nothing to do with using OpenGL for GUI. Actually, Draw model is in fact easily compatible with OpenGL and in the end, U++ GUI is rendered using Draw.


Sorry, my mistake then, i thought that Painter is directly responsible to drawing gui in upp Razz.
I will take a closer look to Draw and see if i can pull off an opengl implementation.


92b48bf94855483bb4cec8bcc8c0c933
Re: About Painter vs OpenGL [message #31494 is a reply to message #31486] Sun, 06 March 2011 22:10 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Well, this is certainly one of my favourite subjects, although I certainly do not know OpenGL nearly enough to say what can and can't be done.

Anyway, my point is that when comparing Painter and Draw simply as graphics programming interfaces, Painter provides a rich set of graphics primitives not available with Draw. Therefore, getting hardware acceleration available behind the Painter interface would definitely serve a purpose.

When I last checked, Painter defined three user selectable levels of rendering quality: No antialiasing, normal antialiasing and subpixel antialiasing. Whereas I gather from Mirek's notes that subpixel accurate results would be impossible or nearly so to achieve with OpenGL, what about basic antialiasing or no antialiasing at all? Would it be possible to implement a hardware accelerated 'SystemPainter' or 'OpenGLPainter' without subpixel antialiasing? I could certainly find use for it even with degraded image quality as long as rendering is ultra fast. (BufferPainter is always there to give the ultimate quality with its subpixel quality when speed is not an issue.)

So, Raxvan, if you know OpenGL well enough to implement Painter on OpenGL, even without any antialiasing, go ahead! Maybe prototyping on GLCtrl would help get things started...

Best regards,

Tom
Re: About Painter vs OpenGL [message #31497 is a reply to message #31494] Sun, 06 March 2011 22:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Sun, 06 March 2011 16:10

Well, this is certainly one of my favourite subjects, although I certainly do not know OpenGL nearly enough to say what can and can't be done.

Anyway, my point is that when comparing Painter and Draw simply as graphics programming interfaces, Painter provides a rich set of graphics primitives not available with Draw. Therefore, getting hardware acceleration available behind the Painter interface would definitely serve a purpose.

When I last checked, Painter defined three user selectable levels of rendering quality: No antialiasing, normal antialiasing and subpixel antialiasing. Whereas I gather from Mirek's notes that subpixel accurate



Please, there is some terminology issue about this. There are 2 different things:

- subpixel accuracy. That basically means that all coordinates are floating point and renderer does something about "fractional" numbers. In Painter, each pixel has 256 fractions. When rendering, if there is some part of polygon fractionally in the pixel, it affects it by that fractional value (and you get precise antialiasing that was).

- subpixel rendering. That, instead of taking screen pixel as 'whole', takes into account all 3 channels, which results in improved horizontal resolution.

Quote:


Would it be possible to implement a hardware accelerated 'SystemPainter' or 'OpenGLPainter' without subpixel antialiasing?



I believe not. You perhaps could imitate it to some degree, but OpenGL polygons are not compatible.

I Painter like system, "path" rules everyting.

I have seen some code in Qt that tries to do this, but I have seen that they have ended in quite complicated maths breaking "pdf" polygons into something that OpenGL is able to render.

That said - if you require fast graphics which is OpenGL able to provide, why not to use OpenGL directly?

Mirek
Re: About Painter vs OpenGL [message #31502 is a reply to message #31497] Mon, 07 March 2011 11:16 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Oops, I mixed up the terminology on the way.. Thanks for correcting me.

Doing 2D graphics directly with OpenGL is considerably more difficult for complex geometries than it is with Painter, and I'm certainly not one of the people who could implement such a mapping from scratch. So, this is why I do not use OpenGL for 2D directly.

Anyway, my chain of thoughts goes like this:

- Painter provides an excellent API and compatible software renderer (BufferPainter) capable of handling complex graphics primitives.

- OpenVG (see http://www.khronos.org/files/openvg-quick-reference-card.pdf ) should provide similar graphics capabilities.

- As far as I know, OpenVG is not (at least yet) available on pc hardware directly, but surprisingly there is/are OpenVG implementation(s) on top of OpenGL, such as ShivaVG.

MAYBE it is possible to map the Painter API on top of OpenVG or even directly on top of OpenGL. Is it fast? Is the quality sufficient? ... who knows before it is done.

--

Writing software to use OpenVG directly would only target the screen display, but having Painter implemented on top of OpenVG or OpenGL would provide all graphics needs under the same API.

Then there is the Microsoft Direct2D, which could possibly be another option for accelerating the Painter on Windows, but certainly not on other platforms.

Best regards,

Tom
Re: About Painter vs OpenGL [message #31504 is a reply to message #31462] Mon, 07 March 2011 13:10 Go to previous message
raxvan is currently offline  raxvan
Messages: 60
Registered: December 2009
Member
You can do vector graphics with opengl. I see no difficulty implementing paths, curved lines, and everything Painter needs (without polygons!).

If i have time, i will assemble a demo proving the concept.

Raxvan.


92b48bf94855483bb4cec8bcc8c0c933

[Updated on: Mon, 07 March 2011 14:22]

Report message to a moderator

Previous Topic: Executable as DLL
Next Topic: Google Summer of Code
Goto Forum:
  


Current Time: Thu Mar 28 16:05:33 CET 2024

Total time taken to generate the page: 0.01651 seconds