[OT] using manually generated mipmaps

hello

i am trying to manually generated mipmaps to work. with no success. the idea is basically the same as it can be found in the ‘red book’.
when i set

GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST);

to

GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);

i can at least see the first of the mipmaps. probably because mipmapping is turned of then.

i was wandering if anyone has ever successfully done this kind of mipmapping and could help me out with a code snip or correct my mistake.

cheers
d3

TextureReader.Texture[] texture = new TextureReader.Texture[6];
try {
for (int i=0; i<texture.length; i++){
texture[i] = TextureReader.readTexture(“demos/data/images/”+i+".png");
}
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}

gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST_MIPMAP_NEAREST);

for (int i=0; i<texture.length; i++){
gl.glTexImage2D(GL.GL_TEXTURE_2D,
i,
GL.GL_RGB,
texture[i].getWidth(),
texture[i].getHeight(),
0,
GL.GL_RGB,
GL.GL_UNSIGNED_BYTE,
texture[i].getPixels());
}

Do your mip map levels go all the way down to a 1x1 version? If you don’t do this, texture mapping is automatically disabled (see the note on page 388 of the red book).
If you don’t want to provide all the levels you have to call

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, <maximum level>)

or in your specific case

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5)

Note that this method is only available starting at OpenGL 1.2

thanx it worked very nicely. i have my depth blurring now :slight_smile:
actually in my ‘red book’ it s not on page 388 or not at all available because it is an old old old relase 1.

i ll buy a new one.

http://www.d3raum.net/temp/mipmap.jpg