A programming language for OpenGL shaders.

learn more… | top users | synonyms

1
vote
1answer
186 views

How does HLSL handle clip(vector)?

My goal is to convert clip() to GLSL, version 1.5. I'm currently doing a basic: if (x < 0) discard; But if x is not a scalar, obviously I can't use the "<" operator. So I'm wanting to ...
0
votes
1answer
120 views

Why do the ALPHA channel in TGA is not visible?

Good morning GDSE, I am loading a TGA using loadTGA function found in superbible 4th edition source code. Here is how the image looks in Gimp You can see I have enabled alpha channel in Gimp, I ...
5
votes
1answer
771 views

Exponential Variance Shadow Mapping - implementation

I use a variance shadow mapping with a "standard" light bleeding fix in my graphics engine which is based on deferred rendering.. I have a single shadow map for a directional light beacause a test ...
2
votes
1answer
279 views

Is this GLSL equivalent to this HLSL?

I was wondering if the both shader codes are equivalent. So the question is, is this GLSL vNormal = mat3(FUSEE_ITMV[0].xyz, FUSEE_ITMV[1].xyz, FUSEE_ITMV[2].xyz) * fuNormal; Equivalent to this ...
0
votes
1answer
100 views

How can I animate a portion of the textures on a model?

I have a model to which I have attached multiple textures. Both textures are currently static, but if I want to move (or slide) the texture which is on the top (in UV space), is that possible? Maybe ...
1
vote
1answer
144 views

How can I extract the RGB color data from a TGA image?

I am working in OpenGL, and I am trying to create terrains using height maps. I am using my own functions to load a TGA image, and in order to pass data to heightmap vertex shader I need to retrieve ...
1
vote
1answer
144 views

Fragment shader seems to floor() imprecisely

I'm trying to interpolate coordinates in my fragment shader. Unfortunately if close to the upper edge the interpolated value of fVertexInteger seems to be rounded up instead of beeing floored. This ...
0
votes
1answer
174 views

fragment shader directional light positioning with camera

Im trying to set up directional lighting in the fragment shader. So the direction of my light moves with the camera position. #version 150 core uniform sampler2D diffuseTex; ...
2
votes
1answer
345 views

Aquire disassembly of shader code

Is there a way to get the disassembly that your driver generates when compiling a shader? I noticed that you can get an accidental disassembly dump if you go over the maximum thread group size ...
2
votes
2answers
334 views

GLM Velocity Vectors - Basic Maths to Simulate Steering

UPDATE - Code updated below but still need help adjusting my math. I have a cube rendered on the screen which represents a car (or similar). Using Projection/Model matrices and Glm I am able to ...
2
votes
1answer
53 views

Accessing 3D texture data without normalized coordinates directly, but with filtering

texelFetch() exists to access texture data with texture coordinates in "image dimensions", but texelFetch skips filtering. In case of 2D textures, it's possible to use a rectangle texture sampler to ...
1
vote
2answers
350 views

OpenGL position from depth is wrong

My engine is currently implemented using a deferred rendering technique, and today I decided to change it up a bit. First I was storing 5 textures as so: DEPTH24_STENCIL8 - Depth and stencil ...
1
vote
2answers
757 views

In GLSL is it possible to offset vertices based on height map colour?

I am attempting to generate some terrain based upon a heightmap. I have generated a 32 x 32 grid and a corresponding height map -> In my vertex shader I am trying to offset the position of the Y ...
0
votes
1answer
192 views

Problems when rendering code on Nvidia GPU

I am following OpenGL GLSL cookbook 4.0, I have rendered a tesselated quad, as you see in the screenshot below, and i am moving Y coordinate of every vertex using a time based sin function as given in ...
1
vote
0answers
158 views

GLSL, Internal error: assembly compile error for fragment shader at offset 513

My vertex and fragment shaders link correctly. When I try and link my shader program I get the error: "Internal error: assembly compile error for fragment shader at offset 513". Pastebin of fragment ...
2
votes
1answer
211 views

Incorrect lighting results with deferred rendering

