Is Xlib Still Used? - xlib

Is xlib still used? The helpful documentation I can find is http://tronche.com/ which looks, to me, very outdated. Who uses Xlib? Is GTK+ and QT built on it? thanks in advance, ell.

Yes, toolkits like GTK+ and Qt are still built on Xlib. Migration to xcb is in progress, but far from complete or universal. Applications though really should be writing to the toolkit API's, not Xlib.
BTW, you can also find Xlib docs directly from the source at X.Org: http://www.x.org/releases/current/doc/

These days, libxcb is used. There is also an xlib compatibility layer still available (xlib-xcb).

Well if you want hardware acceleration, according to freedesktop.org:
an OpenGL application on the X Windows must use Xlib and thus can’t be done using only XCB.
You have to have xlib even if you're only using xcb if you want opengl.

Related

wglGetCurrentContext for OSX

I have a program on windows that manages OpenGL contexts, (things such as making them current, destroying them, pretty much everything but the actual creation). I've recently moved to programming on a mac, and I was wondering if there is some function similar to wglGetCurrentContext for OSX. I can't seem to find the documentation for these online.
Edit: The AGL (Apple GL) framework and more specifically the function aglGetCurrentContext are all deprecated.
You are looking for CGL (Core OpenGL).
The equivalent of wglGetCurrentContext() is CGLGetCurrentContext(). It works similarly.
There's the OpenGL Programming Guide for Mac, but I found the CGL reference to be rather more useful. I was unable to locate the CGL reference on Apple's website, but there's a mirror.

Is there any cross-platform GUI Toolkit which does not follow the one source to rule them all concept?

