This sample demonstrates how to load and display a simple texture.\par
\b\fs28\par
Controls\par
\b0\fs22\par
Press Esc or click the close button to exit.\par
\par
\b\fs28 Implementation\par
\b0\fs22\par
1. The OnLoad event handler constructs a new texture object with GL.GenTextures(). It then uses System.Drawing.Bitmap to load an image from the hard drive and uploads the image data to OpenGL via GL.TexImage2D().\par
\par
2. The OnRenderFrame event handler uses immediate mode to render a simple textured quad.\par
\par
Note 1: System.Drawing.Bitmap stores its image data in BGRA order. This means we must use Bgra as our PixelFormat in GL.TexImage2D().\par
\par
Note 2: In GL.TexImage2D(), PixelInternalFormat defines the storage format of texels ("texel elements") in video memory. PixelFormat defines the format of the image data we will upload to video memory. If these do not match, OpenGL will automatically convert our image data from PixelFormat to PixelInternalFormat, which will incure a slight performance penalty.\par
\par
Note 3: In this sample, we explicitly disable mipmaps by setting TextureMinFilter to Linear (via GL.TexParameter()). Alternatively, we could enable mipmaps (set TextureMinFilter to LinearMipmapNearest or LinearMipmapLinear) and generate mipmaps for our source image using GL.GenerateMipmap().\par
\par
Note 4: Do not forget to enable texturing via GL.Enable(EnableCap.Texture2D) prior to rendering. Without this, textures will show up white!\par