glsl

OpenGL drawing triangle doesn't show + glClearColor not setting screen color

浪尽此生 提交于 2019-12-12 01:23:47
问题 I have a project im working on where it creates a window, creates the vertex and shaders, shader program, MemoryBuffer, etc... I have gotten through a ton of errors so far, and there are no errors when I run the code. The glClearColor() call doesn't set the screen color, and no triangle is drawn. Tutorial I'm following: https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Rendering Main: public class DungeonRunners { private double lastTick; private float timeCount; private int fps; private

OpenGL ES 3.0 matrix array only using first matrix

喜欢而已 提交于 2019-12-12 00:43:51
问题 I am doing GPU skinning in my vertex shader which works fine on PC, and which I'm porting to Android. My vertex shader is below, and the problem is that the creation of the matTransform matrix seems to only use the first matrix in boneMatrices: #version 300 es precision highp float; precision highp int; //Uniform count: projectionMatrix(16) + modelViewMatrix(16) + MVPMatrix(16) + textureMatrix(16) + normalMatrix(9) + lightMVPMatrices(16*5) + nShadowLights(1) + boneMatrices(16*boneMax) = 73 +

How to rotate a texture in a shader, Android

两盒软妹~` 提交于 2019-12-12 00:14:36
问题 So I have a texture I want to rotate given the angle rotation . Here are my UV coordinates float[] landscapeVerts = { // X, Y, Z, U, V -ratio, -1.0f, z_0, 1.0f, 0.0f, ratio, -1.0f, z_0, 0.0f, 0.0f, -ratio, 1.0f, z_0, 1.0f, 1.0f, ratio, 1.0f, z_0, 0.0f, 1.0f, }; I want to rotate just the UV part. So I built the following matrix to accomplish this in the shader. Matrix.setIdentityM(mProjMatrix, 0); //start with identity matrix Matrix.translateM(mProjMatrix,0,-0.5f,-0.5f,0.0f); // move center to

GLSL, default value for output color

风格不统一 提交于 2019-12-11 23:50:09
问题 Which is the default value for the output color in GLSL in case you dont set it? #version 330 uniform sampler2DRect colorTex; uniform vec3 backgroundColor; out vec4 outputColor; void main(void) { vec4 frontColor = texture(colorTex, gl_FragCoord.xy); outputColor.rgb = frontColor + backgroundColor * frontColor.a; } Is it (0, 0, 0, 1)? Ps: that code belongs to the old GL, trying to use it with the GL3, I get the following error error C7011: implicit cast from "vec4" to "vec3" I am right to

Compute shader only updates part of data

不问归期 提交于 2019-12-11 22:52:40
问题 I'm stuck with my program rendering all the particles, but only updating 1 particle on 3. Here's what I've done to test it. I made a vbo with 10 of my particles, put them all aligned veticaly and set the compute shader to modify their x position every update (pos.x+=0.1). Here's the result after about 1-2 seconds (image is 1:5 scale) : I use local_size_x = 1, local_size_y = 1 and local_size_z = 1, then DispatchCompute(10,1,1) . Am I doing something wrong with the invocation ids? Update

Shader Texture Always Facing The Camera

浪子不回头ぞ 提交于 2019-12-11 19:19:10
问题 I have this basic shader, though I ran into some trouble which really bugs me! I'm applying the texture using the fragment shader though however I move or rotate the camera, the texture on the face will always be facing the camera (I've added a GIF image as an example). So as you can see on the image above the texture keeps facing the camera, also if I move away of closer it will keep its scale. I'm trying to achive that I can move around and the texture will keep it's position, rotation and

Is there any method to hide shader used in web application from being inspect by shader editor or other tools

廉价感情. 提交于 2019-12-11 18:32:18
问题 I am digging 3D web application for VR. And I want to hide my shader from being inspected by firefox shader editer and webGL inspector. I used the way to uglify the shader and put the shader in a return function rather than in a var. But none of them works. So, is there any method to hide web application's shader? 回答1: The answer is simple, no there isn't Just printing out the shaders is pretty easy. All someone has to do is write an extension that does this WebGLRenderingContext.prototype

Banding Problem in Multi Step Shader with Ping Pong Buffers, does not happen in ShaderToy

你离开我真会死。 提交于 2019-12-11 17:16:28
问题 I am trying to implement a Streak shader, which is described here: http://www.chrisoat.com/papers/Oat-SteerableStreakFilter.pdf Short explanation: Samples a point with a 1d kernel in a given direction. The kernel size grows exponentially in each step. Color values are weighted based on distance to sampled point and summed. The result is a smooth tail/smear/light streak effect on that direction. Here is the frag shader: precision highp float; uniform sampler2D u_texture; varying vec2 v

Show half portion of image side by side on two separate glcontrols - openTK

霸气de小男生 提交于 2019-12-11 16:52:54
问题 I have a single texture and two glControls. I need to show the first half portion of texture on glControl2 and second half portion of texture on glControl1. And also I have put two numericupdown controls on left end of texture (range from 0 to 0.5) and another two numericupdown controls on right end of texture (range from 0.5 to 1.0). When I select 0. 4 and 0. 5 on left end of texture, I have to show the area between 0. 4 and 0. 5 on glControl2. And If I select 0. 8 and 1 on right end of

Heavy image downsampling artefacts

ぃ、小莉子 提交于 2019-12-11 16:43:02
问题 I need to heavily downsample a image to prepare for a perceptual hashing algorithm, for example from a 3024x4032 to a 9x9 image, and I'd like to use webgl for that (as the base image is already processed within the webgl pipeline), and artefacts quickly appear when the downsampling rate is too large. Taking this sample situation: // WebGL2 - 2D Image // from https://webgl2fundamentals.org/webgl/webgl-2d-image.html "use strict"; var downscaleFactor = 0.5; var vertexShaderSource = `#version 300