473,387 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Advice needed: large OpenGL + Widgets Project for Molecular Graphics

I have a problem that I would like to get some advice on from other
Pythonistas. I currently manage a (soon to be) open source project for
displaying molecular graphics for a variety of different programs. To
do this I need to draw pictures of the molecules, typically using
OpenGL, and do some basic control, using some widget set.

The code currently uses GTK, and runs on Macintosh OS X under Fink,
and Linux. I would like to support the "normal" (i.e. non-Fink)
distribution on Macintosh, as well as Windows. I'm currently in the
process of doing the Windows port, and it's been harder than I had
hoped, although I haven't given up quite yet.

But the porting issue is the main problem with the code so far. I'd
like this project to be something that gets other people excited about
Python here, but I'm afraid that the installation issues is going to
make people say things like "see, Java is better after all". So I'm
seriously thinking about switching widget sets sometime down the road,
to try and get a more cross platform application.

One thing that really puzzles me is how rare putting an OpenGL window
inside of a widget seems to be. Togl is either dead or is
dying. Gtk.GLArea is either dead or dying as well. Gtk.GLExt seems to
be doing well, and wxPython.glcanvas works nicely. In making these
module decisions I normally try to figure out what most people do,
with the reasoning that whatever option that is will be the best
supported choice. However, it seems that *no one* is really interested
in putting an OpenGL panel inside of a widget. Please tell me I'm
wrong!

What follows are the options I'm considering. I would be grateful for
any advice other python programmers can offer.

1. GTK/PyGTK/PyOpenGL/GTK.GLArea
Advantages: This is the path of least resistance, since this is
what the program already uses. Currently works well, looks nice,
and seems stable.

Disadvantages: GTK isn't really a standard on Windows, and can be
problematic on other non-Linux platforms (such as Macintosh/Aqua).
Plus, the number of different packages that need to be installed is
daunting. Finally, GTK.GLArea is either dead or dying, so I would
probably have to distribute this module myself.

2. GTK/PyGTK/PyOpenGL/GTK.GLExt
Advantages: Upgrade to the GTK.GLExt method of putting an OpenGL
window inside a widget. Looks better and is supported.

Disadvantages: Need to rewrite some of the uglier code (which
probably needs to be rewritten anyway) that uses GTK.GLArea. Still
requires a long list of modules to be installed. And GTK still is
not a standard library outside of Linux.

3. Tkinter/PyOpenGL/Togl
Advantages: Least amount of modules to install.

Disadvantages: Tk is ugly. Tk is old. Tk doesn't look good on
Macintosh/Aqua. Togl is either dead or dying?

4. wxPython/PyOpenGL
Advantages: Seems to be a healthy, integrated solution to putting
an OpenGL window inside of a widget. Pretty widgets, and lots of
fancy features.

Disadvantages: The OpenGL install still crashed under Windows. A
widget set that not many people use? Also requires the most amount
of code rewrite, although if it's the best option it isn't a
problem.

5. Other ideas:
It is a sign of my own desperation that I'm even considering things
like writing a canvas widget that can draw balls and sticks, and
then just doing the matrix algebra in NumPy, rather than using
OpenGL.

Thanks in advance for any help or sympathy that people can offer.
Jul 18 '05 #1
9 3170
DH wrote:
....
The problem I have though is - can you have an opengl canvas in the
same window with other wxpython controls. I've done this in java,
basic and C, but the wxpython demo only showed opengl animations
running in their own window. This is my problem with vpython and sdl
too. I want something that can be embedded in a tk/wx/qt/gtk window
with other controls, even other opengl canvases. At the C level, it's
just a matter of clipping the drawing and switching the current
drawing context.


This works fine. See the browser sub-package of OpenGLContext for a
demo. See also much simpler demo in
OpenGLContext/tests/wx_with_controls.py, which just puts a button and a
wxPython Context (derived from wxGLCanvas) on a window and uses the
button to start/stop the animation. PyOpenGL and wxPython are both just
thin wrappers around their respective C/C++ libraries, so most of the
functionality in the lower levels is available.
Disadvantages: The OpenGL install still crashed under Windows. A
widget set that not many people use? Also requires the most amount
of code rewrite, although if it's the best option it isn't a
problem.


Yeah, it doesn't work on Windows for me either with python 2.3. It
used to work with python 2.2. Now it complains about not finding glut.


