glsl

Which GLSL ES extensions are available on various iOS devices?

流过昼夜 提交于 2020-01-13 20:29:10
问题 I'm looking for a list of all extensions available on any iOS devices (and which are available on which device). I haven't found the right page in the apple docs despite a lot of searching, but I'm sure it's there somewhere. Any pointers? 回答1: This code should print out all extensions: NSString *extensionString = [NSString stringWithUTF8String:(char *)glGetString(GL_EXTENSIONS)]; NSArray *extensions = [extensionString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet

Which GLSL ES extensions are available on various iOS devices?

强颜欢笑 提交于 2020-01-13 20:28:10
问题 I'm looking for a list of all extensions available on any iOS devices (and which are available on which device). I haven't found the right page in the apple docs despite a lot of searching, but I'm sure it's there somewhere. Any pointers? 回答1: This code should print out all extensions: NSString *extensionString = [NSString stringWithUTF8String:(char *)glGetString(GL_EXTENSIONS)]; NSArray *extensions = [extensionString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet

How exactly is GLSL's “coherent” memory qualifier interpreted by GPU drivers for multi-pass rendering?

眉间皱痕 提交于 2020-01-13 03:53:19
问题 The GLSL specification states, for the "coherent" memory qualifier: "memory variable where reads and writes are coherent with reads and writes from other shader invocations" . In practice, I'm unsure how this is interpreted by modern-day GPU drivers with regards to multiple rendering passes. When the GLSL spec states "other shader invocations", does that refer to shader invocations running only during the current pass, or any possible shader invocations in past or future passes? For my

How do I perform bit operations in glsl

北战南征 提交于 2020-01-12 05:28:05
问题 How do I perform bit operations in glsl? Using the regular C style bitwise operators | , & , ^ , or ! does not work. 回答1: They have been introduced with GLSL 1.30 (OGL 3.0). Depending on what you want to do, you could eventually emulate them with floating point operations, x & (2^n)-1 = frac(x/(2^n))*(2^n) for example, but you'll have to take care of floating point errors. 回答2: You need to put either #version 130 or #extension GL_EXT_gpu_shader4 : enable in the top of your shader to get

Z-fighting solutions in depth test in OpenGL - how do they work?

折月煮酒 提交于 2020-01-12 04:40:33
问题 Description I've had major problems with Z-Fighting in OpenGL and I've spent quite some time finding solutions for this problem. Some of the ones I've found and I understand and didn't like: Moving polygons away from each other ( like glPolygonOffset in OpenGL ) Dividing the scene according to Z coordinate and drawing parts of the scene with separate clean z-buffers. The ones I don't understand: Using Projection Matrix https://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to

Z-fighting solutions in depth test in OpenGL - how do they work?

冷暖自知 提交于 2020-01-12 04:40:27
问题 Description I've had major problems with Z-Fighting in OpenGL and I've spent quite some time finding solutions for this problem. Some of the ones I've found and I understand and didn't like: Moving polygons away from each other ( like glPolygonOffset in OpenGL ) Dividing the scene according to Z coordinate and drawing parts of the scene with separate clean z-buffers. The ones I don't understand: Using Projection Matrix https://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to

Create depth buffer histogram texture with GLSL

旧城冷巷雨未停 提交于 2020-01-12 02:36:52
问题 I'm using the depth buffer of the current context to influence a texture I am displaying. The texture is 1 dimensional and in grayscale. From left to right represents from near to far. The more pixels are at a certain depth the brighter the texture is at that point with black being no pixels are at that depth and white being all pixels are at that depth. Now I have a solution that does glReadPixels() on the depth-buffer, analyzes it on the CPU and then writes it back to the texture. Naturally

Create depth buffer histogram texture with GLSL

别等时光非礼了梦想. 提交于 2020-01-12 02:36:05
问题 I'm using the depth buffer of the current context to influence a texture I am displaying. The texture is 1 dimensional and in grayscale. From left to right represents from near to far. The more pixels are at a certain depth the brighter the texture is at that point with black being no pixels are at that depth and white being all pixels are at that depth. Now I have a solution that does glReadPixels() on the depth-buffer, analyzes it on the CPU and then writes it back to the texture. Naturally

Point Sprites for particle system

陌路散爱 提交于 2020-01-11 14:50:31
问题 Are point sprites the best choice to build a particle system? Are point sprites present in the newer versions of OpenGL and drivers of the latest graphics cards? Or should I do it using vbo and glsl? 回答1: Point sprites are indeed well suited for particle systems. But they don't have anything to do with VBOs and GLSL, meaning they are a completely orthogonal feature. No matter if you use point sprites or not, you always have to use VBOs for uploading the geometry, be they just points, pre-made

Point Sprites for particle system

旧街凉风 提交于 2020-01-11 14:50:28
问题 Are point sprites the best choice to build a particle system? Are point sprites present in the newer versions of OpenGL and drivers of the latest graphics cards? Or should I do it using vbo and glsl? 回答1: Point sprites are indeed well suited for particle systems. But they don't have anything to do with VBOs and GLSL, meaning they are a completely orthogonal feature. No matter if you use point sprites or not, you always have to use VBOs for uploading the geometry, be they just points, pre-made