A programming language for OpenGL shaders.

learn more… | top users | synonyms

2
votes
1answer
49 views

How can I repeat / scroll a tile which is part of an texture atlas?

I would like to scroll a tile which is part of a texture atlas like it can be done with a single quad and texture wrap mode set to repeat. Can this be done? I hope it's clear what I would like to ...
1
vote
1answer
34 views

Why aren't subsequent glDrawArrays showing up?

I am attempting to redraw with the same arrays using glDrawArrays in a GLKView on iOS. When I comment out any two of these calls, the other draw call draws as I expect. My last hunch was that I was ...
0
votes
0answers
33 views

Using multiple uniform blocks in OpenGL

I'm using OpenGL with JOGL and want to use two unfirorm blocks in my vertex and pixel shaders. The following GLSL-Code shows the definitions:- uniform perObject { Material uMaterial; mat4 ...
5
votes
1answer
1k views

GLSL pack floats into an RGBA texture

I want to compose conventional triangle-based models and particles with a ray-traced scene at a reasonable frame-rate. webGL does not let you write the gl_FragDepth in the fragment shader. You ...
1
vote
1answer
133 views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
1
vote
2answers
94 views

Does GLSL copy function arguments by value?

My question is about passing variables to GLSL shader. I'm not sure how that works and what are the performance implications. Say I got a function that accepts a "vec4" variable. The question is - is ...
4
votes
0answers
109 views

How can I implement real-time mutual object reflection?

So, given a scene like this (cubemap skybox with "real" spheres) Everything looks great, except for the fact that the spheres don't reflect each other. What's a good way to go about this? The ...
2
votes
1answer
53 views

How to store an array into a texture and sampler the texture in vertex shader correctly?

I'm a new learner about OpenGL and GLSL. I'm coding a program in which i wanna store a group of datas in a texture and get the data by sampling the texture in vertex shader. Then i want to set the ...
2
votes
0answers
653 views

2D water shader in SFML

I want to implement the algorithm for a 2D water surface described here and here. Before somebody finds out, beats me up and deletes this, I'm gonna say it myself. I posted this question over at ...
3
votes
1answer
526 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 : ...
1
vote
2answers
3k views

FBO Depth Buffer not working

I'm trying to get the depth buffer for my 2D game working by offsetting the z value of the rectangles. For some reason, my depth buffer is coming back empty. The value is always 0. I'm assuiming there ...
1
vote
1answer
26 views

Having trouble setting color in fragment shader

For some reason, the color isn't applying to the object. Here's my fragment shader code. There's probably something obvious wrong with it that i'm not seeing. #version 330 core out vec3 Color; ...
0
votes
1answer
75 views

How does OpenGL determine different outputs with shaders?

Lets say I have this GLSL code: #version 330 out vec4 outputColor; void main() { float lerpValue = gl_FragCoord.y / 500.0f; outputColor = mix(vec4(1.0f, 1.0f, 1.0f, 1.0f), ...
1
vote
1answer
64 views

Blinn, Normal maps & Fresnel?

So something came up today when I was going over my Blinn shader. As I've been taught, the half-angle vector is calculated in the fragment shader, and is equal to normalize(lightDir + viewDir). This ...
3
votes
1answer
64 views

Applying a noise texture to distort edges

I asked this question over on StackOverflow but then found this site, and it's probably better suited to here. I'm trying to implement Sketchy Drawings. I'm at the part of the process which calls ...
1
vote
1answer
78 views

Why is the light following my camera around?

I have implemented a simple Phong shader without specular highlights for now (just ambient + diffuse components) The problem however, is that the calculations seem to be done in camera space; as I ...
0
votes
1answer
62 views

How do I follow this glsl1.2 + lights + shadows tutorial?

I am following this great tutorial but I have many questions. Let's see if I understand the basic idea. 1. I must create the same number of FBOs that lights (maximum 8). 2. I must create the same ...
3
votes
2answers
67 views

GLSL: sampler2D fallback to constant color?

So I have the following situation: I'm sharing a blinn shader accross many meshes. Some meshes have specular & normal maps, others do not. I'd like to, without making the shader code too ...
2
votes
2answers
97 views

3D position to UV coordinates in fragment shader

I am interested in converting an arbitrary 3D position computed at run time in the fragment shader to its corresponding UV coordinates. Notice that the 3D position I am interested in is NOT a 3D ...
0
votes
1answer
42 views

(WebGL) Point light per-fragment issue

I'm using an FPS-like camera, this is the code: CAMERA mat4.identity(mat.mvMatrix); mat4.rotate(mat.mvMatrix,degToRad(-camera.pitch),[1,0,0]); ...
1
vote
1answer
80 views

In glsl, how do indices work?

I have made a vertex shader and fragment shader and kind of know how they work, and I know that you specify what index you want your vertices to be in inside the shader program. So if the vertex was ...
10
votes
2answers
289 views

Refractive glass shader

I have an infinite hexagonal floor, generated by tessellating a point grid in a tessellation shader pair: Note that this is a flat wireframe - the "shadows" are a lighting trick: Now, I'd like ...
1
vote
1answer
101 views

GLSL - std140 uniform block - fields(vec, float, mat4) always 0.0

Ok, First of all, if just use uniforms everthing works like it should. Switching to uniform blocks nothing goes, as all values look like 0.0. I tested this with various if-then-else stuff within the ...
0
votes
0answers
94 views

glsl fragment shader work diffrently on different devices

i'm making a 2d android game where i have a mechanics that allow the player to move the camera away from the main character, and to not allow him to explore the hole world, a have create a Fog shader, ...
3
votes
1answer
891 views

GLSL Light (Attenuation, Color and intensity) formula

