View Full Version : OpenGL as a Cross-Platform 2D API?
10-02-2000, 11:45 AM
I'm planning to port an application from MS Windows to Linux and MacOS-X. The application makes heavy use of custom 2d graphics widgets and graph editors (Windows GDI at present), and a few OpenGL based 3d widgets.
I am considering writing a cross platform GUI framework similar to GLUI for the port. I have made a few initial tests, performance results have been indecisive. Would anyone be able to comment on whether I could expect to achieve close to native 2D performance by using OpenGL (even with non-GL-accellerated hardware) on the above listed platforms?
Any thoughts on this matter would be greatly appreciated.
10-02-2000, 01:30 PM
While you certainly could use OpenGL I think you'd be wasting your time a bit. On Mac OS X the CoreGraphics calls (what Apple calls Quartz) are very cool. You'd also probably have an easier time porting GDI calls to CoreGraphics than writing an OpenGL wrapper. For Linux I think you're kind of screwed. X Window programming is a pain in the ass and I don't know if GDI calls would map well at all. My suggestion would be to write a 2D graphics interface and implement it with GDI on Windows, CoreGraphics on Mac OS X, and OpenGL on Linux. That way you could also port to stuff like BeOS or QNX which may or may not have working OpenGL/Mesa ports.
10-02-2000, 02:58 PM
Originally posted by genglish:
My suggestion would be to write a 2D graphics interface and implement it with GDI on Windows, CoreGraphics on Mac OS X, and OpenGL on Linux. That way you could also port to stuff like BeOS or QNX which may or may not have working OpenGL/Mesa ports.
I am also considering your proposed solution, but using OpenGL will be easier if it works and will enable me to easily use antialiasing and to integrate new 3d elements as time goes by.
It's also likely that I'll be making wholesale changes to the UI, so having backwards compatibility with my current GDI code is not so much of an issue.
btw. BeOS has full OpenGL support. Hardware acceleration has been temporarily disabled in BeOS 5 while they make some architectural adjustments.
10-02-2000, 04:06 PM
SDL has basic blitting support (no line/shape primitives tho) and is hardware accelerated if the OS allows it. Its been ported to all sorts...
10-02-2000, 04:16 PM
10-03-2000, 02:01 AM
Or more simply :
And you can use OpenGL with it http://www.opengl.org/discussion_boards/ubb/smile.gif
Perfect isn't it ?
(BeOS, Linux, MacOS and windows support)
[This message has been edited by Ingenu (edited 10-03-2000).]
10-03-2000, 06:53 AM
I've been writing a platform independant windowing system with controls in my spare time over the last couple of years and perhaps someday I'll release it. But as for my experience with it I'd recommend that you abstract your GDI portion of the code, use one class for all GDI calls and keep it simple. Depending on your time frame you may want to only use OpenGl. As the hardware opengl accelation becomes more standard there is no reason to mess with native GDI calls. Under Win98 using my NVidia card I get 140fps with a complex 2D window that contains lots of text and controls. In Linux under software rendering it is more like .5-1.0 fps so hardware acceleration is a must if you have a lots of text (textured quads).
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.