public void Render(RenderingContext rc) { CurrentShader.Use(); CurrentShader.SetFieldValue("scale", scale); CurrentShader.SetFieldValue("size", size); var identity = Matrix4.Identity; CurrentShader.SetFieldValue("modelview", ref identity); GL.Enable(EnableCap.Texture2D); GL.DepthMask(false); GL.BindTexture(TextureTarget.Texture2D, _crosshair.Index); GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); Buffering.ApplyBufferPointers(CurrentShader); GL.DrawArrays(PrimitiveType.Quads, 0, NumVerticies); GL.DepthMask(true); GL.BindTexture(TextureTarget.Texture2D, 0); }
public Bitmap GenerateHeightMap(RenderingContext rc) { GL.BindTexture(TextureTarget.Texture2D, 0); Bitmap b = TakeRenderingContextScreenshot(0, 0, 800, 600, () => { GL.Enable(EnableCap.Texture2D); Vector3 size = new Vector3(1, 1, 1); Vector3 scale = new Vector3(1, 1, 1); //GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); CurrentShader.Use(); CurrentShader.SetFieldValue("scale", scale); CurrentShader.SetFieldValue("size", size); CurrentShader.SetFieldValue("seed", (float)seed.NextDouble()); // (float)rc.Time * 0.001f var identity = Matrix4.Identity; CurrentShader.SetFieldValue("modelview", ref identity); GL.DepthMask(false); GL.BindBuffer(BufferTarget.ArrayBuffer, vbo); Buffering.ApplyBufferPointers(CurrentShader); GL.DrawArrays(PrimitiveType.Quads, 0, NumVerticies); GL.DepthMask(true); }); GL.BindTexture(TextureTarget.Texture2D, 0); GL.UseProgram(0); this.Image = b; return b; }