If you want to use a 2D Array Texture for a cube, each of the 6 textures for the 6 side must be the same size. You can provide the index by a Uniform variable or even by a 3rd component in the texture coordinate attribute. Index is the index of the addressed texture in the array. Uniform sampler2D texture uniform sampler2Darray texture įor 2 dimensional array textures, 3 dimensional texture coordinates are required (See texture):įragColor = texture(texture, TexCoord) FragColor = texture(texture, vec3(TexCoord.st, index)) The proper sampler type for (floating point) GL_TEXTURE_2D_ARRAY is sampler2Darray(See Sampler types):
![max opengl 4.4 textures max opengl 4.4 textures](https://i.stack.imgur.com/9GkBC.png)
The glsl sampler type has to match the texture target. You have to switch to OpenGL Shading Language 1.40:Īnyway you've mentioned that in your question - "I need at least version 1.40 because in 1.40 layout was introduced " Vertex shader input Layout Qualifier are not supported in OpenGL Shading Language 1.30. Print(glGetString(GL_SHADING_LANGUAGE_VERSION)) Log current version after creating the OpenGL window and making the context current: print(glGetString(GL_VENDOR)) It just means that OpenGL functions added later may be missing from the PyOpenGL API. PyOpenGL guarantees, that the OpenGL API is implemented up to version 4.4, but you can also use a higher version. You can use any GLSL version which is supported by the current OpenGL context. The OpenGL context version only depends on the graphics card. In any case, the "supported" version only refers to OpenGL API. Compare OpenGL specification - Khronos OpenGL registry and OpenGL ES Specification - Khronos OpenGL ES Registry. You confused (desktop) OpenGL and OpneGL ES. PyOpenGL supports OpenGL ES versions from 1.0 to 3.1 and all desktop OpenGL version from 1.1 to 4.4 (See About PyOpenGL). If you need any more information, just ask in the comments and I will add it. GlTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) GlTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) GlTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR) GlTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR) GlTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width, height, layerCount, GL_RGBA, GL_UNSIGNED_BYTE, texels) GlTexStorage3D(GL_TEXTURE_2D_ARRAY, mipLevelCount, GL_RGBA8, width, height, layerCount) GlBindTexture(GL_TEXTURE_2D_ARRAY, texture) Loading the array texture: def load_texture_array(path,width,height):
MAX OPENGL 4.4 TEXTURES CODE
Here are some of my code snippets if they are required. I'm trying to texture each side of a cube differently using array textures. I need at least version 1.40 because in 1.40 layout was introduced and I need to use layout to get the texture coordinates.
![max opengl 4.4 textures max opengl 4.4 textures](https://i.stack.imgur.com/FWwre.png)
I was trying to texture a cube in PyOpenGL when I ran into an issue.