Jump to content
  • Advertisement
Sign in to follow this  
Bakura

Mipmapping not working with FBO ? Why ?

This topic is 3672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ! My problem is that it seems that I can't get working mipmapping with textures generated on an offscreen buffer (FBO). What I want is a texture base level, and each pixel of sublevels textures being the average value of the four pixels of the previous level. I tried to generate them by myself on the GPU, but it's much more slower than automatic mipmap generation. If I remember well, what I want is defined by GL_LINEAR_MIPMAP_NEAREST for MIN_FILTERING (bilinear). Here is how I do :
[source code="cpp"]
glGenFramebuffersEXT (1, &lightPyramidsCreationFBO);
	
	glGenTextures (1, &lightPyramidsCreationPosition);
	glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationPosition);
	glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
        glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
	
	glGenTextures (1, &lightPyramidsCreationNormal);
	glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationNormal);
	glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
        glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
		
	glGenTextures (1, &lightPyramidsCreationIntensity);
	glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationIntensity);
	glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
        glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

	glBindTexture (GL_TEXTURE_2D, 0);
	
	glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, lightPyramidsCreationFBO);
	glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, lightPyramidsCreationPosition, 0);
	glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_2D, lightPyramidsCreationNormal, 0);
	glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_TEXTURE_2D, lightPyramidsCreationIntensity, 0);

	GLenum status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
	if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
		std::cerr << "No problem" << std::endl;

Then my shader writes to the 3 textures (with gl_FragData[0-1-2]). I precise that glGenerateMipmapsEXT doesn't seem to work on ATi cards (I've got a 3870HD). Next, I draw some quads in order to see if mipmapping has worked : if I set GL_NEAREST or GL_LINEAR for MIN_FILTERING, all the textures work but each subtextures is the same than the others (no average values as I want). If I set GL_*_MIPMAP_*, only the base level works, all of the sublevels textures are entirely black, but don't know why ! In the same time, the textures have been generated because if I call those lines : GLfloat data1, data2; glGetTexLevelParameterfv (GL_TEXTURE_2D, 1, GL_TEXTURE_WIDTH, &data1); glGetTexLevelParameterfv (GL_TEXTURE_2D, 1, GL_TEXTURE_HEIGHT, &data2); std::cout << data1 << '*' << data2 << std::endl; I get 256*256... Thanks for your help :)

Share this post


Link to post
Share on other sites
Advertisement
glGenerateMipmapsEXT should work with ATI cards... You need to create all the mipmap levels first though. I am not sure if RGBA16 is a supported format on ATI cards for mipmapping with FBOs... I use Nvidia so I can't comment on this. I do know you can use glGenerateMipmapsEXT and that it was created for FBOs. So create all your mipmap levels manually and call glGenerateMipmapsEXT. Also what errors are you getting back from GL if any for the FBO...

Share this post


Link to post
Share on other sites
Hi,

I've already tried that. I don't know exactly where do I have to put glGenerateMipmapEXT, so I tried at various places (during creation of textures, after binding the framebuffer, before binding the framebuffer)... The base level still work, but all sublevels are black. As the previous methods, if I set GL_LINEAR or GL_NEAREST for min filter, it works, but with GL_*_MIPMAP_*, black screen :/.

[source code="cpp"]
glGenTextures (1, &lightPyramidsCreationPosition);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationPosition);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glGenerateMipmapEXT (GL_TEXTURE_2D);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

glGenTextures (1, &lightPyramidsCreationNormal);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationNormal);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glGenerateMipmapEXT (GL_TEXTURE_2D);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

glGenTextures (1, &lightPyramidsCreationIntensity);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationIntensity);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glGenerateMipmapEXT (GL_TEXTURE_2D);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);




About the compatibility with ATi cards, I've read that on OpenGL officiel forum (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=237975) see second post.

Share this post


Link to post
Share on other sites
The normal method of doing this is;

@ Init
- create FBO
- create target texture with GL_LINEAR and GL_NEAREST filters
- (optionally) bind texture to FBO

@ Render
- bind FBO as target
- (optionally) bind texture to FBO
- render as normal
- unbind FBO
- bind texture (glBindTexture(GL_TEXTURE_2D,textureid);)
- call glGenerateMipmapsEXT
- set texture filter to mipmap'd filter
- use

glGenerateMipmapsEXT should work fine on ATI cards, at least up to the X1900 series I last had, I'd even used it. I can't speak for anything newer.

My only pondering would be what V-man brought up; does the hardware support mipmap'd floating point textures; I think everything does but don't quote me on that.

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999
I am not sure if RGBA16 is a supported format on ATI cards for mipmapping with FBOs...


