示例#1
0
        public GL_Surface(string filename)
        {
            mDisplay = Display.Impl as GL_Display;
            mState   = mDisplay.State;

            mFilename = filename;

            Load();
        }
示例#2
0
        public GL_Surface(Stream st)
        {
            mDisplay = Display.Impl as GL_Display;
            mState   = mDisplay.State;

            // Load The Bitmap
            Drawing.Bitmap sourceImage = new Drawing.Bitmap(st);

            LoadFromBitmap(sourceImage);
        }
示例#3
0
        private GL_Surface(int textureID, Rectangle sourceRect, Size textureSize)
        {
            mDisplay = Display.Impl as GL_Display;
            mState   = mDisplay.State;

            AddTextureRef(textureID);

            mSourceRect  = sourceRect;
            mTextureSize = textureSize;

            mTexCoord = GetTextureCoords(mSourceRect);
        }
示例#4
0
        public GL_Surface(Size size)
        {
            mDisplay = Display.Impl as GL_Display;
            mState   = mDisplay.State;

            mSourceRect = new Rectangle(Point.Empty, size);

            mTextureSize = new Size(NextPowerOfTwo(size.Width), NextPowerOfTwo(size.Height));

            //int[] array = new int[1];
            //GL.GenTextures(1, array);
            int textureID;

            GL.GenTextures(1, out textureID);

            AddTextureRef(textureID);

            IntPtr fake = IntPtr.Zero;

            try
            {
                fake = Marshal.AllocHGlobal(mTextureSize.Width * mTextureSize.Height * Marshal.SizeOf(typeof(int)));

                // Typical Texture Generation Using Data From The Bitmap
                GL.BindTexture(TextureTarget.Texture2D, mTextureID);
                GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
                              mTextureSize.Width, mTextureSize.Height, 0, OTKPixelFormat.Rgba,
                              PixelType.UnsignedByte, fake);

                mTexCoord = GetTextureCoords(mSourceRect);
            }
            finally
            {
                if (fake != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(fake);
                }
            }
        }
示例#5
0
        public override void Initialize()
        {
            mState = new GLState();

            Report("OpenTK / OpenGL driver instantiated for display.");
        }
示例#6
0
        public GLDrawBuffer(GLState state)
        {
            mState = state;

            SetBufferSize(1000);
        }