If you encounter a bug like this, please submit a bug-report to the
project so that it can be fixed. As a quick check though, you did
install the GLUT binary package in your system32 directory, right?
PyOpenGL doesn't include the GLUT library itself, only a binding for it.

Have fun,
Mike

_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/

Jul 18 '05 #2
an***@vredegoor.doge.nl (Anton Vredegoor) wrote in message >
VPython [1] seems to combine all requirements, OpenGl and NumPy
integration, easy to install and use, and at least in my case it makes
one very enthusiastic about 3-d programming in Python.


I'm a long-time fan of VPython, but I didn't think it provided
widgets. Can I use some widget set to make buttons to control
applications?
Jul 18 '05 #3
"Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>...
For balls and sticks this is a pretty trivial task. 4th year comp-sci
students are made to do this (well, a lot more) for creating ray-trace
renderers in their computer graphics courses. However, being able to
load everything into the hardware buffers of a video card is pretty hard
to beat as a performance path.
Sorry, I didn't explain my own sarcasm. Writing the code isn't the
problem, it's generating an interface that looks nice and performs
well that is why I think this is only worthy of humorous mention.
Although the JMol project (http://jmol.sf.net) has done a surprisingly
good job with this type of graphics.
Thanks in advance for any help or sympathy that people can offer.

Hmm, sympathy? You get to work on graphics and you want sympathy? Some
of us would *kill* to have the time to work on graphics ;) .

Thanks for putting this in perspective!
Jul 18 '05 #4
"Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>...
Rick Muller wrote:
...
3. Tkinter/PyOpenGL/Togl
Advantages: Least amount of modules to install.

Disadvantages: Tk is ugly. Tk is old. Tk doesn't look good on
Macintosh/Aqua. Togl is either dead or dying?

Togl is pretty much history. I'll likely fix the installer one last
time for the next bug-fix release (2.0.2) and then drop the thing. I've
been looking for someone who uses Tkinter+Togl to champion maintenance
of the thing for years and never found anyone interested enough to
bother. I'm not a huge fan of Tkinter either, for that matter.


