public MyPointSpriteShaderProgram() { _handle = ShaderTools.CreateShaderProgramFromRes("content.shader.vert", "content.shader.frag", "content.shader.geom"); _locTime = GL.GetUniformLocation(_handle, "time"); _locPointSize = GL.GetUniformLocation(_handle, "pointSize"); LocationPosition = GL.GetAttribLocation(_handle, "position"); LocationVelocity = GL.GetAttribLocation(_handle, "velocity"); }
public MyCameraShaderProgram() { _handle = ShaderTools.CreateShaderProgramFromResource("content.shader.vert", "content.shader.frag"); LocationModelViewProjection = GL.GetUniformLocation(_handle, "modelViewProjection"); LocationInstancePosition = GL.GetAttribLocation(_handle, "instancePosition"); LocationPosition = GL.GetAttribLocation(_handle, "position"); LocationNormal = GL.GetAttribLocation(_handle, "normal"); LocationTexCoord = GL.GetAttribLocation(_handle, "texCoord"); }
private static void Main() { var window = new GameWindow(512, 512); // window with size 512x512 pixel var shaderProgram = ShaderTools.CreateShaderProgram(vertexShaderSource, fragmentShaderSource); void Draw(object sender, FrameEventArgs args) { //clear screen - what happens without? GL.Clear(ClearBufferMask.ColorBufferBit); GL.UseProgram(shaderProgram); GL.DrawArrays(PrimitiveType.Quads, 0, 4); window.SwapBuffers(); // buffer swap needed for double buffering } window.RenderFrame += Draw; // called once each frame; callback should contain drawing code window.Run(); GL.DeleteProgram(shaderProgram); }