I'm trying to store the location of a cube in the value x
and when I try and print(x)
instead of printing the location, it prints
<OpenGL.arrays.ctypesarrays.c_double_Array_4_Array_4 object at 0x043E63A0>
Extra Info:
Windows 8.1 64-Bit
Python 3.4.3 32-Bit
PyOpenGL 3.1.1 32-Bit
PyGame 32-Bit (Can't find the version)
I have admin perms on my PC and the install of PyOpenGL and PyGame seemed to go ok. Thanks. If there's anythin else you would like to see e.g. the full code for my script, just ask.
EDIT:
This question is no longer needing an answer as I've moved on from this. Thanks to all who tried to help out, you're all amazing people for giving your time to do so.
I really love people who provide answers that aren't noob-friendly.
Rafael Cardoso seems to expect you know how to use VBOs and such.
(from your wording, I can assume you hardly know much about what you're doing)
I'm not too skilled with ctypes or OpenGL.arrays,
(I just got into them last night trying to remove numpy from a GLSL 3D viewer)
but from my python experience, what he's saying is you need to do something like:
I can't really help because I have cruddy numpy installed which PyOpenGL recognizes...
So for me, glGetDoublev(GL_MODELVIEW_MATRIX) returns a disgusting
numpy.array()
object rather than anOpenGL.arrays.ctypesarrays.c_double_Array_4_Array_4
object...my tests with the above prints this:
From the way it looks, it's not very useful.
EDIT: forgot about my VM, which has a python installation without numpy :)
same result though:
EDIT2:
this works:
you really don't even need to reformat as
<OpenGL.arrays.lists.c_double_Array_4_Array_4 object at 0x015FEE90>
is a 2D iterator. ;)another example:
I just had the same problem today, even though this is an old thread. Installing Numpy solved the problem. I guess that's what
Tcll
said at the beginning, but I only realized this after I solved the problem.If you want to get the dimensions of this object, you should not use
print
as__str__()
or__repr()__
methods were not overwritten.According to the Docs , for
OpenGL.arrays.ctypesarrays
arrays, you should useCtypesArrayHandler
handler to extract information, such asdimensions(self, typeCode=None)
or view it as an array instead of an object (usingasArray(self, value, typecode=None)
).