JeffM2501's picture

GLu.Build2DMipmap in the new namespaces

So I've recently updated to the current build of OpenTK, and see the namespace changes, and I totally understand them. But one thing I can't find is how to do what Build2DMipmap did before.

I've added OpenTK.Compatibility to my projects in addition to OpenTK, yet it tells me that GLu is deprecated and to use the "math functions inside OpenTK". That's great for most things, but where is the "math" function that builds mip maps?

Is this something that is going to go external to OpenTK?

I know GLU is a hella old API, but it works nice for making simple editing tools.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

You have many options to build mipmaps. From newest (and fastest) to oldest:

  • Use GL.GenerateMipmap()
  • Use GL.TexParameter(..., TextureParameterName.GenerateMipmap, 1)
  • Clone and resize the System.Drawing.Bitmap.
  • Use Glu.Build2DMipmap().
  • Generate mipmaps offline, using an image-editing tool (Paint.Net, Gimp, Photoshop all have options to generate DDS textures which contain mipmaps).

The first two are hardware accelerated and should be very fast. The third and last options have the potential to give higher quality (using a slow bicubic or a sinc filter to resize). The GLU route is both slow and (comparatively) low-quality - but it works and is simple to use.

Note that even though GLU is considered deprecated, you can still use it without issue (it won't go away). You can always use a #pragma to silence the warning if it's too bothersome.

JeffM2501's picture

Excellent, thank you very much :)