opengl - PyOpenGL Cube Mapping Textures -


i've tried texture_2d push textures on cube. thats no problem.

but when use texture_cube_map textures aren't visible. black cube.

can me?

#### init function textureids = glgentextures(1)                                                                                                                                                                                                         glbindtexture(gl_texture_cube_map, textureids)                                                                                                                                                                                       gltexparameteri(gl_texture_cube_map, gl_texture_wrap_s, gl_clamp_to_edge)                                                                                                                                                            gltexparameteri(gl_texture_cube_map, gl_texture_wrap_t, gl_clamp_to_edge)                                                                                                                                                            gltexparameteri(gl_texture_cube_map, gl_texture_wrap_r, gl_clamp_to_edge)                                                                                                                                                            gltexparameteri(gl_texture_cube_map, gl_texture_mag_filter, gl_linear)                                                                                                                                                               gltexparameteri(gl_texture_cube_map, gl_texture_min_filter, gl_linear)     glteximage2d(gl_texture_cube_map_positive_x, 0, gl_rgb, imgraw.size[0], imgraw.size[1], 0, gl_rgb, gl_unsigned_byte, img)                                                                                                              ..... (for other 5 also)   ####display function glenable(gl_texture_gen_s)                                                                                                                                                                                                           glenable(gl_texture_gen_t)                                                                                                                                                                                                           glenable(gl_texture_gen_r)                                                                                                                                                                                                           glenable(gl_texture_cube_map)                                                                                                                                                                                                         glenableclientstate(gl_vertex_array)                 myvbo.bind()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    gluseprogram(program) #shader frag , vert                                                                                                                                                                                                                varlocation = glgetuniformlocation(program, "mvpmatrix")                                                                                                                                                                             gluniformmatrix4fv(varlocation , 1, gl_true, mvpmat.tolist())                                                                                                                                                                          glvertexpointer(3, gl_float, 32, myvbo)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         glbindtexture(gl_texture_cube_map, textureids)                                                                                                                                                                                      gldrawarrays(gl_quads, 0 ,len(data))                                                                                                                                                                                                 myvbo.unbind()                             

a cube map not literal "put texture on cube." kind of texture, separate 2d, 3d, etc texture types.

a 2d texture 2d image use position in 2d space access. 3d texture 3d image use position in 3d space access. cube map set of 6 2d images use 3d direction access. imagine sitting in center of cube. in every direction location on cube. that's color accessing cube map given direction.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -