A programming language for OpenGL shaders.

learn more… | top users | synonyms

4
votes
2answers
513 views

Rain drops on screen

I am trying to make simple rain drop effect on screen.Something like this http://fc00.deviantart.net/fs20/f/2007/302/5/6/Rain_drops_by_rockraikar.png My idea is to: Create small drop shaped normal ...
3
votes
1answer
744 views

What is the difference between Constant Vertex Attributes and Uniforms?

According to the OpenGL ES 2.0 Programming Guide: A constant vertex attribute is the same for all vertices of a primitive, and therefore only one value needs to be specified for all the vertices of ...
3
votes
1answer
521 views

GLSL per pixel lighting with custom light type

Ok, I am having a big problem here. I just got into GLSL yesterday, so the code will be terrible, I'm sure. Basically, I am attempting to make a light that can be passed into the fragment shader (for ...
1
vote
2answers
237 views

Low complexity shader to indicate the sides of a polyline

I have a bunch of polylines that I draw using GL_LINES. They can have thousands of points. They actually represent the separation of land and water on a map. I don't have complete polygons, just the ...
3
votes
1answer
545 views

GLSL custom interpolation filter

I'm currently building a fragment shader which is using several textures to render the final pixel color. The textures are not really textures, they are in fact "input data" to be used in the formula ...
1
vote
0answers
1k views

ssao implementation

I try to implement a ssao based on this tutorial: link I use a deferred rendering and world coordinates for shading calculations. When saving gbuffer a vertex shader output looks like this: ...
0
votes
1answer
319 views

OpenGL ES 2. How do I Create a Basic Fading Streak Effect?

For the iPad app I am writing using OpenGL ES 2 I have a single quad - shaded using GLSL - that is dragged around the screen. Very basic. This works fine. But is rather boring. I want to increase ...
0
votes
1answer
343 views

OpenGLES GLSL Shader attributes always bound to 0

So I have a very simple vertex shader as follows #version 120 attribute vec3 position; attribute vec3 inColor; uniform mat4 mvp; varying vec3 fragColor; void main(void){ fragColor = inColor; ...
0
votes
2answers
2k views

Passing multiple Vertex Attributes in GLSL 130

