glsl

GLSL shader on a .png logo with swipe effect from left to right. I

寵の児 提交于 2019-12-24 18:33:18
问题 I am junior developer attempting to create a swipe effect from left to right. Where the logo disappears/gets erased from left to right and then appears from right to left. I've new to GLSL and have never programmed in C++. All my attempts have created varying results. The current result is that the logo it self gets compressed from left to right. So I would be very thankful if someone could give some advice as to code examples that have a similar effect or explain what i'm doing wrong here.

Can we delete vertex and fragment shaders after link shader program

久未见 提交于 2019-12-24 17:46:08
问题 As title said, Can I do this in my program: vertex = glCreateShader(GL_VERTEX_SHADER); /* ... */ fragment = glCreateShader(GL_FRAGMENT_SHADER); /* ... */ program = glCreateProgram(); glAttachShader(program, vertex); glAttachShader(program, fragment); glLinkProgram(program); /* All things done */ glDeleteShader(vertex); /* <~ Can I do this now? */ glDeleteShader(vertex); /* <~ Can I do this now? */ /* And in render procedure */ glUseProgram(program); /* <~ Still use program without any problem

GLM matrix multiplication and OpenGL GLSL

南楼画角 提交于 2019-12-24 13:18:50
问题 I have similar code as in this question: some opengl and glm explanation I have a combined matrix that I pass as a single uniform //C++ mat4 combinedMatrix = projection * view * model; //GLSL doesn't work out_position = combinedMatrix * vec4(vertex, 1.0); It doesn't work. But if I do all the multiplication in the shader so I pass in each individual matrix and get //GLSL works out_position = projection * view * model * vec4(vertex, 1.0); It works. I can't see anything wrong with my matrices in

How to you define attaching a texture array to a FBO's color attachment point visually?

风流意气都作罢 提交于 2019-12-24 12:10:38
问题 I read that in layered rendering, we create a 2D texture array (GL_TEXTURE_2D_ARRAY): glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D_ARRAY, TextureColorbufferName); glTexParameteri(.... glTexImage3D(... and can attach it to FBO: glGenFramebuffers(1, &FramebufferName); glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, TextureColorbufferName, 0); What i find hard to understand visually is how can a layer of textures be

WebGL: drawArrays: attribs not setup correctly

我怕爱的太早我们不能终老 提交于 2019-12-24 10:09:45
问题 Here's my vertex shader: attribute vec3 aVertexPosition; attribute vec4 aVertexColor; attribute float type; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; varying vec4 vColor; void main(void) { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); vColor = aVertexColor; if(type > 0.0) { } else { } } What I want to do is pretty simple, just capture a float value named type and use it for logic operates. The problem is, when I try to use it in Javascript, the error comes:

Phong lighting: add specular lighting separately or with ambient and diffuse?

孤街醉人 提交于 2019-12-24 09:50:13
问题 I am trying to implement Phong lighting. In some tutorials specular lighting is added to ambient and diffuse lighting and then total lighting is multiplied by texture color. I also saw a tutorial where specular lighting was added separately after the addition of ambient and diffuse lights was multiplied with texture color. Here is a fragment shader with both options present and with screenshots. #version 330 core out vec4 FragColor; in vec2 TexCoord; in vec3 normals; in vec3 fragPosition; /

Runtime error with GLSL shaders: Inconsistency detected by ld.so

喜夏-厌秋 提交于 2019-12-24 08:36:55
问题 I am writing some OpenGL code to draw a small dot in a window, but when I try to use my own shaders, I get an error message which I don't understand. So, here's my main function: int main(int argc, char** argv) { // Initialize some things glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA); glutInitWindowSize(100, 100); glutCreateWindow("OpenGL Test"); glutDisplayFunc(RenderScene); glewInit(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Make the vertex buffer Vector3f vertices[1]

OpenSceneGraph/OpenGL Image internalFormat

最后都变了- 提交于 2019-12-24 07:19:04
问题 I need to pass a 2D texture array to a fragment shader that performs texelFetch and bitwise operations over uchar elements. For this reason, I need to create a texture with a very specific internal format, that guarantees that my texels are in unsigned byte integer, and that no scaling operations not casting to float is performed. I already have my image buffers in generic uint8_t* arrays. So I am doing this: osg::Texture2DArray texture = new osg::Texture2DArray; for (int i = 0; i < ntextures

Transitioning vertices between 3D models with three.js

喜夏-厌秋 提交于 2019-12-24 07:01:13
问题 I am trying to achieve polygon blowing and reassembling effect similar to: http://na.leagueoflegends.com/en/featured/skins/project-2016 https://tkmh.me/ In both of these examples, you can see how they are morphing / transitioning the vertices from one 3d model to another, resulting in a pretty cool effect. I have something similar working, but I can't wrap my head around how they are transitioning the vertices with velocity offsets (please refer to the first link and see how the particles don

SceneKit and with GLSL - how to add shader (GLSL) to a geometry

谁说胖子不能爱 提交于 2019-12-24 06:45:57
问题 I'm learning SceneKit and while using GLSL. I'm having hard time understanding using glsl with SceneKit, e.g., how to load glsl shaders in SceneKit and apply it to a geometry. lets say we have: SCNBox *box = [SCNBox boxWithWidth:50 height:50 length:50 chamferRadius:0]; SCNNode *bNode = [SCNNode nodeWithGeometry:box]; SCNMaterial *redMaterial = [SCNMaterial material]; redMaterial.diffuse.contents = [UIColor redColor]; redMaterial.locksAmbientWithDiffuse = YES; box.materials = @[redMaterial];