I'm trying to figure out the best way to pick informations rendered using shaders.
A window manager buffer (the window) is used for outputting rendering. On user event I should pick the geometry rendered. Using gluPick is easy, but I'm trying to pick using only shaders.
Flexibility of shaders doesn'y aid me to find a correct solution. I...
Hopefully this is an easy question. I like things being organised, so I would like to have two pixel shaders; the first doing one thing, and then the next doing something else. Is this possible, or do I have to pack everything into the one shader? Thanks.
...
Hi,
I am currently working on some raycasting in GLSL which works fine. Anyways I want to go from orthogonal projection to perspective projection now but I am not sure how to properly do so.
Are there any good links on how to use a projection Matrix with raycasting?
I am not even sure what I have to apply the matrix to (propably to the...
GLSL has a full C-style preprocessor. The only thing that does not work is #include. One of the great features is that that you can used #ifdef to comment out functions and thus create one shader that can be thinned out if certain features are not used.
My Question is:
Is there a way to define a macro from C code?
There seems no way...
Hi!
I am trying to add some shaders to my old OpenGL program that draws a lot of GL_POINTS and some GL_LINES.
I created these two shaders:
Vertex shader:
void main()
{
vec4 v = vec4(gl_Vertex);
v.z = v.z + sin(v.x*v.x + v.y*v.y)/10.0;
gl_Position = gl_ModelViewProjectionMatrix * v;
}
Fragment shader:
#version 120
vo...
I am currently writing the positions of my geometry to the RGB channels of gl_FragColor and I would like to write 1.0 to the alpha channel if the fragment is part of geometry, and 0.0 if its empty.
Is there a simple way to tell if a fragment is geometry or not? Maybe through gl_FragCoord.z?
thanks
...
I got this after querying the info logs when a compile error occurred. I have not been able to find a single resource that tells me what the error code even means!
Using Ubuntu 9.10 with an Intel mobile chipset that supports glsl 1.1. Mesa driver.
Vertex Shader:
#version 110
in vec3 m2d_blendcolor;
out vec3 color;
// out vec2 texcoor...
Hi, I have 16bit grayscale data on which I would like to make such operations:
For every pixel:
1) Compute sample 's' downsampling 16bit->8bit using LUT
2) Store sample in RGB (24bit - 8bit per sample) texture R=s,G=s,B=s
At the end I would like to have data that I could use in a windows DIB directly ( unsigned short 8bit per sample RGB...
I need to debug a GLSL program but I don't know how to output intermediate result.
Is it possible to make some debug traces (like with printf) with GLSL ?
...
Hi All,
I am trying to get update the eye position in my shader from my appliaction but I keep getting error 1281 when I attempt this. I have no problems after the initialization just when i subsequently try to update the values. Here is my code:
void GraphicsObject::SendShadersDDS(char vertFile [], char fragFile [],
...
I need a datastructure of the same size as the normal depth buffer and I need to be able to read from and write to it in a shader. Is this possible, and what does this datastructure look like?
...
Is it possible to access the surface normal - the normal associated with the plane of a fragment - from within a fragment shader? Or perhaps this can be done in the vertex shader?
Is all knowledge of the associated geometry lost when we go down the shader pipeline or is there some clever way of recovering that information in either the ...
I am trying to use a trivial geometry shader but when run in Shader Builder on a laptop with a GMA X3100 it falls back and uses the software render. According this document the GMA X3100 does support EXT_geometry_shader4.
The input is POINTS and the output is LINE_STRIP.
What would be required to get it to run on the GPU (if possible)
...
Is it possible to set the color of a single vertex using a GLSL vertex shader program, in the same way that gl_Position changes the position of a vertex ?
...
I'm trying to learn to play with OpenGL GLSL shaders. I've written a very simple program to simply create a shader and compile it. However, whenever I get to the compile step, I get the error:
Error: Preprocessor error
Error: failed to preprocess the source.
Here's my very simple code:
#include <GL/gl.h>
#include <GL/glu.h>
#include...
Hi,
I want to be able to calculate the direction of a line to eye coordinates and store this value for every pixel on the line using a vertex and fragment shader. My idea was to calculate the direction gradient using atan2(Gy/Gx) after a modelview tranformation for each pair of vertices then quantize this value as a color intensity to pa...
I'm doing ray casting in the fragment shader. I can think of a couple ways to draw a fullscreen quad for this purpose. Either draw a quad in clip space with the projection matrix set to the identity matrix, or use the geometry shader to turn a point into a triangle strip. The former uses immediate mode, deprecated in OpenGL 3.2. The latt...
Hello, I would like to render the 3D volume data: Density(can be mapped to Alpha channel), Temperature(can be mapped to RGB).
Currently I am simulationg maximum intensity projection, eg: rendering the most dense/opaque pixel in the end.But this method looses the depth perception.
I would like to imitate the effect like a fire inside the...
Are there any guidelines for writing efficient shaders in GLSL? Does the compiler handle most of the optimization?
...
Hi!
Is there a maximum number of assembly language instructions to be loaded into the fragment program unit?
I have an algorithm on to port from cpu to gpu and apparently it doesn't fit on the gpu.
...