Programming Society

Latest: Revisiting PyQt and OpenGL

Published Qua 23 Julho 2014 in Graphics.

It's been I while since I used OpenGL with PyQt, for example in my live coding experiments with GLSL shaders. Those were still done with PyQt4 and the good old QGLWidget. In Qt5 the preferred way to render in OpenGL canvases is to use the new QOpenGL* classes. Those have the advantage that they provide a full collection of OpenGL drawing functions, so it is not necessary to import any external OpenGL library (like PyOpenGL) anymore. The disadvantage is that there is currently no convenient way to create and initialize such a window with a nice render function, as was provided by the QGLWidget.

I finally collected some code from the PyQt5 OpenGL examples and with some modification I was able to run it (from the snapshot of PyQt5 on Github). Their class OpenGLWindow provides what you need for the first steps, you can just subclass it and add your code to your own render() function. I added some more interesting shaders from here, et voilà le chocolat:

https://github.com/pbouda/stuff/blob/master/opengl/pyqt/chocolux.py

Time to connect this with some live coding...

There are comments.

Other articles

Visualizing Swadesh words in dictionaries

Published Sex 14 Fevereiro 2014 in Language.

Swadesh viewer for dictionary data

In this tutorial we will demonstrate how to extract entries that contain words from a Swadesh list from data in digitized dictionaries. The translation graph connects entries in dioctionaries, via annotation for "heads" and "translations" within the dictionary. We will demonstrate how to visualize this ...

read more

There are comments.


Creating a dictionary: Excel to Toolbox conversion

Published Qui 29 Agosto 2013 in Language.

In our current dictionary project "Bilingual Dictionary Piação-Portuguese" we decided to use Microsoft Excel to edit the dictionary data. This choice had some pragmatic reasons, like that most people/linguists can easily work with a stylesheet, even if they don't know about all the features of Excel, and that ...

read more

There are comments.


Live coding GLSL shaders with IPython

I recently started to learn some OpenGL and was looking for a nice way to use Python for this. I wanted to be able to update the shaders quickly so that I can quickly try out different code. This is one of the results. I was heavily inspired by the ...

read more

There are comments.