Skip to content

type error when converting gl texture handle to c_void_p #20

@jzitelli

Description

@jzitelli

I experience the following error when running the hello_* examples using 64-bit Python 3.5 (Anaconda distribution):

$ python hello_sdl2.py
SdlApp exiting
Traceback (most recent call last):
  File "hello_sdl2.py", line 20, in <module>
    app.run_loop()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 122, in run_loop
    self.render_scene()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 79, in render_scene
    self.init_gl() # should be a no-op after the first frame is rendered
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 74, in init_gl
    self.renderer.init_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 153, in init_gl
    self.left_fb.init_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 98, in init_gl
    self.texture.handle = self.resolve_texture_id
TypeError: cannot be converted to pointer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "hello_sdl2.py", line 20, in <module>
    app.run_loop()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 47, in __exit__
    self.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\glframework\sdl_app.py", line 90, in dispose_gl
    self.renderer.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\gl_renderer.py", line 217, in dispose_gl
    actor.dispose_gl()
  File "C:\Users\zemed\Anaconda3\lib\site-packages\openvr\color_cube_actor.py", line 119, in dispose_gl
    glDeleteVertexArrays(1, (self.vao,))
AttributeError: 'ColorCubeActor' object has no attribute 'vao'

I changed the handle field in the Texture_t ctypes structure from c_void_p to c_uint32 and the problem was fixed... my understanding is that the handles/ids generated by OpenGL will always be 32 bit unsigned int, regardless of the client (32 vs. 64 bit) platform, so c_uint32 is the appropriate type if you are running 64-bit libs. Does that sound right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions