473,623 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

save an opengl canvas (wxPython)


Hi,

I've a drawing made in an OpenGL canvas. I want to save it to a file
(preferibly PostScript format). Somebody knows how to do it?

TIA

Zunbeltz

--
Zunbeltz Izaola Azkona | wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila |
Zientzia eta Teknologia Fakultatea | Phone: 34946015326
Euskal Herriko Unibertsitatea |
PK 644 | Fax: 34 944648500
48080 Bilbo (SPAIN) |
Jul 18 '05 #1
2 2738
There's sample code in PyOpenGL and OpenGLContext for saving canvases to
PNG or JPEG formats using PIL. Saving to Postscript requires
considerably more work (if you're implying saving as triangles, lines
and the like). There is a GPL library which lets you do this, and I
have an old SWIG wrapper for it sitting around somewhere (I think,
haven't touched it in years), but even then, it's fairly poor quality
compared to capturing a bitmap image.

Anyway, the function for reading a buffer is glReadPixels:
http://pyopengl.sourceforge.net/docu...dPixels.3G.xml
see the end of that man page for pointers to Python sample code.

Good luck,
Mike

Zunbeltz Izaola wrote:
Hi,

I've a drawing made in an OpenGL canvas. I want to save it to a file
(preferibly PostScript format). Somebody knows how to do it?

TIA

Zunbeltz

_______________ _______________ _______________ ___
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com

Jul 18 '05 #2
"Mike C. Fletcher" <mc******@roger s.com> writes:
There's sample code in PyOpenGL and OpenGLContext for saving canvases
to PNG or JPEG formats using PIL. Saving to Postscript requires
considerably more work (if you're implying saving as triangles, lines
and the like). There is a GPL library which lets you do this, and I
have an old SWIG wrapper for it sitting around somewhere (I think,
haven't touched it in years), but even then, it's fairly poor quality
compared to capturing a bitmap image.

Anyway, the function for reading a buffer is glReadPixels:
http://pyopengl.sourceforge.net/docu...dPixels.3G.xml
see the end of that man page for pointers to Python sample code.

Good luck,
Mike


Hi Mike,

Thanks for the answer. I'll check the code. For the moment png or jpeg
is ok, but maybe in the future i'll like to save the image as
postscript to use it with LaTeX font and so on. I've se the gl2ps
library and the last version is 21 September 2004. Can you send me
the SWIG file? I don't know much about swig and it would be easier
to start with a file that has work in same older version.

Thanks again

Zunbeltz

--
Zunbeltz Izaola Azkona | wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila |
Zientzia eta Teknologia Fakultatea | Phone: 34946015326
Euskal Herriko Unibertsitatea |
PK 644 | Fax: 34 944648500
48080 Bilbo (SPAIN) |
Jul 18 '05 #3

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

Similar topics

9
3187
by: Rick Muller | last post by:
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...
5
6478
by: Andrew Dalke | last post by:
I've been looking for a decent 3D plotting library with support for user selection that works under OpenGl, preferable with wxPython. For this first project I need to do a 3D scatter plot with different colors and glyphs (spheres, crosses, etc.) for the points. The axes will be labeled and I would like both mouseover and mouse click selection. There will be at most 2,000 points. I've found several for making graphs, like DISLIN, but...
0
1316
by: Antti Isomursu | last post by:
Ok, this is my problem: I have succesfully created an image by pasting smaller images into area, created with canvas method: >>> canvas = Canvas(win, width=canvasX, height=canvasY, background='white') """ Then I add images to picture using line below """ >>> canvas.create_image(ax, yy, anchor='nw', image=testi) So, I got the image i wanted. How can I now save that picture as an
4
4114
by: tobfon | last post by:
I'm creating a scientific visualization application with rather high demands on performance. I've created a nice rendering engine for it in C++/OpenGL and a python interface to the rendering engine. Now I'm looking to build a GUI in python with the rendering engine as an integrated window. I will most likely use wxPython for the GUI and I know it has support for adding an OpenGL canvas. After looking around in these groups and others it...
16
2590
by: nelson - | last post by:
hi! i want to build up a simple 3d interactive geometry application in python. Since i want to run it without 3D acceleration (a scene will be quite simple) I was wondering if there was a library in python that allow me to build 3D graphic without the need to use OpenGL.... I google but i can't find nothing interesting... (the best would be a pure python solution) Thanks, nelson
9
7499
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?
0
980
by: Hank Gong | last post by:
Hi, all I programmed by python to draw some simple images on the canvas in wxPython. I found there is a PostScriptDC in wxPython. However, I can not find an example about how to use it. Can anyone give me a simple example to show how to do it?
0
1346
by: eric dexter | last post by:
I am looking for a simple example of moving a bitmap on a wxpython canvas. I am wanting to do something that most people do with pygame (because pygame is slow but working on my computer may be my graphics card). I have been searching through google and I haven't found that much (found some tkinter stuff though)... any help would be nice.
0
8227
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8670
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7150
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...
1
6106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
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
4074
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4164
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2602
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
1
1778
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.