{"id":23,"date":"2007-07-04T20:50:07","date_gmt":"2007-07-04T18:50:07","guid":{"rendered":"http:\/\/www.lightrock.biz\/index.php\/?p=20"},"modified":"2011-05-27T21:15:13","modified_gmt":"2011-05-27T19:15:13","slug":"tigerheart-ii-first-impressions-on-opengl","status":"publish","type":"post","link":"https:\/\/lightrocker.lightrock.biz\/?p=23","title":{"rendered":"TigerHeart II: First impressions on OpenGL"},"content":{"rendered":"<p>I am currently implementing some classes for the new &#8220;TigerHeart&#8221; graphics engine using the <a href=\"http:\/\/en.wikipedia.org\/wiki\/OpenGL\" target=\"_blank\">OpenGL<\/a> pipeline. And it is the right way because I am a beginner in OpenGL, which is a little bit more different from <a href=\"http:\/\/en.wikipedia.org\/wiki\/Direct3D\" target=\"_blank\">Direct3D<\/a> than I thought. Since I am a professional in programming with Direct3D I can judge how to design interfaces, classes and their interaction so they can be used for both <a href=\"http:\/\/en.wikipedia.org\/wiki\/API\" target=\"_blank\">API<\/a>s.<br \/>\nA good example is shader programming: In Direct3D vertex and pixel shaders can be applied roughly independent from another. But using OpenGL you have to create a program object, to which multiple shaders can be attached. Afterwards this &#8220;program&#8221; must be linked and applied to utilize the shaders.<\/p>\n<p style=\"text-align: center;\"><a title=\"A round shaded cube, which is lighted per vertex.\" rel=\"\u201dlightbox\u201d\" href=\"http:\/\/www.lightrock.biz\/wp-content\/images\/cube_01.jpg\"><\/a><img decoding=\"async\" src=\"http:\/\/lightrocker.lightrock.biz\/wp-content\/images\/cube_01t.jpg\" alt=\"per vertex lighting\" \/> <a title=\"A round shaded cube, which is lighted per pixel.\" rel=\"\u201dlightbox\u201d\" href=\"http:\/\/www.lightrock.biz\/wp-content\/images\/cube_02.jpg\"><\/a><img decoding=\"async\" src=\"http:\/\/lightrocker.lightrock.biz\/wp-content\/images\/cube_02t.jpg\" alt=\"per pixel lighting\" \/><\/p>\n<p>You can see my current progression state at both images above. It is a cube model with shared, rounded vertex normals, what is not a reasonable assignment but a good test. The first one shows the common per vertex diffuse and specular lighting. It has got a poor quality because both lighting colors have to be linearly interpolated between the eight vertices.<br \/>\nOn the second image you can see the same calculations but relocated to the pixel shader. There is no need for a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Normal_mapping\" target=\"_blank\">normal map<\/a> unless you want to add details to the object without appending vertices. The quality seams to be nearly perfect.<\/p>\n<p>The mesh is rendered using vertex buffer objects (VBO), which is the fastest way to draw complex models using OpenGL, and shaders are compiled with <a href=\"http:\/\/en.wikipedia.org\/wiki\/GLSL\" target=\"_blank\">GLSL<\/a>. This language is comparable to Microsoft&#8217;s <a href=\"http:\/\/en.wikipedia.org\/wiki\/HLSL\" target=\"_blank\">HLSL<\/a> but have got some design differences. For example the compiler is integrated into the graphics driver and there is no possibility to specify shader model targets.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am currently implementing some classes for the new &#8220;TigerHeart&#8221; graphics engine using the OpenGL pipeline. And it is the right way because I am a beginner in OpenGL, which is a little bit more different from Direct3D than I thought. Since I am a professional in programming with Direct3D I can judge how to &hellip; <\/p>\n<p class=\"toivo-read-more\"><a href=\"https:\/\/lightrocker.lightrock.biz\/?p=23\" class=\"more-link\">Read more <span class=\"screen-reader-text\">TigerHeart II: First impressions on OpenGL<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":{"0":"post-23","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-tigerheart2","7":"entry"},"_links":{"self":[{"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":5,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lightrocker.lightrock.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}