In a fragment shader, why can’t I use a flat input integer to index a uniform array of sampler2D?

[…] but can’t use it to index an array of samplers as expected because compiler sees it as “non-constant” […] In GLSL up to version 3.30 respectively GLSL ES up to version 3.00, the index of an array of texture samplers has to be a constant expression: GLSL 3.30 Specification – 4.1.7 Samplers (page 21) … Read more

Android OpenGL Texture Compression

There are mainly four texture compression types supported on Android: ETC1 (Ericsson texture compression). This format is supported by all Android phones. But, it doesn’t support an alpha channel, so can only be used for opaque textures. PVRTC (PowerVR texture compression). Supported by devices with PowerVR GPUs (Nexus S, Kindle fire, etc.). ATITC (ATI texture … Read more

Render OpenGL scene to texture using FBO in fixed function pipeline drawing

When I compared your code with mine working engine I see these differences so try them one by one: texture format you are using: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, screen_width, screen_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); so merging all your to: GL_COLOR_ATTACHMENT0: GL_RGBA,GL_RGBA,GL_UNSIGNED_BYTE GL_COLOR_ATTACHMENT1: GL_RGBA,GL_RGBA,GL_UNSIGNED_BYTE I am using: GL_COLOR_ATTACHMENT0 : GL_RGBA , GL_RGBA8 , GL_UNSIGNED_BYTE GL_DEPTH_ATTACHMENT : GL_DEPTH_COMPONENT, … Read more

Multiple transparent textures on the same mesh face in Three.js

Use ShaderMaterial and set both textures as uniforms, and then blend them within shader. I made this example: http://abstract-algorithm.com/three_sh/ and that really should be enough. So, you make ShaderMaterial: var vertShader = document.getElementById(‘vertex_shh’).innerHTML; var fragShader = document.getElementById(‘fragment_shh’).innerHTML; var attributes = {}; // custom attributes var uniforms = { // custom uniforms (your textures) tOne: { … Read more

tech