Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  [OT] using manually generated mipmaps  (Read 567 times)
0 Members and 2 Guests are viewing this topic.
Offline d3

JGO n00b
*

Posts: 32


o(_._)o


« on: 2004-01-15 09:24:24 »

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 = 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.getWidth(),
   texture.getHeight(),
   0,
   GL.GL_RGB,
   GL.GL_UNSIGNED_BYTE,
   texture.getPixels());
}<a href="http://" target="_blank">http://</a>
Offline pepijnve

Sr. Member
**

Posts: 379
Medals: 1


Java games rock!


« Reply #1 on: 2004-01-15 10:13:25 »

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
1  
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, <maximum level>)

or in your specific case
1  
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 5)

Note that this method is only available starting at OpenGL 1.2
Offline d3

JGO n00b
*

Posts: 32


o(_._)o


« Reply #2 on: 2004-01-16 03:20:01 »

thanx it worked very nicely. i have my depth blurring now Smiley
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.

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.071 seconds with 20 queries.