A programming language for OpenGL shaders.

learn more… | top users | synonyms

3
votes
1answer
206 views

Texture prefetching in GLSL

I have a fragment shader which needs lots of semi-random access to 32x32 texture patch. Fortunately, the patch is constant for each poly, so there should be no issue storing the whole thing to the ...
5
votes
2answers
827 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
159 views

Queries regarding Geometry Shaders

I am dealing with geometry shaders using GL_ARB_geometry_shader4 extension. My code goes like : GLfloat vertices[] = { 0.5,0.25,1.0, 0.5,0.75,1.0, -0.5,0.75,1.0, ...
0
votes
2answers
543 views

GLSL light coloring blocked surfaces

I have created a very simple lighting shader. It currently only supports point lights, but it lights up surfaces that are completely blocked from the light. I know why, but I want to know how I can ...
24
votes
4answers
20k views

Using multiple shaders

I'm currently studying opengl shaders but I can't figure out something: how to apply different shaders to the objects, for example, a teapot rendered using toon shader and another one in the same ...
4
votes
1answer
142 views

Forcing early-z with raytracing

I'm working on a GLSL raytracer, and I need to be able to edit gl_FragDepth in the FS. However, doing so disables early-z culling. The scene is rendered front-to-back and the FS can only push points ...
1
vote
0answers
478 views

shader-based particle systems [on hold]

I have a classic particle system where each particle is represented by a quad and, each time step, I move each particle. My target is webGL which means I don't have instancing, attribute divisors nor ...
1
vote
1answer
358 views

Multisampled Texture

i have some doubts with multisampled textures. In fragment shader, how to pass multiple samples? We use glTexImage2DMultisample instead of glTeximage2D. so, how to upload texture data? I want to ...
5
votes
1answer
203 views

Blend multiple regions from same texture atlas

I'm representing terrain in my game as a grid with at each node a composition, for example 100% rock, or 50% grass, 50% soil. I'd like to use this composition vector to blend textures together. I'm ...
3
votes
1answer
502 views

how to organize rendering

I use a deferred rendering. During g-buffer stage my rendering loop for a sponza model (obj format) looks like this: int i = 0; int sum = 0; map<string, mtlItem *>::const_iterator itrEnd = ...
2
votes
1answer
174 views

Shadow cubemapping?

I am working on a game with C++ and OpenGL 3.2. I have successfully implemented directional shadow maps and now I'd like to upgrade them to shadow cube maps (for point lights). I've done some Googling ...
3
votes
1answer
2k views

How are vertex shader outs sent as inputs to the fragment shader?

I'm learning some OpenGL 3.2 way of doing things and I think it's quite great, I'm actually understanding more of shaders and non-fixed pipeline in 1 week rather than those 2 years I tried to learn ...
1
vote
1answer
297 views

fragment shader with SNORM textures

I want to apply SNORM texture by using GL_TEXTURE_3D as a target, what will be the fragment shader for the same? Also, what should be the data type of texture data?
4
votes
0answers
1k views

OpenGL problem with FBO integer texture and color attachment [closed]

In my simple renderer, I have 2 FBOs one that contains diffuse, normals, instance ID and depth in that order and one that I use store the ssao result. The textures I use for the first FBO are RGB8, ...
2
votes
1answer
778 views

Low-level GPU code and Shader Compilation

Bear with me, because I will raise several questions at once. I still feel, though, that overall this can be treated as one question that may be answered succinctly. I recently dove into solidifying ...
13
votes
1answer
1k views

Toon/cel shading with variable line width?

I see a few broad approaches out there to doing cel shading: Duplication & enlargement of model with flipped normals (not an option for me) Sobel filter / fragment shader approaches to edge ...
1
vote
2answers
295 views

Deferred rendering order?

There are some effects for which I must do multi-pass rendering. I've got the basics set up (FBO rendering etc.), but I'm trying to get my head around the most suitable setup. Here's what I'm ...
5
votes
1answer
479 views

Cheap ways to do scaling ops in shader?

I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about ...
2
votes
0answers
356 views

Per fragment lighting with OpenGL 4.x tessellated model

I'm experienced with OpenGL 3+. I'm dabbling with tessellation shaders and have now got to a point where I have a nicely tessellated teapot/plane demo (quick look here) As can be seen from the ...
1
vote
1answer
329 views

how to use a mask texture?

A texture pack for a sponza model contains mask textures (black and white). I guess that I should read only a red channel from that texture, right ? I use deferred rendering and for shading ...
3
votes
1answer
1k 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
638 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
266 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
920 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 ...
0
votes
0answers
2k views

ssao implementation [closed]

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: ...
5
votes
1answer
2k views

Morph a sphere to a cube and a cube to a sphere with GLSL

I'm getting started with GLSL with quartz composer. I have a patch with a particle system in which each particle is mapped into a sphere with a blend value. With blend=0 particles are in random ...
0
votes
1answer
381 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
532 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; ...
1
vote
2answers
3k 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
199 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 ...
0
votes
1answer
801 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 ...
1
vote
1answer
622 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
475 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 ...
3
votes
2answers
1k 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 ...
4
votes
2answers
634 views

How Do I Raycast for a Spherical Harmonic Shader Using the iOS GPU?

I am beginning an Spherical Harmonics shader project for an iOS app I am writing. I have begun by reading this excellent in-depth paper on the subject (PDF) - http://bit.ly/aQmax3. The paper ...
2
votes
2answers
640 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 ...
5
votes
2answers
892 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
1answer
133 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
277 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
757 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 ...
2
votes
4answers
558 views

What is a right datatype in C++ for OpenGL scene representation with use of GLSL

I am programming in C++ OpenGl with GLSL. Until now I have been using a data structure that is composed of std::vector filled with structures of vertexes and with their parameters (position , normal, ...
9
votes
2answers
2k views

Sorting objects before rendering

I'm trying to implement a scene graph and in all the articles i've come across there is talk about object sorting. So you'd sort your objects by "material" for example. Now untill i sat down and ...
10
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, ...
1
vote
1answer
134 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 ...
2
votes
2answers
891 views

Simple OpenGL program major slow down at high resolution

I have created a small OpenGL 3.3 (Core) program using freeglut. The whole geometry is two boxes and one plane with some textures. I can move around like in an FPS and that's it. The problem is I face ...
2
votes
0answers
429 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 ...
11
votes
6answers
12k views

OpenGL ES 2.0: Repository of Quality Shaders

Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please? I am looking for pixel based ligting shaders (such as phong) and simmilar. ...
0
votes
1answer
322 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
486 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, ...
6
votes
1answer
277 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 ...