Re: pyopengl and pypy
rndblnch <[email protected]> Thu, 2 Dec 2010 13:45:13 +0000 (UTC)
| Newsgroups | gmane.comp.python.opengl.devel |
|---|---|
| Message-ID | <[email protected]> |
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/>
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net