Mipmapping
Hey guys! Just a few questions regarding mipmapping in OpenGL.
1. How can I build my own mipmap levels without the gluBuild2DMipmaps() func?
2. Can you dynamically change the LOD texture associated with the mipmapped texture? In other words, can I decide later on to change the kind of texture to be used on LOD level 2, for instance?
3. Can I only have 8 textures (max) sent to the GPU (with multitexturing) at a time? Just out of quriosity.
Aparently this is what my lecturer expects me to do for my geometry clipmaps implementation. To manually generate each terrain LOD layer and to feed it to the GPU for vertex texture fetches, sothat I would only update the levels that has changed instead of updating all 8 levels every time something changes.
Thanks!
Hmm... Ok, I have the following code:
It doesn't want to build my mipmap. Any ideas?
glGenTextures(1, &tex.id);glBindTexture(GL_TEXTURE_2D, tex.id);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);//Send the texture with our vertex heightmap infoterrain_info_t *sub; //Just my info for textures per LOD levelsub = TL_SUB_INFO(0, 0, 0);glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);sub = TL_SUB_INFO(0, 0, 1);glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);sub = TL_SUB_INFO(0, 0, 2);glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);sub = TL_SUB_INFO(0, 0, 3);glTexImage2D(GL_TEXTURE_2D, 3, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);sub = TL_SUB_INFO(0, 0, 4);glTexImage2D(GL_TEXTURE_2D, 4, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);sub = TL_SUB_INFO(0, 0, 5);glTexImage2D(GL_TEXTURE_2D, 5, GL_RGBA_FLOAT32_ATI, sub->width, sub->height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, sub->data);
It doesn't want to build my mipmap. Any ideas?
I had simlar problem. Only 6 mipmaps? a 32*32 height map? It only works for me when I have all lod levels from size*size to 1*1
Thanks a lot man! It works now.
I could answer my other questions after that worked, except question 3. 2 = YES!
I could answer my other questions after that worked, except question 3. 2 = YES!
I would also check for the GL_SGIS_generate_mipmap extension and use it to generate mipmaps automatically if the feature is available. Otherwise, fall back to your own implementation it's not supported.
edit: It's particularly useful if you want to generate all LODs quickly.
edit: It's particularly useful if you want to generate all LODs quickly.
Quote:Original post by Last Attacker
Aparently this is what my lecturer expects me to do for my geometry clipmaps implementation. To manually generate each terrain LOD layer and to feed it to the GPU for vertex texture fetches, sothat I would only update the levels that has changed instead of updating all 8 levels every time something changes.
Thanks!
Vertex program texture fetches are unavailable on most hardware, and fiendishly slow on those that do support it. IMHO you'd be crippling your program with no real gain. Whats wrong with just using regular vertex array attributes?
Quote:Original post by OrangyTang
Vertex program texture fetches are unavailable on most hardware, and fiendishly slow on those that do support it. IMHO you'd be crippling your program with no real gain. Whats wrong with just using regular vertex array attributes?
Well... firstly, I know it is kinda slow but its not that slow. I know that guys from nVidia claims that they have to make the architecture differently to support it more efficiently.
Secondly, the way I've implemented it, it is minimized. I am using VBOs and Vertex Textures and its running with a relatively big terrain between 50-110fps with frustum culling and dynamic branching (and I have a nVidia 6200).
Thirdly, my lecturer wanted me to implement it with vertex textures since he has already done the software one (I think, he showed me the demo). He wants to see how the GPU one would work and act. This is for my honours project.
I also know that any other than nVidia 6/7 series cards doesn't support vertex-textures.
EDIT: Also I believe that working with Vertex Textures greatly simplifies the whole process. IMHO.
Quote:Original post by Tachikoma
I would also check for the GL_SGIS_generate_mipmap extension and use it to generate mipmaps automatically if the feature is available. Otherwise, fall back to your own implementation it's not supported.
edit: It's particularly useful if you want to generate all LODs quickly.
I wanted to use the mipmap generation to manually load the necessary vertex textures of different LOD levels, but I am going to use a different approach now.
Thanks anyway.
Quote:Original post by Last Attacker
3. Can I only have 8 textures (max) sent to the GPU (with multitexturing) at a time? Just out of quriosity.
int maxTextureUnits;
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB,&maxTextureUnits);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement