{"id":592,"date":"2016-10-05T14:25:27","date_gmt":"2016-10-05T12:25:27","guid":{"rendered":"http:\/\/blogs.igalia.com\/itoral\/?p=592"},"modified":"2016-10-05T14:25:27","modified_gmt":"2016-10-05T12:25:27","slug":"source-code-for-the-opengl-terrain-renderer-demo","status":"publish","type":"post","link":"https:\/\/blogs.igalia.com\/itoral\/2016\/10\/05\/source-code-for-the-opengl-terrain-renderer-demo\/","title":{"rendered":"Source code for the OpenGL terrain renderer demo"},"content":{"rendered":"<p>I have been quite busy with various things in the last few weeks, but I have finally found some time to clean up and upload the code of the <a href=\"http:\/\/blogs.igalia.com\/itoral\/2016\/08\/29\/opengl-terrain-renderer\/\" target=\"_blank\">OpenGL terrain render demo<\/a> to <a href=\"https:\/\/github.com\/itoral\/gl-terrain-demo\" target=\"_blank\">Github<\/a>.<\/p>\n<p>Since this was intended as a programming exercise I have not tried to be very elegant or correct during the implementation, so expect things like error handling to be a bit rough around the edges, but otherwise I think the code should be easy enough to follow.<\/p>\n<p>Notice that I have only tested this on Intel GPUs. I know it works on NVIDIA too (thanks to Samuel and Chema for testing this) but there are a couple of rendering artifacts there, specifically at the edges of the skybox and some &#8220;pillars&#8221; showing up in the distance some times, probably because I am rendering one to many &#8220;rows&#8221; of the terrain and I end up rendering garbage. I may fix these some day.<\/p>\n<p>The code I uploaded to the repository includes a few new features too:<\/p>\n<ul>\n<li>Model variants, which are basically color variations of the same model<\/li>\n<li>A couple of additional models (a new tree and plant) and a different rock type<\/li>\n<li>Collision detection, which makes navigating the terrain more pleasent<\/li>\n<\/ul>\n<p>Here is a new screenshot:<\/p>\n<div align=center>\n<a href=\"http:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot-300x225.png\" alt=\"screenshot\" width=\"300\" height=\"225\" class=\"alignnone size-medium wp-image-593\" srcset=\"https:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot-300x225.png 300w, https:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot-768x576.png 768w, https:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot-400x300.png 400w, https:\/\/blogs.igalia.com\/itoral\/files\/2016\/10\/screenshot.png 800w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a>\n<\/div>\n<p>In future posts I will talk a bit about some of the implementation details, so having the source code around will be useful. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have been quite busy with various things in the last few weeks, but I have finally found some time to clean up and upload the code of the OpenGL terrain render demo to Github. Since this was intended as a programming exercise I have not tried to be very elegant or correct during the &hellip; <a href=\"https:\/\/blogs.igalia.com\/itoral\/2016\/10\/05\/source-code-for-the-opengl-terrain-renderer-demo\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Source code for the OpenGL terrain renderer demo&#8221;<\/span><\/a><\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-graphics"],"_links":{"self":[{"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":9,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"predecessor-version":[{"id":602,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/posts\/592\/revisions\/602"}],"wp:attachment":[{"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.igalia.com\/itoral\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}