Help me out with this: is it that the togl project is history, or that
the Python bindings for Togl are history? I've poked around the Togl
website (http://togl.sf.net), and I'm not overwhelmed with new
releases. Plus, there don't seem to be many posts to the mailing list
in the last year.

But I'm amazed that more people don't need to put an OpenGL window in
a graphical widget -- seems like a common task. How do people do this?

Thanks for the responses!
Jul 18 '05 #5
ri*********@yahoo.com (Rick Muller) wrote:
I'm a long-time fan of VPython, but I didn't think it provided
widgets. Can I use some widget set to make buttons to control
applications?


Look in the demos directory. A two-button mouse would be handy.

Anton

Jul 18 '05 #6
Rick Muller wrote:
"Mike C. Fletcher" <mc******@rogers.com> wrote in message news:<ma***********************************@python .org>...

....
Togl is pretty much history. I'll likely fix the installer one last
time for the next bug-fix release (2.0.2) and then drop the thing. I've
been looking for someone who uses Tkinter+Togl to champion maintenance
of the thing for years and never found anyone interested enough to
bother. I'm not a huge fan of Tkinter either, for that matter.


Help me out with this: is it that the togl project is history, or that
the Python bindings for Togl are history? I've poked around the Togl
website (http://togl.sf.net), and I'm not overwhelmed with new
releases. Plus, there don't seem to be many posts to the mailing list
in the last year.

Togl the Tcl/Tk project is moribund, but then, it's very old technology
that's been stable for years. Togl is just setting up a context for
Tkinter and hooking it up to various event handlers. For the most part
all GUI-library interfaces can be similarly static. The only problems
that come up with it in an average year are configuration and
installation ones. It's the Tkinter binding that's on it's way to the
graveyard, precisely because of those configuration and installation
headaches.

For instance, the upgrade of Tkinter to 8.4 in Python 2.3.x broke the
Togl install for us (it's still broken). It's possible to build and
install the widget manually, but the automated installer fails due to
some deep Tk or Tcl or Togl bug. Working around that is fairly trivial,
but it means going back and reworking the installer's Togl code... not a
big deal... but nowhere near the top of my list of priorities for the
few hours I get now and then to work on the project. So, the 8 or 9
line change doesn't get done, and the Tkinter/Togl binding languishes
(and eventually dies). The problems aren't huge, they just don't have
anyone available who's actually using the library and willing to
find/fix them.
But I'm amazed that more people don't need to put an OpenGL window in
a graphical widget -- seems like a common task. How do people do this?

wxPython.

I think there's a few with GTK, Qt and Fox as well, all of which can mix
in widgets fine, but I don't hang out on those user-groups any more to
hear from them and thus be able to say for sure. In all fairness, there
are also lots of people who have, in the past, used Tkinter/Togl, but
since they're not willing to speak up and help with the maintenance I
don't feel the need to plug their platform (in either applicable sense
of the word) ;) .

Have fun,
Mike

_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/

Jul 18 '05 #7
DH
Yeah, it doesn't work on Windows for me either with python 2.3. It
used to work with python 2.2. Now it complains about not finding glut.

If you encounter a bug like this, please submit a bug-report to the
project so that it can be fixed. As a quick check though, you did
install the GLUT binary package in your system32 directory, right?
PyOpenGL doesn't include the GLUT library itself, only a binding for it.


I never installed OpenGL or GLUT. OpenGL comes with Windows. In python
2.2 everything worked fine. Does the python 2.3 version not weak link
glut or something?
Jul 18 '05 #8
DH wrote:
....
I never installed OpenGL or GLUT. OpenGL comes with Windows. In
python 2.2 everything worked fine. Does the python 2.3 version not
weak link glut or something?


No version of PyOpenGL 2.x has, to my knowledge, ever included GLUT.
Could be you installed it without noticing? It's not a complex process
after all, just drag a single DLL to a directory in the system path.
I've been known to forget doing such things in the past. That said,
could be that something is importing OpenGL.GLUT from the Python side
that wasn't importing it before... don't know what that would be, though.

<shrug>Otherwise engaged at the moment, so little time to explore.</shrug>

Have fun,
Mike

_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/

Jul 18 '05 #9
Just wanted to put a plug for our Python-controlled molecular viewer,
see http://www.cgl.ucsf.edu/chimera/. We use Togl and Tkinter and
while I'm annoyed that my patches to Togl were never accepted, I use
them and they're on sourceforge. There are chimera distributions for
x86-Windows, x86-linux/X11, OS X/X11, OS X/Aqua, Irix/X11, and
Tru64/X11. We've gone to bundling everything up into one
self-extracting zip file (a disk image for OS X) to avoid the hassle of
having the user install the 20 different packages that we depend on.
Chimera is only 90% open source at this time but for anybody who will
really do something with the source, we'll open up the rest (except for
the MSMS package from Scripps that we have no control over).

Good luck,

Greg Couch
UCSF Computer Graphics Lab
gregc at cgl dot ucsf dot edu
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Csaba Gabor | last post by:
Where do I get the appropriate data to draw a good political map of the world and each continent? This may seem somewhat off topic (at first), but these two groups are heavily user presentation...
10
by: Bad_Kid | last post by:
which is better for what?
0
by: Scott Chang | last post by:
Hi all, I tried to use Managed C++ coding of VC++.NET (2002)and OpenGL version 1.2 to draw a hexagon shape of benzene. My OpenGLdrawBenzene.cpp is the following: // This is the main project file...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
14
by: Jessica Weiner | last post by:
I am writing an application in C# which need to plot graphs and simple shapes (polygons, circles, squares etc). Which library is better for this purpose and why? Thanks.
9
by: Achim Domma | last post by:
Hi, I'm developing a GUI app in Python/C++ to visualize numerical results. Currently I'm using Python 2.4 with wx and PyOpenGLContext, but there are no windows binaries for Python 2.5 for quite...
4
by: math2life | last post by:
I work with python for two years, are familiar with image processing, but beginner on PyOpenGL and OpenGL. Any advice appreciated!
3
by: Andy Cheesman | last post by:
Dear People, I was wondering if people could recommend a simple molecular viewing package written in python. I'm working in Theoretical chemistry and I'm not after an all-singing dancing...
3
by: goku77 | last post by:
Hi i want to do a graphics project in Vb.net but have to use OpenGl Libraries . How do i download compatible OpenGl package and how to use them in my .net code.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.