glsl

GLSL major mode for emacs?

I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. If there isn't one, any good elisp reference...

How do you calculate the angle between two normals in glsl?

How do you calculate the angle between two normals in glsl? I am trying to add the fresnel effect to the outer edges of an object (combining that effect with phong shading), and I think that the angle is the only thing I am missing. Fragment Shader: varying vec3 N; varying vec3 v; void main(void) { v = vec3(gl_ModelViewMatrix * gl_V...

Is there any GLSL's ftransform() translation in HLSL?

Hello there! When using GLSL vertex shaders, a way to let the shader work as a fixed-function pipeline is to call the: ftransform(); function. Is there a similar function for HLSL's vertex shaders? Thank you ...

In OpenGL is there a way to get a list of all uniforms & attribs used by a shader program?

I'd like to get a list of all the uniforms & attribs used by a shader program object. glGetAttribLocation() & glGetUniformLocation() can be used to map a string to a location, but what I would really like is the list of strings without having to parse the glsl code. Thanks NeARAZ! Note: In OpenGL 2.0 glGetObjectParameteriv() is replac...

Rendering to cube map

According to ARB_geometry_shader4 it is possible to render a scene onto the 6 faces of a cube map with a geometry shader and the cube map attached to a framebuffer object. I want to create a shadow map using this way. However there seems to be a conflict that I can't resolve: I can only attach a texture with GL_DEPTH_COMPONENT as inter...

GLSL versions change log?

Is there someplace I can read about the changes and additions made in GLSL from version 1.1 to 1.2 and from 1.2 to 1.3? Google seem to be at a loss for this and I really don't want to start reading the complete specification. ...

How to index a texture as a discrete lookup table from a shader?

I'm writing a shader in GLSL and I need to pass it a certain amount of information. The only practical way to pass this information is using a 1-D texture. I'm creating the texture and setting GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER to GL_NEAREST Now from the shader I need to access the texture so I'll be able to exactly index ea...

How can I render to a cubemap?

I am trying to render to a cubemap, and I found instructions here: http://www.opengl.org/wiki/GL_EXT_framebuffer_object#Quick_example.2C_render_to_texture_.28Cubemap.29 glGenTextures(1, &color_tex); glBindTexture(GL_TEXTURE_CUBE_MAP, color_tex); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParamete...

Verbose glsl Shader compile on Intel

I have a project that uses glsl shaders. This project is designed not to print anything to stdout unless something is going wrong or you explicitly turn on some extra debug output. When a shader compile fails the log length given by glGetProgramInfoLog is >0, and sometimes when it succeeds its >0, and gives compile warnings instead. Wh...

Quick sort in GLSL?

I'm considering porting a large chunk of processing to the GPU using a GLSL shader. One of the immediate problems I stumbled across is that in one of the steps, the algorithm needs to maintain a list of elements, sort them and take the few largest ones (which number is dependent on the data). On the CPU this is simply done using an STL v...

AMD RenderMonkey GLSG Config for Alpha Transparency

I'm trying to use RenderMonkey to design a GLSL shader that uses Alpha transparency, and the RenderState editor doesn't use the same terms I'm used to from OpenGL. Can anyone advise on how to configure it for simple Alpha transparency? ...

GLSL fragment shader newb question

the following simple fragment shader code fails, leaving me with an uninformative message in the log (ERROR: 0:1: 'gl_Color' : syntax error syntax error): void main() { vec4 myOutputColor(gl_Color); gl_FragColor = myOutputColor; } while the following one works: void main() { glFragColor = gl_Color; } This boggles my mind, as ...

GLSL: enabling/disabling texturing + shaders

I'm looking for a way to access OpenGL states from a shader. The GLSL Quick Reference Guide, an awesome resource, couldn't really help me out on this one. In the example I'm working on I have the two following shaders: Vertex: void main() { gl_FrontColor = gl_Color; gl_TexCoord[0] = gl_MultiTexCoord0; gl_Position = ftra...

Why can't I know the state of OpenGL lights in GLSL?

Is there a way to find out if a light is enabled in GLSL that doesn't involve passing attributes or creating a ton of different shaders? What about using NVidia's C for Graphics (Cg)? Can I do it with Cg? I am now convinced that you can't do it. But now I ask: why not? ...

OpenGL GLSL interpolation

Hi I try to implement point lights in OpenGL with GLSL. I send all the required data to the shaders. For simplicity I only use the diffuse light here. My example shows a huge triangle which I want to illuminate with a single light source. The light source is shown as a small blue triangle. For diffuse light I need to know the angle be...

glUseProgram(0) takes 50ms?

Are there any reasons a call to disable a glsl program should take 50ms? I did a glFlush before, so it can't be the pipeline being flushed before a program change. Enabling the shader takes 0.03ms. ...

Drawing circles on a sphere

I'm trying to draw lots of circles on a sphere using shaders. The basic alogrith is like this: [1] - calculate the distance from the fragment (using it's texture coordinates) to the location of the circle's center (the circle's center is also specified in texture coordinates) [2] - calculate the angle from the fragent to the center of t...

What options are there for GLSL shader development on OS X?

Apple's Shader Builder is not terribly advanced. I was wondering if there are any better choices for OS X other than running something under bootcamp. ...

GLSL extracting modelmatrix from modelviewmatrix and viewmatrix

hello, since in GLSL the modelmatrix is not available, i was wondering if it is possible to get it programatically from the gl_ModelViewMatrix and the "viewmatrix" which i would pass as a uniform? if yes, how? thank you! ...

What are the error messages for breaking the GLSL shader instruction limits?

We're a small dev team working with some GLSL that may be too large for older graphics cards to compile. We want to display a sensible error message to the user (rather than just dump the info log or output a generic 'this shader didn't work' type of message) when this happens based on the type of error. The question is, ATI and nVidia...