Not to be a stick in the mud, but I stated that a long time ago. This is one reason ATI support sucks as they don't have documentation that is easy to find.

Anyway from their docs...

They may only be sampled as NEAREST or NEAREST_MIPMAP_NEAREST since floating point texture filtering is not supported.

So if you want to use mipmapping with some other format then you will need to do it in the fragment shader. Sorry.

Share this post


Link to post
Share on other sites
Hi ! First of all thank you for having answering me.

It doesn't work either. Here is how I do :

Init time :

[source code="cpp"]

glGenFramebuffersEXT (1, &lightPyramidsCreationFBO);

glGenTextures (1, &lightPyramidsCreationPosition);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationPosition);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

glGenTextures (1, &lightPyramidsCreationNormal);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationNormal);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

glGenTextures (1, &lightPyramidsCreationIntensity);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationIntensity);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, 512, 512, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 1, GL_RGBA16F_ARB, 256, 256, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 2, GL_RGBA16F_ARB, 128, 128, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 3, GL_RGBA16F_ARB, 64, 64, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 4, GL_RGBA16F_ARB, 32, 32, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 5, GL_RGBA16F_ARB, 16, 16, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 6, GL_RGBA16F_ARB, 8, 8, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 7, GL_RGBA16F_ARB, 4, 4, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 8, GL_RGBA16F_ARB, 2, 2, 0, GL_RGBA, GL_FLOAT, NULL);
glTexImage2D (GL_TEXTURE_2D, 9, GL_RGBA16F_ARB, 1, 1, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
//glTexParameteri (GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);





Render time :

[source="cpp"]
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();

gluLookAt (0.0f, 0.0f, 10.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
glTranslatef (0.0, -5.0, 0.0);
//glRotatef (25.0f, 1.0f, 0.0f, 0.0f);

// On rend la scène dans le framebuffer
glUseProgram (lightPyramidsCreationProg);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, lightPyramidsCreationFBO);

glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

GLenum buffers[] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT};

glDrawBuffers (3, buffers);
RenderScene();

glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);

glUseProgram (0);

glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// On rend les textures à l'écran
glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, lightPyramidsCreationPosition);
glGenerateMipmapEXT (GL_TEXTURE_2D);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);

GLfloat data1, data2;
glGetTexLevelParameterfv (GL_TEXTURE_2D, 1, GL_TEXTURE_WIDTH, &data1);
glGetTexLevelParameterfv (GL_TEXTURE_2D, 1, GL_TEXTURE_HEIGHT, &data2);
std::cout << data1 << '*' << data2 << std::endl;

DrawQuad (256.0, 256.0);
glBindTexture (GL_TEXTURE_2D, 0);
glDisable (GL_TEXTURE_2D);





I tried with RGBA8 textures (unsigned byte), but it doesn't work either, but instead of being all black, the texture is all white (not much better ^_^).

Please, could somebody with a 3870HD give me some details ?

EDIT > MARS_99 : Oh, this is not a good news :|... I've tried to generate them on the GPU, but it's quite expensive (lot of texture lookups :/), and not practical, and with larger textures, it'll be more and more expensive !! But the whole algorithm relieves on those mipmaps textures, so I have no solution :/. Fuck you ATi. I decided to buy again an ATi card because I was quite happy with their old stuff (9800 Pro) and I wanted to encourage them, but that's not great !! (NB : GL_NEAREST and GL_NEAREST_MIPMAP_NEAREST doesn't work either, black texture...)

EDIT : I found the ATI doc that you quoted... But it was a documentation of the R300 (9700 and 9800), I'm sure it has changed now... :(

[Edited by - Bakura on May 8, 2008 2:13:05 PM]

Share this post


Link to post
Share on other sites
I know this can be frustrating, but hang in there.

I see with the init code you call
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

then with the rendering you call

glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);

I am guessing you need to call the min filter with a mipmapping type. Maybe the driver isn't using mipmapping due to the GL_NEAREST call...

Also have you tried RGBA32F...

I don't see a call to glGenerateMipmapEXT(GL_TEXTURE_2D); after each set of Bound texture objects. IIRC you need to do this to establish a mipmap chain...

Share this post


Link to post
Share on other sites
Hi,

I just apply what phantom said (look at his message). At me too it doesn't look really logical to set some filters at init time and other filters at render time, but he said it was the right way (if I understood well his message).

GL_RGBA32F doesn't work either.

Again, I did what phatnom said : call glGenerateMipmapEXT after binding the texture for rendering. And this I what I did. But if I call glGenerateMipmapEXT after binding each texture at init time, it doesn't work either.

Really frustrating... It's sure that all developers doesn't use OpenGL anymore if the support isn't good...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!