glsl

GLSL sampler2DShadow deprecated past version 120? What to use?

一世执手 提交于 2019-12-01 06:55:55
I've been trying to implement percentage closer filtering for my shadow mapping as described here Nvidia GPU Gems When I try to sample my shadow map using a uniform sampler2DShadow and shadow2D or shadow2DProj the GLSL compile fails and gives me the error shadow2D deprecated after version 120 How would I go about implementing an equivalent solution in GLSL 330+? I'm currently just using a binary texture sample along with Poisson Sampling but the staircase aliasing is pretty bad. Your title is way off base. sampler2DShadow is not deprecated. The only thing that changed in GLSL 1.30 was that the

Issue getting gradient square in glsl es 2.0, Gamemaker Studio 2.0

家住魔仙堡 提交于 2019-12-01 06:40:45
问题 I made a triangle list with 4 triangles, having the middle point a different color. And then aim to combine the triangles to get a nice gradient. But the edges of the triangles create unwanted lines, I don't want these lines I want it to be smooth al the way. How can I get the desired result? Images: Shader Code: // Simple passthrough vertex shader // attribute vec3 in_Position; // (x,y,z) attribute vec4 in_Colour; // (r,g,b,a) attribute vec2 in_TextureCoord; // (u,v) varying vec2 v_texcoord;

GLSL Double Precision Angle, Trig and Exponential Functions Workaround

好久不见. 提交于 2019-12-01 06:29:43
In GLSL there's rudimentary support for double precision variables and operations which can be found here . However they also mention "Double-precision versions of angle, trigonometry, and exponential functions are not supported.". Is there a simple workaround for this, or do I have to write my own functions from scratch? j-p this link seem's to be the best answer So yes, you'll need to make your own implementation for those functions. glibc source may be your friend. 来源: https://stackoverflow.com/questions/22522169/glsl-double-precision-angle-trig-and-exponential-functions-workaround

GLSL Instancing - Max number of inputs for vertex data?

醉酒当歌 提交于 2019-12-01 05:51:00
I am trying to implement instancing in my OpenGL program. I got it to work, and then decided to make my GLSL code more efficient by sending the Model-View-Projection multiplication matrix as input to the GLSL program, so that the CPU computes it for each instance, opposed to the GPU. Here is my vertex shader code (most of it is irrelevant to my question): #version 330 core // Input vertex data, different for all executions of this shader. layout(location = 0) in vec3 vertexPosition_modelspace; layout(location = 2) in vec3 vertexColor; layout(location = 3) in vec3 vertexNormal_modelspace;

GLSL Double Precision Angle, Trig and Exponential Functions Workaround

≡放荡痞女 提交于 2019-12-01 04:21:20
问题 In GLSL there's rudimentary support for double precision variables and operations which can be found here. However they also mention "Double-precision versions of angle, trigonometry, and exponential functions are not supported.". Is there a simple workaround for this, or do I have to write my own functions from scratch? 回答1: this link seem's to be the best answer So yes, you'll need to make your own implementation for those functions. glibc source may be your friend. 来源: https:/

GLSL sampler2DShadow deprecated past version 120? What to use?

点点圈 提交于 2019-12-01 04:20:13
问题 I've been trying to implement percentage closer filtering for my shadow mapping as described here Nvidia GPU Gems When I try to sample my shadow map using a uniform sampler2DShadow and shadow2D or shadow2DProj the GLSL compile fails and gives me the error shadow2D deprecated after version 120 How would I go about implementing an equivalent solution in GLSL 330+? I'm currently just using a binary texture sample along with Poisson Sampling but the staircase aliasing is pretty bad. 回答1: Your

How to get flat normals on a cube

天大地大妈咪最大 提交于 2019-12-01 03:39:26
问题 I am using OpenGL without the deprecated features and my light calculation is done on fragment shader. So, I am doing smooth shading. My problem, is that when I am drawing a cube, I need flat normals. By flat normals I mean that every fragment generated in a face has the same normal. My solution to this so far is to generate different vertices for each face. So, instead of having 8 vertices, now I have 24(6*4) vertices. But this seems wrong to me, replicating the vertexes. Is there a better

GLSL Instancing - Max number of inputs for vertex data?

扶醉桌前 提交于 2019-12-01 03:16:20
问题 I am trying to implement instancing in my OpenGL program. I got it to work, and then decided to make my GLSL code more efficient by sending the Model-View-Projection multiplication matrix as input to the GLSL program, so that the CPU computes it for each instance, opposed to the GPU. Here is my vertex shader code (most of it is irrelevant to my question): #version 330 core // Input vertex data, different for all executions of this shader. layout(location = 0) in vec3 vertexPosition_modelspace

Performance of integer and bitwise operations on GPU

浪尽此生 提交于 2019-12-01 02:32:29
Though GPUs are supposed for use with floating point data types, I'd be interested in how fast can GPU process bitwise operations. These are the fastest possible on CPU, but does GPU emulate bitwise operations or are they fully computed on hardware? I'm planning to use them inside shader programs written with GLSL. Also I'd suppose that if bitwise operations have full preformance, integer data types should have also, but I need confirmation on that. To be more precise, targeted versions are OpenGL 3.2 and GLSL 1.5. Hardware that should run this is any Radeon HD graphics card and GeForce series

Drawing lines with GLSL

爷,独闯天下 提交于 2019-12-01 01:57:38
is it possible to draw a line with GLSL using GL_TRIANGLES? The reason why i ask is i'm trying to draw a line with adobes molehill and it only draws triangle. Cheers if you set edge rendering to be on, just draw a triangle with point 1 and 3 at the same position. It's not efficient, but it works. If you can, use a geometry shader. Pass in two vertices and a line width, generate 4 points forming two triangles by shifting the vertices, render and be done... But drawing wide lines using triangles w/o a geometry shader can also be done in OpenGL ES 2.0 (no geometry shaders) and desktop OpenGL