I'm trying to make a 3d model using pygame, OpenGL and numpy, while running this script I run into the following Errors
Traceback (most recent call last:
File "C:\Users\[I]Username[/I]\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\latebind.py", line 41, in __call__
return self._finalCall(*args,**named)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\[I]Username[/I]\Desktop\Python-graphic-game\3d-game\model.py", line 60, in <module>
main()
File "C:\Users\[I]Username[/I]\Desktop\Python-graphic-game\3d-game\model.py", line 56, in main
m.draw()
File "C:\Users\[I]Username[/I]\Desktop\Python-graphic-game\3d-game\model.py", line 35, in draw
glVertex3fv(self.vertices[vertex])
File "C:\Users\[I]Username[/I]\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\latebind.py", line 45, in __call__
return self._finalCall(*args,**named)
File "C:\Users\[I]Username[/I]\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\wrapper.py", line 675, in wrapper call
pyArgs = tuple(calculate_pyArgs(args))
File "C:\Users\[I]Username[/I]\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\wrapper.py", line 436, in calculate_pyArgs
yield converter(args[index], self, args)
File "C:\Users\[I]Username[/I]\AppData\Local\Programs\Python\Python36-32\lib\site-packages\OpenGL\arrays\arrayhelpers.py", line 122, in asArraySize
incoming,
ValueError: ('Expected 12 byte array, got 8 byte array', (0,1), <function asArrayTypeSize.<locals>.asArraySize at 0x09212588>)
Here is the code in question:
import sys, pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy
class threeDModel:
nodes = [
[0,0,0],
[1.1,1.1,0],
[0,-1.1,0],
[0,-1.1,-1.1]
]
vertices = [
(0,1),
(0,2),
(0,3),
(1,2),
(1,3),
(2,3)
]
surfaces = (
(0,1,2),
(0,2,3)
)
def __init__(self):
self.nodes = threeDModel.nodes
self.vertices = threeDModel.vertices
self.surfaces = threeDModel.surfaces
def draw(self):
glBegin(GL_TRIANGLES)
for surface in self.surfaces:
for vertex in surface:
glColor3f(1,0,0)
glVertex3fv(vertices[vertex])
glEnd()
So can anybody help me?
This is my first time using OpenGL, so please be nice to me.
I am also using the tutorials by Tech with Tim, that's why I'm using the from module import *, even though I know I'm not supposed to use it.
Thanks in advance!