After a long evaluation period of mainstream toolkits Qt, WxWidget, GTK i came to the conclusion that it does not make sense to religiously equalize the different platform. Now more then ever before.
In the days before Java portability meant, that platform dependent code was located in known places and should be small but not none. No write once, run everywhere marketing.
Is there any GUI tookit - experimental or commerical (even outdated or dead projects) - that is going this way. It would need to give me native widgets of course. I would like to have a look at them before i start my own toolkit
If you think this is a stupid idea tell me why (cause everybody else is doing it differently there may be a reason i don't see)
As someone who zealously believes that GUIs should be drawn with native widgets, I must say I've been very impressed with wxWidgets, although you mention that at the beginning.
As far as I know, wxWidgets uses native widgets whenever possible, and indeed it does also include platform-specific features that are neither possible nor relevant on other platforms. A good example of this is how you can use the native Mac OS X menu, while on other systems it won't do squat. There are other and better examples.
I must mention wxPython in particular, in case you either don't want to or just don't have the time to write a C++ program. wxPython astonished me when I tried it out first, and I even managed to make a stand-alone .exe file from it that worked on a fresh install of Windows 2000 without any updates or particular runtime environments.
If wxWidgets doesn't suit your needs, I wonder what would. :) Hurray for wxWidgets!
AFAIK, wxWidgets uses the platform's native widgets whenever possible.
Have a look at SWT, it tries to use the widgets of the underlying platform as much as possible.

Haskell or Ocaml with OpenGL and SDL precompiled distribution for Windows

I want to learn Ocaml or Haskell and I want to do it by writing a simple game. Apparently, there's one small problem: nobody cares about Windows and I want to do it on Windows, natively.
Haskell has Cabal, which has SDL, but it doesn't build due to a trivial problem with no workarounds (order of parameters passed to gcc). Ocaml doesn't even have that, it's all in source packages, be it GLCaml or OcamlSDL or whatever.
Is there a place where I can get a working SDL for Haskell or Ocaml on Windows without fighting with a dozen versions of compilers?
The Haskell Platform comes with a binding to OpenGL which should work out of the box on Windows.
Concerning the SDL package on hackage, you can use cabal unpack SDL to get the source code and fix things yourself. To install the package with your changes, run cabal install in the unpacked directory. In any case, drop a line to the maintainer, I'm sure he'll help out.
It's not related to SDL, but you've mentioned OpenGL. There is LablGL binding for OpenGL in OCaml which works out of the box. Wiki example (http://en.wikipedia.org/wiki/Objective_Caml#Triangle_.28graphics.29) compiles and works just fine.
The best instructions I've found for getting SDL to work in windows with a the most recent Haskell platform can be found at this blog. I followed everything step-by-step and it worked perfectly, despite some configure error messages.
It isn't SDL but GLFW works on Windows with Haskell through Cabal.
My article High-fidelity graphics with OpenGL 2 (25th Feb 2008) explained how the GLCaml bindings can be used to write OpenGL-based applications in OCaml that use vertex and fragment shaders (a phong shader is given as an example). There are 9 articles in the OCaml Journal on OpenGL, albeit mostly using the older LablGL library for OpenGL 1.1.
I tried and failed to get OpenGL working from Haskell under Linux in 2007. The Haskell Platform may have changed that but I have neither had time to try it yet myself nor ever heard of anyone using it for this.
However, both OCaml and Haskell must rely upon fragile low-level bindings to OpenGL because they are standalone languages and nobody has ever managed to get any significant commercial software using them to work. As you're on Windows, F#+XNA is a far more logical choice because XNA is tried and tested and F# has a safe high-level interface to it. A Google fight gives you a good idea of what a pioneer you'll be: +haskell +opengl gives 437 hits on Google and +ocaml +opengl gives only 347 hits.

How do I get a common-lisp GUI in Windows?

I'm using Emacs, with CLISP and Slime, and want to be able to draw pictures on the screen. I'm specifically thinking about drawing graphs, but anything that would let me draw basic shapes and manipulate them would be able to get me started.
Doug is right; CAPI will work fine. Other things you can try:
cltk: http://www.cliki.net/Lisp-Tk
I know that Allegro has something for Windows programming also, but I've never tried it.
What may also work is cells-gtk: http://common-lisp.net/project/cells-gtk/
Again, I can only tell you that it exists but not how bad it is or if it even really works...
I can not comment also on the quality of
http://www.cliki.net/GTK%20binding
But that's mostly what is available.
Corman Lisp probably has something to offer for Windows programming also.
Anyway, the choices on Windows are relatively slim. The you can probably have the most confidence in CAPI, which is used for the LispWorks IDE on Windows, Linux, MacOS X and on quite few big unices also...
Regards
I think I've found my own answer. Clojure seems to have everything I was looking for, just because I can now use all of the Java GUI items natively in LISP. It is a different dialect of LISP than the Common-Lisp I was using, but seems to have a lot of community support, and integrates with my Windows installation of Emacs either through SLIME or through the Inferior-Lisp interpreter. So far I've been very impressed.
Oh, a code sample:
(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))
Any guesses what this does? :)
Bill Clementson's blog has quite a bit on Clojure, including a lot of helpful posts on installing it. See here: his posts on Clojure
You could switch from CLISP to the free LispWorks Personal Edition and use the CAPI Graphics Ports drawing API.
Or you could use Lisp's Foreign Function Interface and use one of the graphics toolkits available for your OS.
For rolling your own (like you said, basic shapes) try Lispbuilder-SDL or one of the cl-cairo FFIs (it's just my guess that the latter work with MS Windows, though).
I know this is an old post, but so the information is here for others like me who find this thread looking for the same thing.
This library for tk bindings in common lisp seems to work fairly well.
http://www.peter-herth.de/ltk/
Clojure is an excellent Lisp, and Swing is a solid (if not particularly visually exciting) windowing toolkit. If you want do do more advanced graphics and/or dabble with game programming you might want to check out Slick, which is a general purpose graphics/game library that sits on top of Swing and gives you access to OpenGL and lots of other stuff.
I've found the Clojure/Slick combination an excellent way to do exploratory graphics programming, as you can interact with the graphics window directly from the REPL.
There's cl-cairo2 - a binding to Cairo vector drawing library. It can be used to draw various pictures on various surfaces. There's a cl-2d library that uses cl-cairo2 to draw charts.
And there's cl-gtk2 - a binding to Gtk+ library. You can create widgets that are drawn with cl-cairo2 (or cl-2d) that draw what you want.
CLISP users might find The following useful for their graphics applications:
cl-vectors is a pure Common Lisp
library to create, transform and
render anti-aliased vectorial paths.
It can be installed using
ASDF-Install.
http://projects.tuxee.net/cl-vectors/
Vecto is a simplified interface to the
powerful CL-VECTORS vector
rasterization library....the results
can be saved to a PNG ... Since Vecto
and all supporting libraries are
written completely in Common Lisp,
without depending on external non-Lisp
libraries, it should work in any
Common Lisp environment. Vecto is
available under a BSD-like license.
The current version is 1.4.3, released
on August 26, 2009.
http://www.xach.com/lisp/vecto/

Create a small 'window-form' application that runs anywhere

I work in the embedded world, using mainly C and no GUI at all (because there is no display screen).
Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the common platforms: windows/linux/mac-os ?
I do not want to build a web-app.
I have my eye on Python and one of it's widget libraries, QT or WxWidgets. Is that a good option ?
I like GTK+ personally but that or any of the ones you mentioned should be OK. I don't know which is the best in terms of least RAM usage.
Both wx and QT have embedded/universal versions where the widgets are drawn directly.
They can both be called from python,but if you have a very small system python or py2exe might not be available.
Unless you want to embed HtmlWindow I'd go with wxWindows... works everywhere without problems so far for me.
I have both worked with PyQt and wxPython extensively.
PyQt is better designed and comes with very good UI designer so that you can quickly assemble your UI
wxPython has a very good demo and it can do pretty much anything which PyQT can do, I would anyday prefer PyQt but it may bot be free for commercial purpose but wxPython is free and is decent cross platform library.
Qt is a good choice to start with. In my opinion it has a best (easy to use, simple & informative) API Documentation. Package also includes many examples - from very basic to complex. And, yep, it`s truly crossplatform.
Check Qt Licensing page, the library is free only for GPL projects.
I`m using QDevelop as text editor, but there are many other alternatives - Eclipse, KDevelop, Code:Blocks, VS plugin & etc.
Why not use swing and java? It is quite cross platform, and looks reasonable for form apps. If you squint a bit and ignore the java, its quite pleasant - or alternatively, use one of them dynamic languages on the JVM (Groovy is my recommended one).
What kind of application is it going to be? Have you considered a web-based application instead? Web-based apps can be super flexible in that sense - you can run them on any platform that has a modern browser.
By far the simplest choice for creating native cross-platform applications is REALbasic. Give it a try and you'll have a working app for Mac OS X, Windows and Linux in minutes. No run-times or other stuff to worry about.
I think you should try Html Application.It is something like web page it contain DHTML,java script,ActiveX but it is execute like .exe .
Edit:
Sorry for advice you html application.I just know it can run on windows only.

Resources