Re: glGenVertexArrays present with python/ absent with python3

rndblnch <[email protected]> Thu, 16 Jan 2014 09:18:29 +0000 (UTC)
Newsgroups gmane.comp.python.opengl.user
Message-ID <[email protected]>
rndblnch <rndblnch <at> gmail.com> writes:

> 
> Hello,
> 
> I am experimenting with OpenGL 3.2 core using PyOpenGL 3.0.2
> I am experiencing something strange: a function (glGenVertexArrays) that is
> present when I use python 2.7 is absent when I use python 3.3.
> Maybe the automatic conversion from 2to3 breaks something?

Hello again, found the pb: OpenGL.extensions.VERSION_EXTENSIONS contains
extension names as strings, but they should be bytes on python3.
the patch below corrects that:


diff -ru PyOpenGL-3.0.2/OpenGL/extensions.py
PyOpenGL-3.0.2-mine/OpenGL/extensions.py
--- PyOpenGL-3.0.2/OpenGL/extensions.py	2012-09-15 06:28:20.000000000 +0200
+++ PyOpenGL-3.0.2-mine/OpenGL/extensions.py	2014-01-16 10:10:54.000000000 +0100
@@ -17,66 +17,66 @@
 # version tuple -> list of implicitly included extensions...
 VERSION_EXTENSIONS = [
     ((3,0), [
-        'GL_ARB_vertex_array_object',
-        'GL_ARB_texture_buffer_object',
-        'GL_ARB_framebuffer_object',
-        'GL_ARB_map_buffer_range',
+        as_8_bit('GL_ARB_vertex_array_object'),
+        as_8_bit('GL_ARB_texture_buffer_object'),
+        as_8_bit('GL_ARB_framebuffer_object'),
+        as_8_bit('GL_ARB_map_buffer_range'),
     ]),
     ((3,1), [
-        'GL_ARB_copy_buffer',
-        'GL_ARB_uniform_buffer_object',
+        as_8_bit('GL_ARB_copy_buffer'),
+        as_8_bit('GL_ARB_uniform_buffer_object'),
     ]),
     ((3,2), [
-        'GL_ARB_draw_elements_base_vertex',
-        'GL_ARB_provoking_vertex',
-        'GL_ARB_sync',
-        'GL_ARB_texture_multisample',
+        as_8_bit('GL_ARB_draw_elements_base_vertex'),
+        as_8_bit('GL_ARB_provoking_vertex'),
+        as_8_bit('GL_ARB_sync'),
+        as_8_bit('GL_ARB_texture_multisample'),
     ]),
     ((3,3), [
-        'GL_ARB_texture_multisample',
-        'GL_ARB_blend_func_extended',
-        'GL_ARB_sampler_objects',
-        'GL_ARB_explicit_attrib_location',
-        'GL_ARB_occlusion_query2',
-        'GL_ARB_shader_bit_encoding',
-        'GL_ARB_texture_rgb10_a2ui',
-        'GL_ARB_texture_swizzle',
-        'GL_ARB_timer_query',
-        'GL_ARB_vertex_type_2_10_10_10_rev',
+        as_8_bit('GL_ARB_texture_multisample'),
+        as_8_bit('GL_ARB_blend_func_extended'),
+        as_8_bit('GL_ARB_sampler_objects'),
+        as_8_bit('GL_ARB_explicit_attrib_location'),
+        as_8_bit('GL_ARB_occlusion_query2'),
+        as_8_bit('GL_ARB_shader_bit_encoding'),
+        as_8_bit('GL_ARB_texture_rgb10_a2ui'),
+        as_8_bit('GL_ARB_texture_swizzle'),
+        as_8_bit('GL_ARB_timer_query'),
+        as_8_bit('GL_ARB_vertex_type_2_10_10_10_rev'),
     ]),
     ((4,0), [
-        'GL_ARB_texture_query_lod',
-        'GL_ARB_draw_indirect',
-        'GL_ARB_gpu_shader5',
-        'GL_ARB_gpu_shader_fp64',
-        'GL_ARB_shader_subroutine',
-        'GL_ARB_tessellation_shader',
-        'GL_ARB_texture_buffer_object_rgb32',
-        'GL_ARB_texture_cube_map_array',
-        'GL_ARB_texture_gather',
-        'GL_ARB_transform_feedback2',
-        'GL_ARB_transform_feedback3',
+        as_8_bit('GL_ARB_texture_query_lod'),
+        as_8_bit('GL_ARB_draw_indirect'),
+        as_8_bit('GL_ARB_gpu_shader5'),
+        as_8_bit('GL_ARB_gpu_shader_fp64'),
+        as_8_bit('GL_ARB_shader_subroutine'),
+        as_8_bit('GL_ARB_tessellation_shader'),
+        as_8_bit('GL_ARB_texture_buffer_object_rgb32'),
+        as_8_bit('GL_ARB_texture_cube_map_array'),
+        as_8_bit('GL_ARB_texture_gather'),
+        as_8_bit('GL_ARB_transform_feedback2'),
+        as_8_bit('GL_ARB_transform_feedback3'),
     ]),
     ((4,1), [
-        'GL_ARB_ES2_compatibility',
-        'GL_ARB_get_program_binary',
-        'GL_ARB_separate_shader_objects',
-        'GL_ARB_shader_precision',
-        'GL_ARB_vertex_attrib_64bit',
-        'GL_ARB_viewport_array',
+        as_8_bit('GL_ARB_ES2_compatibility'),
+        as_8_bit('GL_ARB_get_program_binary'),
+        as_8_bit('GL_ARB_separate_shader_objects'),
+        as_8_bit('GL_ARB_shader_precision'),
+        as_8_bit('GL_ARB_vertex_attrib_64bit'),
+        as_8_bit('GL_ARB_viewport_array'),
     ]),
     ((4,2), [
-        'GL_ARB_base_instance',
-        'GL_ARB_shading_language_420pack',
-        'GL_ARB_transform_feedback_instanced',
-        'GL_ARB_compressed_texture_pixel_storage',
-        'GL_ARB_conservative_depth',
-        'GL_ARB_internalformat_query',
-        'GL_ARB_map_buffer_alignment',
-        'GL_ARB_shader_atomic_counters',
-        'GL_ARB_shader_image_load_store',
-        'GL_ARB_shading_language_packing',
-        'GL_ARB_texture_storage',
+        as_8_bit('GL_ARB_base_instance'),
+        as_8_bit('GL_ARB_shading_language_420pack'),
+        as_8_bit('GL_ARB_transform_feedback_instanced'),
+        as_8_bit('GL_ARB_compressed_texture_pixel_storage'),
+        as_8_bit('GL_ARB_conservative_depth'),
+        as_8_bit('GL_ARB_internalformat_query'),
+        as_8_bit('GL_ARB_map_buffer_alignment'),
+        as_8_bit('GL_ARB_shader_atomic_counters'),
+        as_8_bit('GL_ARB_shader_image_load_store'),
+        as_8_bit('GL_ARB_shading_language_packing'),
+        as_8_bit('GL_ARB_texture_storage'),
     ]),
 ]
 





------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net