OSDN Git Service

Do a real mipmap test, as the fake one crashes some drivers.
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 3 Jul 2011 21:40:52 +0000 (21:40 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 3 Jul 2011 21:40:52 +0000 (21:40 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@939 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Rendering/Rendering.cs

index a848371..4fbeca2 100644 (file)
@@ -413,7 +413,17 @@ namespace Radegast.Rendering
                 {\r
                     try\r
                     {\r
+                        int testID = -1;\r
+                        Bitmap testPic = new Bitmap(1, 1);\r
+                        BitmapData testData = testPic.LockBits(new Rectangle(0, 0, 1, 1), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb);\r
+                        GL.GenTextures(1, out testID);\r
+                        GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb8, 1, 1, 0, OpenTK.Graphics.OpenGL.PixelFormat.Bgr, PixelType.UnsignedByte, testData.Scan0);\r
+                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);\r
+                        GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.GenerateMipmap, 1);\r
                         GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);\r
+                        testPic.UnlockBits(testData);\r
+                        testPic.Dispose();\r
+                        GL.DeleteTexture(testID);\r
                     }\r
                     catch\r
                     {\r
@@ -833,7 +843,7 @@ namespace Radegast.Rendering
         private void SetPerspective()\r
         {\r
             float dAspRat = (float)glControl.Width / (float)glControl.Height;\r
-            GluPerspective(50.0f * Camera.Zoom, dAspRat, 0.1f, (float)Camera.Far * 3);\r
+            GluPerspective(50.0f * Camera.Zoom, dAspRat, 0.1f, 1000f);\r
         }\r
 \r
 \r
@@ -2000,5 +2010,4 @@ namespace Radegast.Rendering
         }\r
         #endregion Context menu\r
     }\r
-\r
 }\r