I am trying to render a light-pass to a texture which I will later apply on the scene. But I seem to calculate the light position wrong. I am working on view-space. In the image above, I am ...
1
vote
0answers
113 views

Bad texture on model with different GPU [closed]

I have some kind of distortion on the texture of my 3D model. It works perfectly well on an AMD GPU, but when testing on a integrated Intel HD graphics card it has a weird issue. I don't have a ...
3
votes
4answers
578 views

How many times fragment shader is executed?

I have an OpenGL code, with 3 different shader programs. I have a simple question, I know fragment shaders are executed for every every fragment in the scene. But is there a way using which we can ...
0
votes
1answer
490 views

GLSL billboard move center of rotation

I have successfully set up a billboard shader that works, it can take in a quad and rotate it so it always points toward the screen. I am using this vertex-shader: void main(){ vec4 tmpPos = (MVP * ...
0
votes
0answers
80 views

Triangle Clipping

I want to determine which part of a triangle is visible in a frustum in OpenGL, is there a way to get visible coordinates of triangle in the viewing frustum?
0
votes
1answer
55 views

Working with floats in OpenGL ES 2

Are there any reasons or situations one would use in their shader float(1) over just 1.0 ?
4
votes
3answers
992 views

Implementing skeletal animation and GPU skinning (DOOM MD5)

DISCLAIMER This question has been completely rewritten to narrow the scope of the question in light of previous suggestions and answers, but the same problem still persists. Currently I'm trying to ...
1
vote
1answer
611 views

GLSL 2d Per Pixel Lighting

First time writing shaders, and having a bit of an issue getting per-pixel lighting to work. The problem is pretty simple, but I'm afraid am doing something wrong here. Vertex Shader: #version 150 ...
1
vote
1answer
209 views

Bump mapping Problem GLSL

I am having a slight problem with my Bump Mapping project. Although everything works OK (at least from what I know) there is a slight mistake somewhere and I get incorrect shading on the brick wall ...
1
vote
0answers
300 views

Geometry shader and triangle adjacency

I'm currently trying to change my project to use GL_TRIANGLE_ADJACENCY instead of GL_TRIANGLES. Following this question, I have managed to construct my index buffer fine, but when it comes to the ...
3
votes
1answer
670 views

Shadow mapping does not work correctly using GLSL shaders

I'm a beginner in shadow mapping. I have in my scene two meshes : a cube and a floor. The scene is lighted by a single point light. Here's for the following display the light properties : ...
2
votes
2answers
1k views

Developing GLSL Shaders? [closed]

I want to create shaders but I need a tool to create and see the visual result before I put them into my game. As to determine if there is something wrong with my game or if it's something with the ...
0
votes
2answers
245 views

HLSL's Tex2D for GLSL?

I am trying to port a HLSL shader to GLSL. I'm just not quite sure how to convert this line: outA += Input.Color.a * tex2D(s, Input.TexCoord.xy + float2(-4.0 * pxSz.x * blurSize,0)).a * 0.05; ...
4
votes
1answer
347 views

OpenGL FBO not being drawn to

In my project I'm trying to implement a deferred rendering system, problem is, I can't seem to get a second FBO to work. UPDATE 1 Here is the FBO initialization code: /// G-Buffer FBO GLuint ...
0
votes
1answer
829 views

GLSL - Declaring global variables outside of the main function scope

Does it help to declare variables outside of your main function scope in GLSL? Do these variables actually get reused and is it more efficient? Here is the code in question: varying vec2 vposition; ...
1
vote
2answers
201 views

GLSL: define a constant for both vertex and fragment shader

I have a constant for defining an array in the vertex shader. I want to use this constant also in the fragment shader to define another array of the same size. Naive attempts fail (simply use the ...
6
votes
1answer
592 views

How would one draw many objects using the same VBO

I'm kind of stuck with this question for some time now, maybe because I don't know exactly what to search for, it might be a term I have not heard of yet as most tutorials ends after drawing one ...
0
votes
2answers
817 views

Draw wireframe overlay of model in GLSL

I have a 3D model that has a GLSL script, and I want to draw a line on each border of its polygons in the fragment shader. What should I do? Note: I am using Ogre3D, so I can't use OpenGL's ...
3
votes
0answers
360 views

Jet engine exhaust shader [closed]

How would I create a jet engine exhaust effect, as shown in the image from Fzero GX below. GLSL and OpenGL examples/solutions are prefered, though other resources are also welcome. Requirements ...
0
votes
0answers
276 views

Fragment shader not applying intended color to output

I started working with OpenGL recently, having previously worked on mods. I'm using GLFW3, GLEW, and whatever tutorials I can find. So far I've come up with this code: //Headers #include ...
0
votes
0answers
95 views

Normal mapping and translation, lighting not displaying correctly

I got a normal mapping issue. I have a texture and a normal texture on each model loaded via the ASSIMP library. I am calculating the tangent vectors on each object with the help of the ASSIMP ...
7
votes
2answers
245 views

Diffuse Reflection confusion

From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be color = color_of_point * color_of_light * ...
3
votes
2answers
67 views

Local shape color blending

I am trying to implement this in Unity 4 Pro. But I am stuck in the blending part. I don't understand how you could blend multiples textures/colors using multiples volumes on an object. How could you ...
0
votes
1answer
191 views

Creating a fragment shader to darken a white texture over time - OpenGL GLSL

So as a part of learning OpenGL, I've now decided to try and be a bit more creative with shaders, as part of a practice game I'm making using C/OpenGL. I'm completely new when it comes to working ...
0
votes
0answers
153 views

Shadow-casting through time acting in “reverse” before next notciable shadowmap update

question was re-written to better explain the problem I have a scene of big thin parallelepiped, small cube, and a light source, all aligned on Y axis, like so: _ | | | |----[ ]----Light |_| Both ...
3
votes
1answer
2k views

Skyboxes using glsl Version 330

So I am trying to get a skybox working with OpenGL 3.3 and glsl Version 330. After scouring the web for a while, I could not find a completely modern OGL skybox tutorial anywhere, so I found an older ...
0
votes
3answers
830 views

OpenGL tile rendering

Currently I'm trying to render a TileMap using OpenGL 2.1, GLSL 1.2. I would like to draw every tile in just one draw call. I use a single texture with all tiles, identifying each one by an index. ...
0
votes
1answer
177 views

VBO in a class doesn't draw when The class has a destructor

I am making this class QuadTemplate class QuadTemplate { public: QuadTemplate() { vbo=0; uvbuffer=0; vao=0; TextureID=0; vboType=0; ...
3
votes
2answers
2k views

Rotating an object when the center in not the origin - opengl

I'm beginning with GLSL and I learning the basic, I am using glm to do the matrix calculations at this point everthing ok,the problem is how I can move the origin to the center of my object, not the ...
3
votes
1answer
218 views

Directional light shader not behaving as expected

I coded my first glsl shader which manage diffuse and specular effects of a directional light. This is the fragment shader. #version 120 //matrix uniform mat4 model_matrix; //directional light ...
7
votes
2answers
4k views

GLSL Shader - Change Hue/Saturation/Brightness

I'm trying to change the hue of an image using a GLSL fragment shader. I want to achieve something similar to Photoshop's Hue/Saturation Adjustment layer. In the following image you can see what I've ...
1
vote
0answers
128 views

Matrix array doesn't seem to get populated

I'm trying to stream an array of matrices to a vertex shader, but it seems that only the first matrix works. What could be the problem? I suspect that I upload the matrices in a wrong way. C# ...
3
votes
1answer
732 views

Incorrect GPU skinning

I'm having some problems with implementing skinning and skeletal animation. It seems that the skeleton and the mesh are loaded correctly, but the mesh gets funky when the bone transformations are ...
2
votes
2answers
901 views

Using two shaders instead of one with IF statements

I've been working on porting a relatively large opengl ES 1.1 source to ES 2.0. In OpenGL ES 2.0 (which means, everything uses shaders), I want to draw a teapot three times. The first one, with a ...
3
votes
1answer
237 views

Do GLSL 4.x subroutine variables cause any performance overhead?

There's not too much deep information about them on the web. How are they implemented and how they work under the hood? I'd like to know that they cause any performance overhead or not, especially in ...