glsl

multisampling and fragment shader

心不动则不痛 提交于 2019-12-08 09:07:35
问题 Multisampling does not seem to work for fragments generated by a fragment shader. In the example below, the fragment shader is used to produce a check-board procedural texture. The outer edges of the square are properly antialiased, but the inner edges of the procedural texture are not. Is the fragment shader evaluated only per pixel? Or are the texture coordinates the same for each fragment of a given pixel? Below is the code and the image shows its output (notice that the procedural edges

hazy artefact on OS X WebGL on sides of volume rendering

倖福魔咒の 提交于 2019-12-08 08:52:26
问题 Does anyone know how to sort this weird effect? The sides of the volume we're trying to render seem artificially hazy. I'm running it on 2014 MacBook Pro, Intel Iris 1536 MB GPU, Yosemite v 10.10.2 (14C1514). I've heard that this is only a problem on machines running OS X, and it doesn't appear on Windows machines. I've also noticed it in some other places e.g. Leberba 回答1: khronos.org/bugzilla/show_bug.cgi?id=1337 Bug reported so closing 来源: https://stackoverflow.com/questions/29493673/hazy

conversion from float to int (weird behavior)

大憨熊 提交于 2019-12-08 07:47:01
问题 I have this shader to implement character animation uniform mat4 u_mVxP; uniform mat4 u_mBlendMatrices[54]; uniform vec4 u_vDLDiffuseColor; uniform vec4 u_vDLAmbientColor; uniform vec3 u_vLightDir; attribute vec4 a_Position; attribute vec3 a_BWeights; attribute vec3 a_BIndices; attribute vec3 a_Normal; attribute vec2 a_TextureCoordinates; varying vec2 v_TextureCoordinates; varying vec4 v_Color; void main() { vec4 vPos; vec3 vNormal; int i=int(a_BIndices.x); int j=int(a_BIndices.y); int k=int

Use of undeclared identifier 'gl_InstanceID'

一个人想着一个人 提交于 2019-12-08 07:35:41
问题 Hi everyone, i have been trying Instanced drawing in OpenGLES2.0, in IOS platform. My rendering code glEnableVertexAttribArray(...); glVertexAttribPointer(...) glDrawElementsInstancedEXT(GL_TRIANGLES,IndicesCount, GL_UNSIGNED_SHORT, 0, 5); And my Vertex Shader attribute vec4 VertPosition; uniform mat4 mvpMatrix[600]; void main() { gl_Position = (mvpMatrix[gl_InstanceID]) * VertPosition; } I'm getting ERROR: Use of undeclared identifier 'gl_InstanceID' my glsl version is 1.0, if version is the

Shaders in libgdx have no effect [Desktop]

对着背影说爱祢 提交于 2019-12-08 07:34:00
问题 This is mostly a general question, since I can't get any shader to work at all. The usual sprites and textures render just fine, it just doesn't happen anything with the shaders. Not getting any error messages from the shader log either. As far as I understand, for a filter of the type below, one only need to set the shader to the batch, like batch.setShader(shader), and set any uniforms, and the batch will take care of the rest. If I am wrong, please tell me my errors. Fragment shader,

Multiple Programs in WebGL doesn't work

微笑、不失礼 提交于 2019-12-08 07:02:33
问题 I'm trying to use multiple shader programs in webgl but continue to get issues. It seems that if i have a different number of vertex shader attributes in programs then i get nothing rendered with no errors. Is there some constraint that means that programs have to have the same number of attributes? Do i need to disable/enable attribute locations when changing programs? It seems that just creating multiple programs causes the issue ( i dont even have to use the second shader, just the fact

gl_ModelViewProjectionMatrix vs gl_ModelViewMatrix

妖精的绣舞 提交于 2019-12-08 06:45:00
问题 I am beginner at GLSL. I was reading a vertex shader code and I don't understande this part of code: out vec3 position; ... gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex; position=vec3(gl_ModelViewMatrix*gl_Vertex); What are the differences between gl_ModelViewProjectionMatrix and gl_ModelViewMatrix? What are the differences between gl_Position and position? 回答1: As you might suspect, gl_ModelViewProjectionMatrix is gl_ModelViewMatrix with the addition of the projection -- that is, the

Texture edges are moving when camera is moved

眉间皱痕 提交于 2019-12-08 05:44:51
问题 The textures look good as long as the camera remains in a fixed position and rotation. However, when the camera is moving or rotating, (partial) lines appear between textures. I think it has to do something with subpixel correction. The texel is switching between the previous and the next one. For my textures I use: glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE

GLSL : accessing framebuffer to get RGB and change it

隐身守侯 提交于 2019-12-08 05:17:34
问题 I'd like to access framebuffer to get RGB and change their values for each pixel. It is because the glReadPixels, and glDrawPixels are too slow to use, so that i should use shaders instead of using them. Now, I write code, and success to display three-dimensional model using GLSL shaders. I drew two cubes as follows. .... glDrawArrays(GL_TRIANGLES, 0, 12*6); .... and fragment shader : varying vec3 fragmentColor; void main() { gl_FragColor = vec4(fragmentColor, 1); } Then, how can I access to

handle multiple passes when rendering

独自空忆成欢 提交于 2019-12-08 05:17:27
问题 I want to render a volume(VERSION combined with programmable pipeline and fixed pipeline) using only programmable pipeline (no fixed pipeline) which using glsl. To achieve this, I need multipass the renderer which means render different scene with different shaders in a sequential order. There are three methods come to my mind: using one shader program and detach shader -> attach shader -> recompile program whenever rendering new scene. using one shader program per pass, then there exits