Axelill's picture

Shaders with openTk.

Hello everyone,

I'dl like to create a shader using opentk but I have a small problem. My shader is in a c# Strinag and opentk accept only a string[] (like the c++ version but it easy to play with pointer in c++)

string _shader = "void main() { gl_Position = ftransform();}"
GL.ShaderSource(m_shader_handle, 1, _shader, null);

this piece of code does not work. Do I need to split my string per lines? or there is something more efficient?

Axel.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

"What's wrong? "

  • You should examine the infologs from compilation and linking, they might tell something like this:
  • A Matrix consisting of 16 Zeros is the same as calling GL.Scale( 0f, 0f, 0f );
  • The varying intensity is used in the fragment shader but never written to in the vertex shader.
  • texCoord is a vec2, but a vec3 is written to it without swizzling.
  • The shader most likely failed to compile and what you're seeing is fixed-func.

Info can be found here http://www.opentk.com/links/tutorials or try a GLSL IDE such as ATI's RenderMonkey.