Я недавно скачал OpenTK. Я создал базовый игровой класс и квадроцикл. Я пытался визуализировать текстуру в своем квадроцикле, но это не сработало. Вот мой код. Это загрузка текстуры. (Класс текстуры содержит только идентификатор и растровое изображение. GetWidth() и GetHeight() просто возвращают Bitmap.Width и Bitmap.Height).
Texture Texture = new Texture ();
Texture.Bitmap = new Bitmap (Path);
Texture.ID = GL.GenTexture ();
GL.BindTexture (TextureTarget.Texture2D, Texture.ID);
BitmapData data = Texture.Bitmap.LockBits (new Rectangle (0, 0, Texture.GetWidth (), Texture.GetHeight ()), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
GL.TexImage2D (TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Texture.GetWidth(), Texture.GetHeight(), 0, OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.Bitmap, data.Scan0);
Texture.Bitmap.UnlockBits (data);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
return Texture;
Это метод рендеринга.
GL.Enable (EnableCap.Texture2D);
GL.BindTexture (TextureTarget.Texture2D, ID);
GL.Begin (PrimitiveType.Quads);
GL.TexCoord2 (0, 1); GL.Vertex2 (0, 32);
GL.TexCoord2 (1, 1); GL.Vertex2 (32, 32);
GL.TexCoord2 (1, 0); GL.Vertex2 (32, 0);
GL.TexCoord2 (0, 0); GL.Vertex2 (0, 0);
GL.End ();
GL.Disable (EnableCap.Texture2D);
Он рендерит только квадроцикл и больше ничего. Кто-нибудь может мне помочь?