{"id":162,"date":"2020-02-28T13:14:43","date_gmt":"2020-02-28T13:14:43","guid":{"rendered":"https:\/\/www.vcreatelogic.com\/?p=162"},"modified":"2020-02-28T13:16:24","modified_gmt":"2020-02-28T13:16:24","slug":"leveraging-shadow-maps-in-qt-without-using-qopenglframebufferobject","status":"publish","type":"post","link":"https:\/\/www.vcreatelogic.com\/index.php\/2020\/02\/28\/leveraging-shadow-maps-in-qt-without-using-qopenglframebufferobject\/","title":{"rendered":"Leveraging shadow maps in Qt, without using QOpenGLFrameBufferObject"},"content":{"rendered":"\n<p>A few years ago I was attempting to use shadow maps in Qt\/OpenGL but was simply unable to use QOpenGLFrameBufferObject as a shadow-buffer. I had even posted a <a rel=\"noreferrer noopener\" aria-label=\"question about it on stack-overflow (opens in a new tab)\" href=\"https:\/\/stackoverflow.com\/questions\/35134270\/how-to-use-qopenglframebufferobject-for-shadow-mapping\" target=\"_blank\">question about it on stack-overflow<\/a> here. It turns out, you cannot use QOpenGLFrameBufferObject for creating shadow buffers. So, I had to resort to native OpenGL calls. Recently someone reached to me on LinkedIn asking me if I could share the code. <\/p>\n\n\n\n<p>So here it is: <a rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/pnudupa\/codesamples\/tree\/master\/bike_shadows (opens in a new tab)\" href=\"https:\/\/github.com\/pnudupa\/codesamples\/tree\/master\/bike_shadows\" target=\"_blank\">https:\/\/github.com\/pnudupa\/codesamples\/tree\/master\/bike_shadows<\/a><\/p>\n\n\n\n<p>When the code at this repository is compiled and executed, we can see a window with two bikes, with their shadows on the ground and on each other.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"1024\" src=\"https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview-993x1024.jpg\" alt=\"\" class=\"wp-image-164\" srcset=\"https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview-993x1024.jpg 993w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview-291x300.jpg 291w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview-768x792.jpg 768w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview.jpg 1424w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p>You can press any key to rotate the whole scene and watch the shadows move.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"1024\" src=\"https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview_2-993x1024.jpg\" alt=\"\" class=\"wp-image-166\" srcset=\"https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview_2-993x1024.jpg 993w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview_2-291x300.jpg 291w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview_2-768x792.jpg 768w, https:\/\/www.vcreatelogic.com\/wp-content\/uploads\/2020\/02\/Shadow_Bike_Preview_2.jpg 1424w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>A few years ago I was attempting to use shadow maps in Qt\/OpenGL but was simply unable to use QOpenGLFrameBufferObject as a shadow-buffer. I had even posted a question about it on stack-overflow here. It turns out, you cannot use QOpenGLFrameBufferObject for creating shadow buffers. So, I had to resort to native OpenGL calls. Recently &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.vcreatelogic.com\/index.php\/2020\/02\/28\/leveraging-shadow-maps-in-qt-without-using-qopenglframebufferobject\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Leveraging shadow maps in Qt, without using QOpenGLFrameBufferObject&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-162","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/posts\/162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/comments?post=162"}],"version-history":[{"count":3,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/posts\/162\/revisions"}],"predecessor-version":[{"id":167,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/posts\/162\/revisions\/167"}],"wp:attachment":[{"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/media?parent=162"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/categories?post=162"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vcreatelogic.com\/index.php\/wp-json\/wp\/v2\/tags?post=162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}