glsl

What does “statically assign” mean for gl_FragDepth?

感情迁移 提交于 2020-06-28 05:10:06
问题 The documentation for gl_FragDepth , contains the phrase "If a shader statically assigns to gl_FragDepth... ." What does "statically" mean? 回答1: GLSL ES 1.00 specification 7.2 Fragment Shader Special Variables (A shader contains a static assignment to a variable x if, after pre-processing, the shader contains a statement that would write to x, whether or not run-time flow of control will cause that statement to be executed.) 来源: https://stackoverflow.com/questions/43218221/what-does

Showing Depth in Three.js Point Cloud

那年仲夏 提交于 2020-06-23 12:14:03
问题 I have a 3D scan of a rock that I have represented as a point cloud using Three.js, and I wanted to more explicitly show the features of the rock, perhaps using lighting to show depths with Three. Viewing the rock from the top, I see this: When looking closely from the side, you can see rigid features that I would like to show more closely: I am unsure in how to approach this, and was hoping for some help in showing these rock features within this visualization. For context, this is my

Showing Depth in Three.js Point Cloud

大憨熊 提交于 2020-06-23 12:12:54
问题 I have a 3D scan of a rock that I have represented as a point cloud using Three.js, and I wanted to more explicitly show the features of the rock, perhaps using lighting to show depths with Three. Viewing the rock from the top, I see this: When looking closely from the side, you can see rigid features that I would like to show more closely: I am unsure in how to approach this, and was hoping for some help in showing these rock features within this visualization. For context, this is my

Why are Uniform variables not working in GLSL?

a 夏天 提交于 2020-06-07 07:12:49
问题 I am currently trying to create a Blur Shader for postprocessing purposes using LWJGL, but stumbled across a problem. The Uniforms I want to change are resolution, radius and direction of the blur (horizontal or vertical, so I am able to use one Shader for both directions). I render the output to a FrameBuffer, which then gets rendered to the screen. But somehow, the Texture is just black. When I use constant values instead of uniforms, it works exactly as expected, so the problem must be the

How to enable Anti-aliasing in Moderngl EGL backend?

泪湿孤枕 提交于 2020-05-30 19:19:32
问题 This code renders a colored triangle when there is no anti-aliasing ( samples=0 ). But when I turn on anti-aliasing ( samples=1...32 ) it can't render anything. How to make it work with anti-aliasing? Perhaps I cannot read pixels from multisample fbos or textures directly but I don't know how to fix that. import numpy as np from PIL import Image import moderngl ctx = moderngl.create_standalone_context(backend='egl') fbo = ctx.framebuffer( color_attachments=ctx.texture((512, 512), 4, samples=2

How to enable Anti-aliasing in Moderngl EGL backend?

◇◆丶佛笑我妖孽 提交于 2020-05-30 19:19:11
问题 This code renders a colored triangle when there is no anti-aliasing ( samples=0 ). But when I turn on anti-aliasing ( samples=1...32 ) it can't render anything. How to make it work with anti-aliasing? Perhaps I cannot read pixels from multisample fbos or textures directly but I don't know how to fix that. import numpy as np from PIL import Image import moderngl ctx = moderngl.create_standalone_context(backend='egl') fbo = ctx.framebuffer( color_attachments=ctx.texture((512, 512), 4, samples=2

Intersect a ray with a triangle in GLSL C++

徘徊边缘 提交于 2020-05-27 12:29:12
问题 I am trying to make a ray intersection with a triangle in the fragment shader, if it colide i will paint a black dot in the texture, if not colide i will paint the texture color. But it do not have effect, I do not know nothing more to do to resolve it. It is the Shader of the ground and have the coords of a geometry coming from vertex, this geometry will be draw after the ground shader. The color is coming too from the vertex shader, and the light point is a vec3 with a point in the space, I

Font rendering onto off-screen FBO not working. (Note: fonts are loaded by creating textures using Freetype lib with glTexImage2D)

人走茶凉 提交于 2020-05-16 06:31:51
问题 I have the following code to render a rectangle and few texts onto an offscreen FBO. And then I try to bind the texture (attached to FBO) in default/ display framebuffer. I am able to render the rectangle but the fonts are not getting rendered. I tried debugging, but so far could not. I have to do this in OpenGL ES 2.0 only. My rectangle is of orange color. The texts/fonts are of red color. I use Freetype lib and glTexImage2D call to create individual textures for each font. When I render

glsl pyOpenGL array passing

流过昼夜 提交于 2020-05-15 07:15:30
问题 I'm currently playing around with glsl. For that purpose i need to pass an array from the opengl code to the gsls, which then in return calculates a new color out of the array. But somehow this doesn't work for me. Instead of getting the whole array I'm always stuck with only the first entry. Could you help me by saying what I'm doing wrong? import numpy as np \\... array = np.array([1.2,2.5,3.8,4.3,5.6, #....]) location = glGetUniformLocation(program,"arrayInShader") glUniform1fv(location,1