{"action":"created","issue":{"url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/844","repository_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com","labels_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/844/labels{/name}","comments_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/844/comments","events_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/844/events","html_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/844","id":171594364,"number":844,"title":"OpenGL Core, material draw system, and geometry batching rewrite","user":{"login":"SamuelCho","id":426809,"avatar_url":"https://avatars.githubusercontent.com/u/426809?v=3","gravatar_id":"","url":"https://api.github.com/users/SamuelCho","html_url":"https://github.com/SamuelCho","followers_url":"https://api.github.com/users/SamuelCho/followers","following_url":"https://api.github.com/users/SamuelCho/following{/other_user}","gists_url":"https://api.github.com/users/SamuelCho/gists{/gist_id}","starred_url":"https://api.github.com/users/SamuelCho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SamuelCho/subscriptions","organizations_url":"https://api.github.com/users/SamuelCho/orgs","repos_url":"https://api.github.com/users/SamuelCho/repos","events_url":"https://api.github.com/users/SamuelCho/events{/privacy}","received_events_url":"https://api.github.com/users/SamuelCho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-08-17T07:43:34Z","updated_at":"2016-08-19T17:40:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/pulls/844","html_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/844","diff_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/844.diff","patch_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/844.patch"},"body":"The first step towards our migration to OpenGL Core. Converted all the shaders to be Core compliant. Added some matrix4 math operations. Manually constructed our view and projection matrices. Moved light handling to a uniform system. Moved vertex and index buffer generation out of opengl_tnl and just made tnl simply responsible for buffer object creation and submission. Moved all draw calls to use vertex buffer objects (even immediate draws). Put safeguards around deprecated function calls. There might be a couple deprecated functions here and there that I missed. \r\n\r\nI also wrote a material system. There's basic material, model_material, particle_material, and distortion_material classes. More types of materials will follow as we write additional types of shaders. These basically act as containers for draw parameters for a particular draw call. The different type of materials correspond to the different shaders we use so the graphics code plucks the draw data it needs and sets up the necessary graphics state and uniforms for a draw. This way we don't need to rely on setting ugly global variables all the time. Eventually we can start being smart about materials and just allocate them once for a predictable draw and constantly reuse them instead of making them over and over for each frame. Combined with vertex_layouts, this will be a very powerful rendering tool. This should let us have the flexibility we need to further extend FSO's graphics for more advance rendering features. \r\n\r\nThis paradigm also let's us be able to detach code from the internal graphics backend as it can shifts a lot of the state definition away from gropengl*.cpp code. This will make it lot easier for when we start thinking about supporting Vulkan.\r\n\r\nI rewritten the geometry batcher because I hacked in dynamic vertex buffer support into the old grbatch.cpp one. This new one is a lot more flexible and should let us be able to account for different types of draws.\r\n\r\nUltimately, I want to pull us away from the TMAP_ flags which was essentially how we described our draw calls. It's enormously ugly and I'm looking forward to deleting any references to that code as soon as I can.\r\n\r\nNext Steps:\r\n\r\n- Switch out the GLAD compatibility headers with core headers. Subsequently start ripping out the benign deprecated OpenGL function calls.\r\n- Remove fixed function dependant code.\r\n- Start migrating gropengldraw.cpp functions into OpenGL-agnostic g3_render_ functions.\r\n\r\nI haven't tested this on Macs because I haven't been able to get it running since the move to the Cmake build system. If anyone has been able to build FSO on Mac lately, I would greatly appreciate it if they can test this pull request.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/scp-fs2open/fs2open.github.com/844)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/comments/241084642","html_url":"https://github.com/scp-fs2open/fs2open.github.com/pull/844#issuecomment-241084642","issue_url":"https://api.github.com/repos/scp-fs2open/fs2open.github.com/issues/844","id":241084642,"user":{"login":"The-E","id":280879,"avatar_url":"https://avatars.githubusercontent.com/u/280879?v=3","gravatar_id":"","url":"https://api.github.com/users/The-E","html_url":"https://github.com/The-E","followers_url":"https://api.github.com/users/The-E/followers","following_url":"https://api.github.com/users/The-E/following{/other_user}","gists_url":"https://api.github.com/users/The-E/gists{/gist_id}","starred_url":"https://api.github.com/users/The-E/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-E/subscriptions","organizations_url":"https://api.github.com/users/The-E/orgs","repos_url":"https://api.github.com/users/The-E/repos","events_url":"https://api.github.com/users/The-E/events{/privacy}","received_events_url":"https://api.github.com/users/The-E/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T17:40:59Z","updated_at":"2016-08-19T17:40:59Z","body":"With this build, i am getting \"OpenGL Error from shader_set_current(): invalid operation\" several times per frame."}}
{"actor":{"display_login":"The-E"}}