NSight - cubemap problem

I seem to be having a problem viewing cubemaps with NSight 3.2. They’re rendered from the current scene to be used as reflection maps, which works just fine. They show up exactly as I’d expect them to in the scene. The cubemap that NSight displays for me in the frame debugger however simply has the same one face mirrored across all six.

I create all the textures for the cube map with:

for (int i = 0; i < 6; ++i)
{
	glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, 128, 128, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
}

and attach the proper texture to the FBO before rendering.

glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, cubemap, 0);

As I’ve said, it works just fine. It just doesn’t work for me when I try to view the texture in NSight. The texture it displays is instead a previously used, entirely unrelated texture, mirrored across all six faces.

I’m new to NSight, so I’m probably missing something obvious. Any help is appreciated.

I realize that I might not have described the problem all too well, so here is another attempt, with a more simplified case. I simply create a cubemap from textures once, and use that to render it. It’s pretty much all that’s happening in this scene.

glGenTextures(1,&cubemap);
glBindTexture(GL_TEXTURE_CUBE_MAP,cubemap);

glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_R,GL_CLAMP_TO_EDGE);

glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_red.bmp"));
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_green.bmp"));
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_blue.bmp"));
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_teal.bmp"));
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_yellow.bmp"));
glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL_RGB, 512, 512, 0, GL_BGR, GL_UNSIGNED_BYTE, Texture::loadTextureData("c:/GL/Textures/grid_purple.bmp"));

glGenerateMipmap(GL_TEXTURE_CUBE_MAP);

glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

Hi Integria,

I modified the gl-420-texture-cube sample from G-Truc’s OpenGL Sample Pack ([url]http://www.g-truc.net/project-0026.html[/url]) to be similar to your code. However, I wasn’t able to reproduce the issue. Would you mind clicking on the texture, clicking the left most square, and tell me if it shows red at all mip levels? Does the right most square show the same thing?

Thanks,

-Jeff

Sorry for the late response, I haven’t been at my workstation. The mipmap levels, when I do produce them, look fine. They’ll all red and similar, across all the faces of the cubemap. It almost seems as if NSight assumes that it’s the same texture uploaded to all six faces.

If it’s any help, I’m running the newest version of NSight, with the newest driver for my 480. Visual Studio 2012 Pro on Windows 8.

If I get the time, I’ll try with the OpenGL sample later, to see if that works for me. It does use a different internal format, as far as I remember, and loads from a DDS file rather than a bitmap.

Hi Integria,

Any chance we can get a binary reproducible of the issue?

Thanks,

-Jeff

Actually, the example works fine for me as well (gl-420-texture-cube). Is there any reason it should work using compressed texture formats (GL_COMPRESSEDRGB_S3TC_DXT_EXT with glCompressedTexSubImage2D()) and not with simple, uncompressed formats (GL_RGB / GL_UNSIGNED_BYTE with glTexSubImage2D())?

I’ve gotten it to work, but not exactly in a manner that makes any sense to me. I’m quite confident that the data I’m uploading to the GPU is 8 bits per channel, and I’m consequently using RGB8 for the internal format. This simply doesn’t work for me, at all. If I use RGB10 or RGB12 for the internal format of the texture, it works.

See the pictures below. The first one has its storage created as RGB8, the second one as RGB10. That’s the only difference. Both work just fine in terms of OpenGL - the cubemap is fully functional in both cases. Only the latter works for NSight, though.

glTexStorage2D(GL_TEXTURE_CUBE_MAP, GLint(1), GL_RGB8, GLsizei(512), GLsizei(512));

glTexStorage2D(GL_TEXTURE_CUBE_MAP, GLint(1), GL_RGB10, GLsizei(512), GLsizei(512));

Hi !
I’m also new to NSight and I have the exact same problem.
I’ve got the same texture repeated 6 times in Nsight but the cubemap works correctly in my app, just like you.
I’m using OpenGL 3.3 core. Can it be the problem ?
And indeed when I use GL_RGB10 instead of GL_RGB8 the problem is solved inside Nsight …

Hello all,

We have someone looking into this now.

I can confirm this problem. Cube-Map shows up correctly in introspection of gDEBUGGER but not with Nsight.

I see the same problem with cubemaps

Hey guys,

We have a fix now that is going through QA, we should have an update that will have this fixed very soon.
Thanks for the report.

Hello,

A new build (3.2.2) is now out which has the fixes for the issues you were running into. Could you please download and try this new build and let me know if it has been resolved on your end?
Thank you

Hi !
Thanks a lot for the update.
Well well well … it’s almost there …

1/ In resources/All resources, I can see my cubemap texture correctly ! Great.
2/ In the Graphic HUD, my cubemap texture is displayed correctly ! Great again.
3/ When I click on this HUD texture, I can see a full screen version of my cubemap texture correctly !!
But …
In Resources/Graphical, the problem is still there, 6 times the same front texture …

As I said, big and great improvement, but not completely fixed … :(

Hi ceydricG, all,

We narrowed down the problem and have a fix going through the process, sorry for missing that case.
As before, we will have an updated build out soon. It may be January before we ship the update. Hopefully you are able to live with this issue until then? If this is a problem, please PM me and we can see if we can help you out.

Thanks

Fine by me !
This is absolutely not a big issue so don’t bother, I will gladly get the new version when it arrives.
Thanks a lot !