Example #1
0
 public void Dispose()
 {
     if (Disposed)
     {
         return;
     }
     Disposed = true;
     NativeGL.nglDeleteFramebuffer(FBO);
     Opengl32.glDeleteTextures(1, new int[] { Texture });
 }
Example #2
0
 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);
 }
Example #3
0
        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);
        }
Example #4
0
 public void BindTexture()
 {
     Opengl32.glBindTexture(GLConsts.GL_TEXTURE_2D, Texture);
 }
Example #5
0
 public static void TexCoord(float s, float t)
 {
     Opengl32.glTexCoord2f(s, t);
 }
Example #6
0
 public static void Color(float red, float green, float blue, float alpha)
 {
     Opengl32.glColor4f(red, green, blue, alpha);
 }
Example #7
0
 public static void Color(System.Drawing.Color c)
 {
     Opengl32.glColor4f(c.R / 255f, c.G / 255f, c.B / 255f, c.A / 255f);
 }
Example #8
0
 public static void Color(float red, float green, float blue)
 {
     Opengl32.glColor3f(red, green, blue);
 }
Example #9
0
 public static void Vertex2(System.Drawing.PointF p)
 {
     Opengl32.glVertex2f(p.X, p.Y);
 }
Example #10
0
 public static void Vertex2(float x, float y)
 {
     Opengl32.glVertex2f(x, y);
 }
Example #11
0
 public static void End()
 {
     Opengl32.glEnd();
 }
Example #12
0
 public static void Begin(PrimitiveType primitiveType)
 {
     Opengl32.glBegin((int)primitiveType);
 }