Big trouble with ceating mipmaps automatically

classic Classic list List threaded Threaded
11 messages Options
adi
Reply | Threaded
Open this post in threaded view
|

Big trouble with ceating mipmaps automatically

adi
Hello

With opengl >4.3 ist seems that glu.gluBuild2DMipmaps ist deprecated.
Now in want set automatically some Mipmaps, but nothing works.
I have tested it with this code sequenz but it fails, only a base map
can be created, but no mipmaps:

gl.glTexParameteri( GL4.GL_TEXTURE_3D, GL4.GL_TEXTURE_MIN_FILTER, GL4.GL_LINEAR_MIPMAP_LINEAR);
gl.glTexParameteri( GL4.GL_TEXTURE_3D, GL4.GL_TEXTURE_BASE_LEVEL, 0);
gl.glTexParameteri( GL4.GL_TEXTURE_3D, GL4.GL_TEXTURE_MAX_LEVEL, 2);

gl.glTexImage3D( GL4.GL_TEXTURE_3D, 0, format, width, height, 1, 0, format, GL4.GL_UNSIGNED_BYTE, null );
gl.glTexSubImage3D( GL4.GL_TEXTURE_3D, 0, 0, 0, 0, width(), height, 1, format, GL4.GL_UNSIGNED_BYTE, datas);
gl.glGenerateMipmap( GL4.GL_TEXTURE_3D );


Have somewhere a tip, how i can this resolve?


Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

gouessej
Administrator
What makes you think it is deprecated?

You can look at how JMonkeyEngine and JogAmp's Ardor3D Continuation create their mipmaps. The former uses glGenerateMipmap.
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

adi
hello

I have read, that in OpenGL 4.0, the entire fixed-function pipeline (used by glu*) is deprecated.
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

gouessej
Administrator
Actually, JOGL GLU can use native GLU but by default it uses the Java implementation which doesn't require GL2 to create mipmaps:
https://github.com/sgothel/jogl/blob/master/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java

glGenerateMipmap isn't deprecated anyway.
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

adi
Thanks

You are right, but glGenerateMipmap works not correct.
It should correct create the mipmaps, but there are no such.

Theoretically it should create the mipmaps, i want not copy
existing mipmaps.
What i want is an automatic generation of mipmaps to a base map.



 
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

gouessej
Administrator
There is probably something wrong in your code, glGenerateMipmap is used in JMonkeyEngine, it works correctly but you pass null to glTexImage3D, look at your last parameter.

Edit.: Maybe you're right:
http://stackoverflow.com/questions/25138320/glgeneratemipmap-doesnt-work-with-3d-textures-in-opengl
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

adi
Hi

I have also testet with
gl.glTexImage3D( GL4.GL_TEXTURE_3D, 0, format, width, height, 1, 0, format, GL4.GL_UNSIGNED_BYTE, datas );
alone. Only the (base) map what ist in datas was drawn correct.

In the shader i call then
// the base map, that is ok
vec4 textureColor = texture(colormap, vec3(texCoord[0],0));
then a new test with
vec4 textureColor = texture(colormap, vec3(texCoord[0],1));
and so on. I can't see mipmapping

I have also testet with GL4.GL_TEXTURE_2D_ARRAY, but nothing,
the same problem.
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

gouessej
Administrator
I fear that it works only with GL_TEXTURE_2D. If it fails even in this case, it will probably come from your code.
Julien Gouesse | Personal blog | Website
adi
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

adi
This post was updated on .
I think, then is there a problem with auto generation
for mipmaps. The glut functions are only utils, for there,
are no specification planed in the future, i think.
The gluBuild2DMipmaps are sure not supported in the future, i think.
Only, in the moment, it seems there is no aquivalent function.
It's not a problem. So i kick out that case in my functions, and all mipmaps must created before.
(I have send an email to Nvidea, they can that solve that in the Krohnos Group.
The normal user need here a solution.)



 

adi
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

adi
In reply to this post by gouessej
SOLVED!

There are two problems with that.

First, the glGenerateMipmap function works only after 
the following code sequenz was made:

glTexParameteri( GL4.GL_TEXTURE_2D, GL4.GL_TEXTURE_MIN_FILTER, GL4.GL_LINEAR_MIPMAP_LINEAR);
glTexImage2D(GL4.GL_TEXTURE_2D, .......);
glGenerateMipmap(GL4.GL_TEXTURE_2D,);

(there are no chance with GL4.GL_TEXTURE_3D or GL4.GL_TEXTURE_2D_ARRAY in opengl 4.4, because that is
not yet implemented says the runtime)

Second, the texture(...) - and the textureLod(...) inline shader functions handels
the lod counter different. It seems, textureLod works correct.  
Reply | Threaded
Open this post in threaded view
|

Re: Big trouble with ceating mipmaps automatically

gouessej
Administrator
Thank you for the feedback but this is probably already implemented that way in JMonkeyEngine.
Julien Gouesse | Personal blog | Website