public void Dispose() { if (Disposed) { return; } Disposed = true; NativeGL.nglDeleteFramebuffer(FBO); Opengl32.glDeleteTextures(1, new int[] { Texture }); }
public static void LoadMatrix3x3(float[] m) { Opengl32.glMatrixMode(GLConsts.GL_MODELVIEW); float[] m4x4 = new float[] { m[0], m[1], 0, m[2], m[3], m[4], 0, m[5], 0, 0, 1, 0, m[6], m[7], 0, m[8] }; Opengl32.glLoadMatrixf(m4x4); }
public static int LoadTexture(IntPtr data, int w, int h) { int tex = 0; Opengl32.glGenTextures(1, ref tex); Opengl32.glBindTexture(GLConsts.GL_TEXTURE_2D, tex); Opengl32.glTexImage2D(GLConsts.GL_TEXTURE_2D, 0, GLConsts.GL_RGBA, w, h, 0, GLConsts.GL_RGBA, GLConsts.GL_UNSIGNED_BYTE, data); Opengl32.glTexParameteri(GLConsts.GL_TEXTURE_2D, GLConsts.GL_TEXTURE_MAG_FILTER, GLConsts.GL_LINEAR); Opengl32.glTexParameteri(GLConsts.GL_TEXTURE_2D, GLConsts.GL_TEXTURE_MIN_FILTER, GLConsts.GL_LINEAR); return(tex); }
public void BindTexture() { Opengl32.glBindTexture(GLConsts.GL_TEXTURE_2D, Texture); }
public static void TexCoord(float s, float t) { Opengl32.glTexCoord2f(s, t); }
public static void Color(float red, float green, float blue, float alpha) { Opengl32.glColor4f(red, green, blue, alpha); }
public static void Color(System.Drawing.Color c) { Opengl32.glColor4f(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f); }
public static void Color(float red, float green, float blue) { Opengl32.glColor3f(red, green, blue); }
public static void Vertex2(System.Drawing.PointF p) { Opengl32.glVertex2f(p.X, p.Y); }
public static void Vertex2(float x, float y) { Opengl32.glVertex2f(x, y); }
public static void End() { Opengl32.glEnd(); }
public static void Begin(PrimitiveType primitiveType) { Opengl32.glBegin((int)primitiveType); }