Forum

Using GL_GENERATE_MIPMAP with Quake

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Using GL_GENERATE_MIPMAP with Quake

Postby JasonX » Fri Apr 08, 2011 3:26 pm

I'm trying to use glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); with GLQuake, but i'm getting a strange error on compile.

error C2065: 'GL_GENERATE_MIPMAP' : undeclared identifier

What can be happening? I saw something about outdated headers, how can i fix it?
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Postby mh » Fri Apr 08, 2011 3:46 pm

You just need a #define for GL_GENERATE_MIPMAP in your glquake.h, like so:
Code: Select all
#define GL_GENERATE_MIPMAP 0x8191

You might also want to use glHint (GL_GENERATE_MIPMAP_HINT, GL_FASTEST) or glHint (GL_GENERATE_MIPMAP_HINT, GL_NICEST) to control the performance vs quality levels, although as it's a hint drivers are not obliged to respect it.
Code: Select all
#define GL_GENERATE_MIPMAP_HINT 0x8192

I'd generally use GLEW for this kinda thing as it can make the whole process of dealing with extensions a LOT less painful.

Be aware that this is a very old extension and has long ago been superseded by the glGenerateMipmap function (which is part of the GL_ARB_framebuffer_object extension). Also be aware that not all hardware supports hardware mipmapping, some hardware that does claim to support it does not do so reliably, and that hardware mipmapping is kinda crap as it can generally only do a point or linear filter for miplevel reduction, whereas box filter is what you really want for the best quality.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby JasonX » Fri Apr 08, 2011 4:00 pm

Interesting, thanks. Also, quick question, how can i increase texture size depending on the player distance from it?

Like mip-mapping decreases, i want to do the inverse.
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm

Postby mh » Fri Apr 08, 2011 4:26 pm

You can't; you've got fairly limited control over this part of the pipeline. The closest you can get is not mipmapping at all, and that just leaves sizes the same (and you can see from the ugly artefacts it creates - and how slow it is - that increasing size might not be a good idea).
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby JasonX » Sat Apr 09, 2011 2:13 am

Oh, how sad. I wanted to experiment a little bit. :(
JasonX
 
Posts: 411
Joined: Tue Apr 21, 2009 2:08 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest