Re: [Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hello Johannes, On 2017-01-23 02:05, Johannes wrote: > On 21.01.2017 00:01, Carsten Neumann wrote: >> Can you adjust the changes to TextureBuffer/LayeredTextureBuffer >> to be in line with the above? Thanks! > > here we go :-) thank you. It appears this in a small way depends on the GL changes in part 5 though? I've added the missing function pointer type for glFramebufferTextureLayer to OSGGLFuncProtos.h to make it independent of that change. Thanks again, Cheers, Carsten -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users
Re: [Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hello Carsten, On 21.01.2017 00:01, Carsten Neumann wrote: > Can you adjust the changes to TextureBuffer/LayeredTextureBuffer > to be in line with the above? Thanks! here we go :-) Best Johannes diff -rupN ./opensg_org/Source/System/State/Base/OSGTextureObjChunk.cpp ./opensg_texture/Source/System/State/Base/OSGTextureObjChunk.cpp --- ./opensg_org/Source/System/State/Base/OSGTextureObjChunk.cpp 2017-01-16 11:34:55.022138400 +0100 +++ ./opensg_texture/Source/System/State/Base/OSGTextureObjChunk.cpp 2016-09-26 12:15:54.703999700 +0200 @@ -480,7 +480,8 @@ void TextureObjChunk::handleTexture(Wind } if((imgtarget == GL_TEXTURE_1D_ARRAY || -imgtarget == GL_TEXTURE_2D_ARRAY ) && +imgtarget == GL_TEXTURE_2D_ARRAY || +imgtarget == GL_TEXTURE_CUBE_MAP_ARRAY) && !win->hasExtOrVersion(_extTextureArray, 0x0300)) { FWARNING(("texture arrays not supported on Window %p!\n", @@ -596,18 +597,21 @@ void TextureObjChunk::handleTexture(Wind glTexParameteri(paramtarget, GL_TEXTURE_MAG_FILTER, getMagFilter()); glTexParameteri(paramtarget, GL_TEXTURE_WRAP_S, getWrapS()); -if(paramtarget == GL_TEXTURE_2D || - paramtarget == GL_TEXTURE_2D_ARRAY || - paramtarget == GL_TEXTURE_3D || - paramtarget == GL_TEXTURE_CUBE_MAP_ARB || - paramtarget == GL_TEXTURE_RECTANGLE_ARB ) +if(paramtarget == GL_TEXTURE_2D || + paramtarget == GL_TEXTURE_2D_ARRAY || + paramtarget == GL_TEXTURE_3D || + paramtarget == GL_TEXTURE_CUBE_MAP_ARB || + paramtarget == GL_TEXTURE_CUBE_MAP_ARRAY || + paramtarget == GL_TEXTURE_RECTANGLE_ARB ) { glTexParameteri(paramtarget, GL_TEXTURE_WRAP_T, getWrapT()); } -if(paramtarget == GL_TEXTURE_2D_ARRAY || - paramtarget == GL_TEXTURE_3D || - paramtarget == GL_TEXTURE_CUBE_MAP_ARB ) +if(paramtarget == GL_TEXTURE_2D_ARRAY || + paramtarget == GL_TEXTURE_3D || + paramtarget == GL_TEXTURE_CUBE_MAP_ARB || + paramtarget == GL_TEXTURE_CUBE_MAP_ARRAY ) + { glTexParameteri(paramtarget, GL_TEXTURE_WRAP_R, getWrapR()); } @@ -748,6 +752,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: +case GL_TEXTURE_CUBE_MAP_ARRAY: osgGlCompressedTexImage3D( imgtarget, i - baseLevel, @@ -802,6 +807,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: +case GL_TEXTURE_CUBE_MAP_ARRAY: osgGlTexImage3D(imgtarget, i - baseLevel, internalFormat, @@ -1124,6 +1130,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: osgGlCompressedTexImage3D(imgtarget, 0, internalFormat, osgNextPower2(width), @@ -1192,6 +1199,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: osgGlTexImage3D(imgtarget, 0, internalFormat, @@ -1269,6 +1277,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case GL_TEXTURE_2D_ARRAY: +case GL_TEXTURE_CUBE_MAP_ARRAY: osgGlCompressedTexImage3D(imgtarget, 0, internalFormat, width, height, depth, @@ -1315,6 +1324,7 @@ void TextureObjChunk::handleTexture(Wind break; case GL_TEXTURE_3D: case
Re: [Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hello Johannes, On 2017-01-20 03:45, Johannes wrote: > I have reread these articles and I now tend to agree with you wrt to the > LayeredTextureBuffer. However, the GL_TEXTURE_CUBE_MAP_ARRAY is missing > nevertheless (?) yes, looks like it is missing. I think it should make use of glFramebufferTexture for the cubemap array case though. > This stuff is not easy to grasp. Most important for me is that I have > the OpenSG primitives at hand that I need to translate my plain OpenGL > shadow implementation into OpenSG land. I think OSG::TextureBuffer is the one that should use glFramebufferTextureLayer (for cubemap array and similar cases) to make non-layer attachments. To me that seems in line with it's other uses where it binds a plain 2D image as the attachment. Since you have a use case for these, you are likely in a much better position to verify changes. Can you adjust the changes to TextureBuffer/LayeredTextureBuffer to be in line with the above? Thanks! Cheers, Carsten -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users
Re: [Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hello Carsten, first off, I'm not an expert with textures. First I will show you how I initialize my shadow maps in my plain OpenGL example. So that you understand what I want to map into OpenSG land. Example: [1] Next the sources I have studied: https://www.khronos.org/opengl/wiki/Framebuffer_Object https://www.khronos.org/opengl/wiki/Geometry_Shader#Layered_rendering https://www.opengl.org/sdk/docs/man/html/glFramebufferTextureLayer.xhtml https://www.opengl.org/sdk/docs/man/html/glFramebufferTexture.xhtml I have reread these articles and I now tend to agree with you wrt to the LayeredTextureBuffer. However, the GL_TEXTURE_CUBE_MAP_ARRAY is missing nevertheless (?) This stuff is not easy to grasp. Most important for me is that I have the OpenSG primitives at hand that I need to translate my plain OpenGL shadow implementation into OpenSG land. Best, Johannes [1] void OpenGLWindow::InitializeShadowFBO() { if (_shadow_casters_point > 0) { glGenTextures(1, &_texture_shadow_array_point_id); glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, _texture_shadow_array_point_id); glTexImage3D( GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 6 * _shadow_casters_point, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr); glTexParameteri (GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri (GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri (GL_TEXTURE_CUBE_MAP_ARRAY, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); for (unsigned int i = 0; i < _shadow_casters_point * 6; i++) { GLuint fbo_id; glGenFramebuffers(1, _id); glBindFramebuffer(GL_FRAMEBUFFER, fbo_id); glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, _texture_shadow_array_point_id, 0, i); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); glBindFramebuffer(GL_FRAMEBUFFER, 0); } glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, 0); } if (_shadow_casters_dir > 0) { glGenTextures(1, &_texture_shadow_array_dir_id); glBindTexture(GL_TEXTURE_2D_ARRAY, _texture_shadow_array_dir_id); glTexImage3D( GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, _shadow_casters_dir, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr); glTexParameteri (GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri (GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); GLfloat borderColor[] = { 1.0, 1.0, 1.0, 1.0 }; glTexParameterfv(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_BORDER_COLOR, borderColor); glTexParameteri (GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri (GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST); for (unsigned int i = 0; i < _shadow_casters_dir; i++) { GLuint fbo_id; glGenFramebuffers(1, _id); glBindFramebuffer(GL_FRAMEBUFFER, fbo_id); glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, _texture_shadow_array_dir_id, 0, i); glDrawBuffer(GL_NONE); glReadBuffer(GL_NONE); glBindFramebuffer(GL_FRAMEBUFFER, 0); } glBindTexture(GL_TEXTURE_2D_ARRAY, 0); } } -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users
Re: [Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hello Johannes, On 2017-01-18 04:58, Johannes Brunen wrote: > Currently, I'm working on shadow techniques. For these I do need texture > arrays, especially cube map arrays. I have added support to the > TexureObjChunk and to LayeredTextureBuffer and TextureBuffer. I think this changes the semantics of LayeredTextureBuffer in an incompatible way, so I'm not sure we can do this right away. See below why I think this changes semantics. > The last two did have an 'unused' field named 'zoffset'. According to > the specs of GL the correct parameter name is 'layer' and I have > modified the Interface accordingly. See the .fcd files for that. > > Additionally the Buffers work with the 'glFramebufferTextureLayer' API > of OpenGL now. My understanding of glFramebufferTextureLayer is that it is used to attach a single face of a cubemap array texture as a framebuffer attachment. While when using a cubemap array texture with glFramebufferTexture3D this attaches all 6 faces of the cubemap as a layered attachment point. Which of the layers a primitive is rendered to is decided at runtime using a geometry shader that assigns to the builtin variable gl_Layer. Therefore (assuming the above is correct and I didn't misread the patch) you are changing LayeredTextureBuffer from creating such a layered attachment to a non-layered attachment. I think the use of 'glFramebufferTextureLayer' should only be in TextureBuffer, since that is used for non-layered framebuffer attachments. Cheers, Carsten -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot ___ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users
[Opensg-users] OpenSG2: Accumulated changes... part 3: texture
Hi, on request of Carsten I have split up my 'accumulated changes' into smaller chunks so that it easier to look at them. Currently, I'm working on shadow techniques. For these I do need texture arrays, especially cube map arrays. I have added support to the TexureObjChunk and to LayeredTextureBuffer and TextureBuffer. The last two did have an 'unused' field named 'zoffset'. According to the specs of GL the correct parameter name is 'layer' and I have modified the Interface accordingly. See the .fcd files for that. Additionally the Buffers work with the 'glFramebufferTextureLayer' API of OpenGL now. Best, Johannes opensg_texture_diff Description: opensg_texture_diff -- Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot___ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users