/// <summary> /// /// </summary> public void InitializeExtensions() { if (extensionList == null) { GlExtensionLoader.LoadAllExtensions(); // get the OpenGL version string and vendor name glVersion = Marshal.PtrToStringAnsi(Gl.glGetString(Gl.GL_VERSION)); videoCard = Marshal.PtrToStringAnsi(Gl.glGetString(Gl.GL_RENDERER)); vendor = Marshal.PtrToStringAnsi(Gl.glGetString(Gl.GL_VENDOR)); // parse out the first piece of the vendor string if there are spaces in it if (vendor.IndexOf(" ") != -1) { vendor = vendor.Substring(0, vendor.IndexOf(" ")); } // create a new extension list extensionList = new StringCollection(); string allExt = Marshal.PtrToStringAnsi(Gl.glGetString(Gl.GL_EXTENSIONS)); string[] splitExt = allExt.Split(Char.Parse(" ")); // store the parsed extension list for (int i = 0; i < splitExt.Length; i++) { extensionList.Add(splitExt[i]); } } }
public virtual void ExposeEvent(object sender, ExposeEventArgs args) { view.Glx.MakeCurrent(view.GdkWindow); Gl.glEnable(Gl.GL_CONVOLUTION_2D); Gdk.Color c = view.Style.Background(view.State); Gl.glClearColor(c.Red / (float)ushort.MaxValue, c.Blue / (float)ushort.MaxValue, c.Green / (float)ushort.MaxValue, 1.0f); if (texture == null) { float [] kernel = new float [] { .25f, .5f, .25f, .5f, 1f, .5f, .25f, .5f, .25f }; #if false bool supported = GlExtensionLoader.LoadExtension("GL_ARB_imaging"); if (!supported) { System.Console.WriteLine("GL_ARB_imaging not supported"); return; } #else GlExtensionLoader.LoadAllExtensions(); #endif Gl.glConvolutionParameteri(Gl.GL_CONVOLUTION_2D, Gl.GL_CONVOLUTION_BORDER_MODE, Gl.GL_REPLICATE_BORDER); Gl.glConvolutionFilter2D(Gl.GL_CONVOLUTION_2D, Gl.GL_INTENSITY, 3, 3, Gl.GL_INTENSITY, Gl.GL_FLOAT, kernel); texture = new Texture(view.CompletePixbuf()); } Gl.glShadeModel(Gl.GL_FLAT); Gl.glColor3f(1.0f, 1.0f, 1.0f); Gl.glEnable(Gl.GL_DEPTH_TEST); Gl.glEnable(Gl.GL_NORMALIZE); Gl.glShadeModel(Gl.GL_FLAT); Gl.glEnable(Gl.GL_TEXTURE_RECTANGLE_ARB); Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); transition.Draw(view.Allocation, texture, texture); view.Glx.SwapBuffers(view.GdkWindow); args.RetVal = true; Gl.glDisable(Gl.GL_CONVOLUTION_2D); }