I'm implementing point lights in my Voxel engine, and I'm really struggling to get a good flow of light, from 100% near the light source to 0% at the light radius. I have 5 arguments for the ...
1
vote
1answer
67 views

GLSL associating multiple uniform samplerBuffers

At the moment I'm not sure how my VBO and TBO associate with a specific uniform samplerBuffer in my shader, I have not linked them using the location or the vbo/tbo together. It seems to still work ...
1
vote
0answers
61 views

Normal mapping does not work correctly using GLSL and OpenGL

Hello I wrote a simple OpenGl program using GLSL to render a simple uv mapped plane using the normal mapping technics. Here's the display with a simple phong shading (without normal mapping) : Now ...
0
votes
1answer
53 views

GLSL/SFML - Only make portion of texture alpha

I'm trying to take a portion of the current texture and turn it to 50% transparent. I send in four values, signifying the rectangle I want to make transparent. It seems every time, however, that ...
0
votes
2answers
161 views

How to mix pixel colors in Shader?

I have a pixel that have a colour RGB. This color is calculated by the shader and can be anything. How can I override this color by a colour I choose. If my pixel is white it's simple, I can do this: ...
1
vote
1answer
236 views

View to normal calculation in GLSL

Sorry for the terrible title, but I really cant think of anything better.. Suggestions welcome. I am trying to do something like showcased in this video: http://www.youtube.com/watch?v=CaTI2d0tQME ...
6
votes
1answer
388 views

Weird problem with advect program in fluid simulator

I implemented 2d fluid simulator. Solver runs entirely on GPU. All works fine... on my work PC. But on home PC I have some awful glitches, and I can`t understand how to fix them. Empirically I ...
5
votes
1answer
645 views

What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330)

I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming. I'm currently trying to implement deferred ...
2
votes
1answer
88 views

How to work with smaller intermediate textures in OpenGL and GLSL?

I'm working on a project rendering water simulated through smoothed-particle hydrodynamics (SPH) with a non-photorealistic look to use in games. In the actual stage of the project everything about ...
2
votes
0answers
125 views

Blank texture in Frame Buffer Object in Deferred Rendering

I'm running the tutorial 35 from olgdev.atspace.co.uk, and it's so strange that the result is a blank screen. This tutorial is performing the first step of Deferred Shading, which means decoupling of ...
1
vote
1answer
228 views

SSAO looks wrong

I'm trying to implement SSAO based on this tutorial. My setup: OpenGL 3.2 Forward renderer View-space depth and normal in a single 16-bit floating point texture. The result I get is this: The ...
16
votes
2answers
6k views

Is there a successor to RenderMonkey? [closed]

I'm starting with GLSL shader programming and have been looking into RenderMonkey. Sadly, AMD no longer supports it. Why? Is there a successor to it?
0
votes
1answer
86 views

why is my OpenGL texture transparent?

I have a terrain in OpenGL, and two textures which I am combining using GLSL mix() function. Here are the textures I am using. Now I am able to combine and mix these two textures, but for some ...
0
votes
1answer
30 views

Combine framebuffer-textures to default framebuffer

I know frame-buffers are not textures themselves, but they do contain a texture, given they are set up correctly, which I believe mine are, as: (status == GL_FRAMEBUFFER_COMPLETE) returns true. ...
1
vote
1answer
130 views

How to achieve anisotropic filtering

I am loading a texture and using glGenerateMipmap() on it to achieve some level of mipmaping. I get different result on nVidia gt 555m, and on Intel HD 3000. The texture rendered by nVidia is not ...
8
votes
3answers
511 views

How can I create a glitter effect?

I am trying to create a glittering effect for my realtime shader but I don't know how. Here is one example, and another example. What technique can I use to implement this?
2
votes
1answer
154 views

Linear filter problem with diagonal lines on adjecent tiles

I am quite new at using OpenGL/GLSL. Basically, the project I am working on is my first 'real' experience with it. I do not know whether this is relevant, but I use libgdx for my project. Currently, ...
4
votes
1answer
590 views

Why are my texture coordinates always (0,0) in this shader?

What I'm trying to do is add my depth buffers values to my scene, ie. I'm trying to make objects closer to the camera darker and objects further away lighter. Which should be easy: just render the ...
0
votes
0answers
47 views

parametric 3D sphere unwrapping math for perfect 3D-textures

After some time looking or it on the internet I can't find the proper answer to my concern. I'm currently generating 3D textures on a shader for my planets to avoid sphere mapping issues (pole, ...
1
vote
1answer
124 views

GLSL blur shader algorithm results in a lumpy blur?

I'm writing a Gaussian blur shader and it's coming along pretty well. However, when I run it on a circle, the result is lumpy. I'm using a simple nested for loop to create the blur. Here's the code ...
5
votes
1answer
455 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 ...
36
votes
6answers
14k views
1
vote
1answer
152 views

How to compute tangent and bitangent vectors

I have a texture loaded in three.js, then passed to the shaders. In the vertex shader I compute the normal, and I save into a variable the uv vector. <script id="vertexShader" ...
-3
votes
1answer
84 views

GLSL does weird things to my view matrix [closed]

uniform mat4 model; uniform mat4 view; varying vec4 vColor; void main(){ gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = view * model * gl_Vertex; vColor = gl_Color; if(view * ...
1
vote
1answer
58 views

Indirect indexing (uv coords read from texture)

In the vertex shader, I need to make a texture fetch, where the texture coordinate itself is read from some other texture. vec2 uv = texture(someTexture,coords).xy; vec4 val = ...
2
votes
1answer
116 views

Assimp renders a partial amount of vertices

I'm building a 3D game, and i'm trying to load some assets with the nice Assimp library. The model should look like the one in the first picture, but instead, it takes the form of some kind of ...