473,748 Members | 10,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.glcanv as 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 3194
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_control s.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******@roger s.com> wrote in message news:<ma******* *************** *************@p ython.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******@roger s.com> wrote in message news:<ma******* *************** *************@p ython.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*********@yah oo.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******@roger s.com> wrote in message news:<ma******* *************** *************@p ython.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>Otherwis e 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
1895
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 oriented, so please bear with my oblique query... I have a potential project coming up, with an initial meeting in a few days. The basic project is to have a world map, click over any continent any you get an image map for that continent. Now...
10
5220
by: Bad_Kid | last post by:
which is better for what?
0
3644
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 for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #include <stdlib.h>
1
9649
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 and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
14
2657
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
7505
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 some time now. I need a OpenGL context without restrictions and some settings dialogs. Is wx + PyOpenGL the way to go? Or could somebody recommend a better set of tools/libs?
4
3357
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
3317
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 molecular rendering package(pymol does that rather well) but a program which reads XYZ files and displays simple structures which can be rotated in 3D Thanks
3
3034
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
9363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.