isidisi Posted July 3, 2010 Share Posted July 3, 2010 How can I do, with Leadwerks Engine or OPENGL, to detect maximum shadow map size supported by a graphics card? I want to set shadow map size to the maximum quality supported. Thanks Quote Link to comment Share on other sites More sharing options...
isidisi Posted July 22, 2010 Author Share Posted July 22, 2010 Maybe I can use glTexImage2D(GL_PROXY_TEXTURE_2D... OPENGL function, but I doesn't know the format of the shadow texture... Any help???? Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 22, 2010 Share Posted July 22, 2010 Maximum shadowmap size is the same as maximum texture size, and you can get it this way: http://www.opengl.org/resources/faq/technical/texture.htm#text0120 Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
isidisi Posted July 22, 2010 Author Share Posted July 22, 2010 Maximum shadowmap size is the same as maximum texture size, and you can get it this way: http://www.opengl.org/resources/faq/technical/texture.htm#text0120 yes glTexImage2D is the funcion I said to use, but what format is using Leadwerks to pass the right parameters to the function? I tried with this code: GLint testWidth = 256; GLint resWidth; while( true ) { glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA8, testWidth, testWidth, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &resWidth); if (resWidth == 0 ) { resWidth = testWidth / 2; break; } else { testWidth *=2; } } and I obtained than my maximum texture size is 16384 but Leadwerks engine hungs when I select a shadowmapsize of 4096 or higher... I think is because I didn't pass the right parameters... Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 22, 2010 Share Posted July 22, 2010 8192x8192 takes already 256MB of VRAM, 16384x16384 takes 1GB. And since LE needs mipmaps, they take about twice as much. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
isidisi Posted July 22, 2010 Author Share Posted July 22, 2010 I have debugged with glslDevil and I found that the call that Leadwerks is doing when I set ShadowmapSizeto 512 is: glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); if I set ShadowmapSizeto 1024 then I see in the debugger: glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); so always is creating a texture 2 * ShadowmapSize Then we have to divide by 2 the max texture calculated in the routine I posted. resWidth /= 2; and replace the glTexImage2D call with glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 33191, testWidth, testWidth, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); Using 33191 and GL_DEPTH_COMPONENT as parameters, my max texture size is 8192, then my max shadomapsize is 4096. I tried this with a simple program with a rotating cube and it's ok, works with 4096 and not with 8192 :-) But if I load a big quantity of models the 4096 doesn't works anymore, I think as you say because then there's not enough memory to allocate both models and texture... but at least there's a way to detect max shadowmap size because of max texture size... Thanks lumooja Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.