(note this question is closely related to this one however I didn't fully understand the accepted answer) To support videocards in laptops I have to rewrite my GLSL 330 shaders to GLSL 130. I'm ...
4
votes
3answers
156 views

How to read BC4 texture in GLSL?

I'm supposed to receive a texture in BC4 format. In OpenGL, i guess this format is called GL_COMPRESSED_RED_RGTC1. The texture is not really a "texture", more like a data to handle at fragment ...
1
vote
1answer
408 views

samplerCubeShadow and texture offset

I use sampler2DShadow when accessing a single shadow map. I create PCF in this way: result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(-1,-1)); result += textureProjOffset(ShadowSampler, ...
2
votes
1answer
315 views

Billboarding restricted to an axis (cylindrical)

I have succesfully created a GLSL shader for a billboarding effect. I want to tweak this to restrict the billboarding to an arbitrary axis, i.e. a billboarded quad only rotates itself about the ...
5
votes
2answers
628 views

Geometry shader for multiple primitives

How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so: layout(triangles) in; ...
2
votes
2answers
531 views

Is this a reliable method of parsing glGetShaderInfoLog()?

I want to get a list of errors and their line numbers so I can display the error information differently from how it's formatted in the error string and also to show the line in the output. It looks ...
2
votes
1answer
124 views

Uniform not being applied to proper mesh [closed]

Ok, I got some code, and you select blocks on a grid. The selection works. I can modify the blocks to be raised when selected and the correct one shows. I set a color which I use in the shader. ...
1
vote
2answers
261 views

Depth buffer values reset on change shader?

I have 2 different shaders, and when I change the shader (glUseProgram), it seems that the depth information is lost, because everything drawn with the 2nd shader appears completely on top of anything ...
3
votes
2answers
641 views

OpenGL sprites and point size limitation

I'm developing a simple particle system that should be able to perform on mobile devices (iOS, Andorid). My plan was to use GL_POINT_SPRITE/GL_PROGRAM_POINT_SIZE method because of it's efficiency ...
1
vote
1answer
131 views

running GL ES 2.0 code under Linux ( no Android no iOS )

I need to code OpenGL ES 2.0 bits and i would like to do this and run the programs on my desktop for practical reasons. Now, i already have tried the official GLES SDK from ATI for my videocard but ...
3
votes
2answers
996 views

Learning OpenGL GLSL - VAO buffer problems?

I've just started digging through OpenGL and GLSL, and now stumbled on something I can't get my head around this one!? I've stepped back to loading a simple cube and using a simple shader on it, but ...
2
votes
0answers
369 views

GLSL Bokeh using Quads and Textures [closed]

I'm trying to create a depth of field effect with bokeh sprites in GLSL. Specifically, what i would like to do is, for each pixel: See if the pixel is out of the focal range If it is, draw a quad ...
0
votes
1answer
296 views

What are the steps taken by this GLSL code?

1 void main(void) 2 { 3 vec2 pos = mod(gl_FragCoord.xy, vec2(50.0)) - vec2(25.0); 4 float dist_squared = dot(pos, pos); 5 6 gl_FragColor = (dist_squared < 400.0) 7 ? ...
0
votes
1answer
398 views

Correct Rotation and Translation with a 4x4 matrix

I am using a 4x4 matrix to transform verts in a shader. I multiply an identity matrix by a rotation matrix by a translation matrix. I am trying to first rotate the verts and then translate them, ...
0
votes
1answer
674 views

How to convert Maya shaders and Renderman shaders to GLSL?

I know this 2 products but i have never used them for production, since I have a bunch of cool shaders i would like to use them under OpenGL with GLSL but i don't know where to start. If it's not ...
6
votes
1answer
229 views

GLSL vertex shaders with movements vs vertex off the screen

If i have a vertex shader that manage some movements and variations about the position of some vertex in my OpenGL context, OpenGL is smart enough to just run this shader on only the vertex visible on ...
12
votes
1answer
1k views

Should I distribute shaders in a compiled form or in plain text?

Having an application that uses shaders that have been wrote in GLSL, what is the best strategy for the distribution in the real world and for the desktop and mobile? I'm aiming to distribute this in ...
3
votes
1answer
730 views

First-Time GLSL Shadow Mapping Problems [closed]

I'm working on building out a 2.5D engine and having massive problems getting my shadows working. I'm at a point where I'm VERY close. So, let's see a picture to see what I have: As you can see ...
7
votes
1answer
2k views

GLSL, all in one or many shader programs?

I am doing some 3D demos using OpenGL and I noticed that GLSL is somewhat "limited" (or is it just me?). Anyway I have many different types of materials. Some materials have ambient and diffuse color, ...
5
votes
3answers
540 views

Finding out what pixel on the screen the fragment falls on

In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen. Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so ...
1
vote
0answers
239 views

Full screen shader causes performance hit

I basically want to have a shader run that can do something like toon shading, or grayscale the whole screen, or radial lighting. To do this, I create a new bitmap each time the display resizes that ...
4
votes
1answer
2k views

Access vertex data stored in VBO in the shader

If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data ...
3
votes
1answer
1k views

Deferred Rendering and Normal Mapping

I'm working on a deferred renderer and need a bit of help getting normal maps working. What I've been doing with them so far is just multiplying the normal texture with the object normals ...
9
votes
4answers
3k views

Debugging Shader Code?

I'm writing a game engine, and when I use a perspective camera I get a black screen. I am not going to ask exactly why this is because there would be a lot of code to share and, frankly, I think ...
2
votes
3answers
779 views

Can you dynamically set which texture to use in-shader?

I'm working on a user interface system, and I want to be able to mix textured polies with frag-coloured polies. Here's my shader code, that doesn't work: attribute vec2 vertex_coords; attribute float ...
2
votes
1answer
2k views

Does Macbook Air 2012 (Intel HD4000) support GLSL 1.3+?

I'm using SDL2 and GLEW on OSX Mountain Lion (2012 Macbook Air) to create an OpenGL context. Querying for the GLSL version, it reports GLSL version 1.2. I'm curious if this is a limitation of the ...
10
votes
2answers
4k views

OpenGL: VBO or glBegin() + glEnd()?

I recently was given this link to a tutorial site from someone who I gave the original OGL Redbook to. The third header down says distinctly to forget glBegin() & glEnd() as the typical render ...
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 ...
3
votes
1answer
2k views

Sea water shader using only fragment processor

I have a game that runs on mobile devices (OpenGL ES 2.0) and for which I would like to create some sea water using the shaders. Now, the plane on which the sea water texture will be has only 4 ...
1
vote
3answers
409 views

Shaders not linking correctly

I'm writing a rather simple "ShaderManager" which aids me with loading shaders in Open GL, altough I am having a few issues: The shaders don't link correctly The the attributes don't bind Here's ...
1
vote
2answers
374 views

Lights system with shaders in OpenGL?

In more than just 1 occasion, i read about 2 ways of doing a light's system in OpenGL: normal way? i don't know how to call this one with the shaders ( GLSL ) The problem is i don't get the ...
1
vote
1answer
975 views

Shader authoring/editing tools for GLSL ES

Since Render Monkey has been discontinued (perhaps due to the complexity of today's shading languages), there are few successors that can match its functionality. Is there any useful tool for material ...
1
vote
3answers
519 views

Writing a shader once without using CG?

Is there a tool that can convert a fragment shader from hlsl to glsl or glsl to hlsl? I do not want to use cg since it is not able to work on mobile platforms. Is there a tool that can make it so I ...
10
votes
1answer
485 views

Special relativity shader in GLSL

I'm trying to implement a GLSL shader which helps understanding special relativity Lorentz Transformation. Let's take two axis-aligned inertial observer O and O' . The observer O' is in motion w.r.t ...
1
vote
1answer
2k views

GLSL - rewriting (geometry) shader from #330 to #130 version

I'm having trouble running example from: https://raw.github.com/progschj/OpenGL-Examples/master/07geometry_shader_blending.cpp My graphics card supports only #130 shaders version so I have to rewrite ...
2
votes
2answers
520 views

Lighting problems with Terrain

I'm in the process of learning Open GL and am having issues with lighting on my Terrian, I don't know if the issue is related to how I calculate my normals or the shader itself (I am using the shader ...
0
votes
0answers
289 views

Making shaders work for both ATI and NVIDIA in Blender Game Engine

Unfortunately coding OpenGL shaders is more strict for ATI cards. I am trying to get this code from this thread http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR to ...
2
votes
0answers
241 views

Kinect User Silhouette Shader

I have this usermap from kinect's depth data (size is 320x280) and i want to display it on my game. The problem, of course it's ugly (first image) and i want to have beautiful effect like in the ...
3
votes
1answer
2k views

GLSL if-else statement unexpected behaviour

This question is related to this other one I asked a few days ago. Because I have finally get to the bottom of the issue, I have rather preferred to open a new question with a more detailed ...
6
votes
4answers
669 views

Impact of variable-length loops on GPU shaders

Its popular to render procedural content inside the GPU e.g. in the demoscene (drawing a single quad to fill the screen and letting the GPU compute the pixels). Ray marching is popular: This means ...
1
vote
1answer
178 views

Blur gets displaced compared to original image

I have implemented a SSAO and I'm using a blur step to smooth it out. The problem is that the blurred texture is slightly displaced compared to the original. I'm blurring using a 4x4 kernel since that ...
2
votes
2answers
1k views

Updating texture memory via shader?

What the title says.Is it possible to update a texture via a glsl shader ? Something like : //Read vec4 Pixel = texture2D(TextureID,gl_TexCoord[TextureIndex].st); //Write to texture memory ? vec4 ...