shader

Beginning Shader Development

I want to get started doing some game development using Microsoft's XNA. Part of that is Shader development, but I have no idea how to get started. I know that nVidia's FX Composer is a great tool to develop shaders, but I did not find much useful and updated content on how to actually get started. What tutorials would you recommend?...

How can I tint a sprite to white in XNA?

I don't think this is possible just using the color setting in SpriteBatch, so I'm trying to work out a simple shader that would take every pixel and make it white, while respecting the alpha value of the pixel. The answer Joel Martinez gave looks right, but how do I incorporate that when I draw the sprite with SpriteBatch? ...

Count image similarity on GPU [OpenGL/OcclusionQuery]

OpenGL. Let's say I've drawn one image and then the second one using XOR. Now I've got black buffer with non-black pixels somewhere, I've read that I can use shaders to count black [ rgb(0,0,0) ] pixels ON GPU? I've also read that it has to do something with OcclusionQuery. http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_...

Can pixel shaders be used when rendering to an offscreen surface?

I'm considering integrating some D3D code I have with WPF via the new D3DImage as described here: My question is this: Do pixel shader's work on offscreen surfaces? ...

Applying PixelShaders on offscreen Bitmaps

hi there, i'm currently experimenting using PixelShaders introduced with .net 3.5 sp1 to improve image processing performance. everything is much faster , but til yet i just had effects applied to some elements in my wpf forms, that i actually want to avoid. we have a bunch of image processing functionality and i'd like to replace some...

Jogl Shader programming

I just started Shader programming(GLSL) and created a few with RenderMonkey. Now I want to use this Shaders in my java code. Are there any simple examples of how I do that? ...

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...

Collision detection with hardware generated primitives

There's a lot of literature on collision detection, and I've read at least a big enough portion of it to be fairly familiar with most techniques. However, there's something that has eluded me for a while, and I figured, since StackOverflow provides access to a large group of brilliant minds at once, I'd ask here first before digging arou...

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...

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...

Line Art Effect by Pixel Shader in WPF?

I want to create a Line Art effect but as I got vertex shader is not supported by WPF now. Is there a way to create Line Art effect by Pixel Shader? Any idea? Thanks. ...

What is Vertex and Pixel shaders?

What is Vertex and Pixel shaders? What is the difference between them? Which one is the best? Thanks! ...

Direct3D 10 and Shader Management

Hi, I am coding a 3d Application with DirectX 10 and I am wondering how the tackeling of the Shadermanagement is. Is it most effective to preload all shaders there are on application start and then use them as needed or does this train the resources of the hardware if the number gets higher. Also I wonder if it is a speed consideratio...

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? ...

Can I see shader preprocessor output?

I am using #defines, which I pass runtime to my shader sources based on program state, to optimize my huge shaders to be less complex. I would like to write the optimized shader to a file so that next time I run my program, I do not have to pass the #defines again, but I can straight compile the optimized shaders during program startup b...

WPF PixelShaders: How to create a Temporary Register dependency property?

Hi, I've run out of the 8 possible constant registers in a wpf pixelshader effect. I need access to temporary registers, which I believe are available 6 on a DX 8.1 level gfx cards. Question is: How to create a temporary register dependency property in C# code? Constant registers are created like this: public static readonly Depende...

OpenGL v2.0 Shaders with Dev-C++ and SDL?

I was about to rebuild my library in Dev-C++, under Windows; however, the shader functionality I've added in the meantime is not supported, the compiler could not find the related functions (::glCreateShader(), ::glCreateProgram(), etc.) Digging around the internet and the Dev-C++ folder, I've found that the OpenGL implementation (gl.h)...