Re: [PyOpenGL-Devel] pyopengl and pypy
Brought to you by:
mcfletch
From: rndblnch <rnd...@gm...> - 2010-12-02 13:45:40
|
i'm back with some progress. got some help from pypy-dev: 1) the first issue (missing ctypes.pythonapi) was solved with the help of pypy-dev. they suggested to replace the c functions by a pure ctype implementation (and not worry and the memory layout, since their ctypes module does "the right thing"): PyString_asString can be avoided in OpenGL/array.string.py by using def dataPointer(value): return ctypes.cast(ctypes.create_string_buffer(value), ctypes.c_void_p).value or def dataPointer(value): return ctypes.cast(ctypes.c_char_p(value), ctypes.c_void_p).value PyBuffer_FromMemory can be implemented as (not tested though, since it's only used in experimental code for vbos): def PyBuffer_FromMemory(address, length): return buffer((ctypes.c_char * length).from_address(address)) if you want, i can provide a patch for those changes. in my tree of PyOpenGL i have totally removed the references to ctypes.pythonapi and it uses the ctypes version even for cpython. you might prefer to keep your implementation and just add a fallback if ctypes.pythonapi is None. the whole thread is there for reference: <http://codespeak.net/pipermail/pypy-dev/2010q4/006452.html> 2) the second issue (missing _CDada_intput) is from pypy. the good news is that it has already been fixed by Amaury Forgeot d'Arc in the fast-forward branch (aiming at cpython 2.7 compatibility). the patch (requires some adaptation to apply on pypy-1.4) can be found there: <http://codespeak.net/pipermail/pypy-svn/2010-November/045106.html> so far, i have managed to partially run the programs of my small opengl tutorial, i.e. a sample program that use most of the functionalities of the fixed pipeline and that is evolved step by step into a shader based implementation. what runs for the moment (with minor errors): - 01-direct.py (direct rendering, some geometry + 3d texture) - 02-displaylist.py - 03-array.py (use of Vertex/.../NormalPointer) - 04-vbo.py (idem + VBOs to pass the data) what does not run: the rest that uses shaders, but i'm pretty confident it's a minor issue (wrong types in glShaderSource arguments) the programs are based on pyopengl and can be found here: <http://bitbucket.org/rndblnch/opengl-programmable/> |