{"action":"created","comment":{"url":"https://api.github.com/repos/c42f/displaz/pulls/comments/42964749","id":42964749,"diff_hunk":"@@ -613,17 +685,58 @@ DrawCount PointArray::drawPoints(QGLShaderProgram& prog, const TransformState& t\n         if (!incrementalDraw)\n             node->nextBeginIndex = node->beginIndex;\n \n+        // tfm::printfln(\"OCTREE NODE (STACK) begin idx: %i\", idx);\n+\n         DrawCount nodeDrawCount = node->drawCount(relCamera, quality, incrementalDraw);\n         drawCount += nodeDrawCount;\n \n         idx = node->nextBeginIndex;\n         if (nodeDrawCount.numVertices == 0)\n             continue;\n+\n+        if (m_fields.size() < 1)\n+            continue;\n+\n+        unsigned int bufferSize = 0;\n+        for (size_t i = 0; i < m_fields.size(); ++i)\n+        {\n+            const GeomField &field = m_fields[i];\n+            int arraySize = field.spec.arraySize();\n+            int vecSize = field.spec.vectorSize();\n+\n+            // tfm::printfln(\"FIELD-NAME: %s\", field.name);\n+            // tfm::printfln(\"AS: %i, VS: %i, FSS: %i, FSES: %i, GLBTFSS: %i\", arraySize, vecSize, field.spec.size(), field.spec.elsize, sizeof(glBaseType(field.spec)));\n+\n+            bufferSize += arraySize * vecSize * field.spec.elsize; //sizeof(glBaseType(field.spec));\n+        }\n+\n+        bufferSize = bufferSize * (GLsizei)nodeDrawCount.numVertices;\n+\n+        // TODO: might be able to do something more efficient here, for example use glBufferSubData to avoid re-allocation of memory by glBufferData\n+        // INITIALIZE THE BUFFER TO FULL SIZE\n+        // tfm::printfln(\"INIT BUFFER: %i, BS: %i\", vbo, bufferSize);\n+\n+        glBufferData(GL_ARRAY_BUFFER, bufferSize, NULL, GL_STREAM_DRAW);\n+        /// ========================================================================\n+        /// ========================================================================\n+        int bufferOffset = 0;\n+\n         for (size_t i = 0, k = 0; i < m_fields.size(); k+=m_fields[i].spec.arraySize(), ++i)\n         {\n             const GeomField& field = m_fields[i];\n             int arraySize = field.spec.arraySize();\n             int vecSize = field.spec.vectorSize();\n+\n+            // TODO: should use a single data-array that isn't split into vertex / normal / color / etc. sections, but has interleaved data\n+            // OpenGL has a stride value in glVertexAttribPointer for exactly this purpose, which should be used for better efficiency\n+            // here we write only the current attribute data into this the buffer (e.g. all positions, then all colors)","path":"src/pointarray.cpp","position":174,"original_position":174,"commit_id":"8802383feda9857bc3438a2787ad285ddad372ac","original_commit_id":"8802383feda9857bc3438a2787ad285ddad372ac","user":{"login":"chrisidefix","id":382555,"avatar_url":"https://avatars.githubusercontent.com/u/382555?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisidefix","html_url":"https://github.com/chrisidefix","followers_url":"https://api.github.com/users/chrisidefix/followers","following_url":"https://api.github.com/users/chrisidefix/following{/other_user}","gists_url":"https://api.github.com/users/chrisidefix/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisidefix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisidefix/subscriptions","organizations_url":"https://api.github.com/users/chrisidefix/orgs","repos_url":"https://api.github.com/users/chrisidefix/repos","events_url":"https://api.github.com/users/chrisidefix/events{/privacy}","received_events_url":"https://api.github.com/users/chrisidefix/received_events","type":"User","site_admin":false},"body":"It was more of a suggestion, but I can see how this could make things more problematic on the CPU side. I think the only expected performance benefit would come from reducing the number of calls to `glDrawArrays`, which would also mean a reduced number of calls to `glBufferData`, but with larger buffer sizes, this might not be possible depending on how big that buffer is really going to get?","created_at":"2015-10-26T07:18:17Z","updated_at":"2015-10-26T07:18:17Z","html_url":"https://github.com/c42f/displaz/pull/79#discussion_r42964749","pull_request_url":"https://api.github.com/repos/c42f/displaz/pulls/79","_links":{"self":{"href":"https://api.github.com/repos/c42f/displaz/pulls/comments/42964749"},"html":{"href":"https://github.com/c42f/displaz/pull/79#discussion_r42964749"},"pull_request":{"href":"https://api.github.com/repos/c42f/displaz/pulls/79"}}},"pull_request":{"url":"https://api.github.com/repos/c42f/displaz/pulls/79","id":47975900,"html_url":"https://github.com/c42f/displaz/pull/79","diff_url":"https://github.com/c42f/displaz/pull/79.diff","patch_url":"https://github.com/c42f/displaz/pull/79.patch","issue_url":"https://api.github.com/repos/c42f/displaz/issues/79","number":79,"state":"open","locked":false,"title":"Support Mac OS X CoreProfile OpenGL 3.2 (incl. Qt5 upgrade)","user":{"login":"chrisidefix","id":382555,"avatar_url":"https://avatars.githubusercontent.com/u/382555?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisidefix","html_url":"https://github.com/chrisidefix","followers_url":"https://api.github.com/users/chrisidefix/followers","following_url":"https://api.github.com/users/chrisidefix/following{/other_user}","gists_url":"https://api.github.com/users/chrisidefix/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisidefix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisidefix/subscriptions","organizations_url":"https://api.github.com/users/chrisidefix/orgs","repos_url":"https://api.github.com/users/chrisidefix/repos","events_url":"https://api.github.com/users/chrisidefix/events{/privacy}","received_events_url":"https://api.github.com/users/chrisidefix/received_events","type":"User","site_admin":false},"body":"If you find the time, please review and any feedback or request is welcome, of course.\r\n\r\n**What changed?**\r\n 1. By default `displaz` is now looking for **`Qt5`**.\r\n 1.1. *Non* of the *recent* `QOpenGL*` classes have been used intentionally, to allow support of earlier `Qt5` versions on systems, where it would be more difficult to obtain the latest release.\r\n 1.2. The option `DISPLAZ_USE_QT4` was added to `CMake` (`FALSE` by default) and has to be selected for systems, where you want to build against `Qt4`.\r\n\r\n 2. The **OpenGL** code was *mostly* restructured where necessary to run on a *Core Profile context 3.2*, which is the only one available for Mac OS X (OpenGL 3.0 or 3.1 can not be used and there is no support for a *Compatibility Profile*).\r\n\r\n 2.1. **GLSL Shaders** have been added for any render step, including the \"cursor\" and \"axes\" overlays. \r\n 2.2. Most of the vertex/index data is now setup in **`VAO`/`VBO`** fashion through the `initializeGL()` method and then rendered with `glDrawArrays`/`glDrawElements` from `paintGL()`.\r\n\r\n 3. I wouldn't recommend running `displaz` with `Qt4` on Mac OS X and there really is no need to do this. However, I did add some `Objective-C` code that is supposed to create a proper window with the right `CoreContext 3.2` for `QGLWidget`, in case you are wondering why this is there. For this to work `displaz` also needs to link against Apple specific frameworks (`Cocoa` and `Foundation`).\r\n\r\n**What remains?**\r\n 1. There is likely work left to be done for `HCloudView`. I deactivated the (unused) code in `drawBounds` for example. The `draw()` method likely needs to be adjusted, but I didn't have any dataset that I could have tested.\r\n 2. `CoreProfile 3.2` is now set as the default `QGLFormat` inside `guimain.cpp` and it should be decided, if - for non-Mac systems - this should be something else.\r\n 3. Some more clean-up in the code from my side.\r\n\r\nPS: Feel free to squash the commits and ask me anything!","created_at":"2015-10-17T01:23:12Z","updated_at":"2015-10-26T07:18:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8743f8125a3d410c37e14f9c8dea2637ad5b5090","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/c42f/displaz/pulls/79/commits","review_comments_url":"https://api.github.com/repos/c42f/displaz/pulls/79/comments","review_comment_url":"https://api.github.com/repos/c42f/displaz/pulls/comments{/number}","comments_url":"https://api.github.com/repos/c42f/displaz/issues/79/comments","statuses_url":"https://api.github.com/repos/c42f/displaz/statuses/8802383feda9857bc3438a2787ad285ddad372ac","head":{"label":"geometree:osx-gl-qt5","ref":"osx-gl-qt5","sha":"8802383feda9857bc3438a2787ad285ddad372ac","user":{"login":"geometree","id":12184838,"avatar_url":"https://avatars.githubusercontent.com/u/12184838?v=3","gravatar_id":"","url":"https://api.github.com/users/geometree","html_url":"https://github.com/geometree","followers_url":"https://api.github.com/users/geometree/followers","following_url":"https://api.github.com/users/geometree/following{/other_user}","gists_url":"https://api.github.com/users/geometree/gists{/gist_id}","starred_url":"https://api.github.com/users/geometree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometree/subscriptions","organizations_url":"https://api.github.com/users/geometree/orgs","repos_url":"https://api.github.com/users/geometree/repos","events_url":"https://api.github.com/users/geometree/events{/privacy}","received_events_url":"https://api.github.com/users/geometree/received_events","type":"Organization","site_admin":false},"repo":{"id":43590052,"name":"displaz","full_name":"geometree/displaz","owner":{"login":"geometree","id":12184838,"avatar_url":"https://avatars.githubusercontent.com/u/12184838?v=3","gravatar_id":"","url":"https://api.github.com/users/geometree","html_url":"https://github.com/geometree","followers_url":"https://api.github.com/users/geometree/followers","following_url":"https://api.github.com/users/geometree/following{/other_user}","gists_url":"https://api.github.com/users/geometree/gists{/gist_id}","starred_url":"https://api.github.com/users/geometree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometree/subscriptions","organizations_url":"https://api.github.com/users/geometree/orgs","repos_url":"https://api.github.com/users/geometree/repos","events_url":"https://api.github.com/users/geometree/events{/privacy}","received_events_url":"https://api.github.com/users/geometree/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geometree/displaz","description":"A las viewer for geospatial lidar","fork":true,"url":"https://api.github.com/repos/geometree/displaz","forks_url":"https://api.github.com/repos/geometree/displaz/forks","keys_url":"https://api.github.com/repos/geometree/displaz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geometree/displaz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geometree/displaz/teams","hooks_url":"https://api.github.com/repos/geometree/displaz/hooks","issue_events_url":"https://api.github.com/repos/geometree/displaz/issues/events{/number}","events_url":"https://api.github.com/repos/geometree/displaz/events","assignees_url":"https://api.github.com/repos/geometree/displaz/assignees{/user}","branches_url":"https://api.github.com/repos/geometree/displaz/branches{/branch}","tags_url":"https://api.github.com/repos/geometree/displaz/tags","blobs_url":"https://api.github.com/repos/geometree/displaz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geometree/displaz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geometree/displaz/git/refs{/sha}","trees_url":"https://api.github.com/repos/geometree/displaz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geometree/displaz/statuses/{sha}","languages_url":"https://api.github.com/repos/geometree/displaz/languages","stargazers_url":"https://api.github.com/repos/geometree/displaz/stargazers","contributors_url":"https://api.github.com/repos/geometree/displaz/contributors","subscribers_url":"https://api.github.com/repos/geometree/displaz/subscribers","subscription_url":"https://api.github.com/repos/geometree/displaz/subscription","commits_url":"https://api.github.com/repos/geometree/displaz/commits{/sha}","git_commits_url":"https://api.github.com/repos/geometree/displaz/git/commits{/sha}","comments_url":"https://api.github.com/repos/geometree/displaz/comments{/number}","issue_comment_url":"https://api.github.com/repos/geometree/displaz/issues/comments{/number}","contents_url":"https://api.github.com/repos/geometree/displaz/contents/{+path}","compare_url":"https://api.github.com/repos/geometree/displaz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geometree/displaz/merges","archive_url":"https://api.github.com/repos/geometree/displaz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geometree/displaz/downloads","issues_url":"https://api.github.com/repos/geometree/displaz/issues{/number}","pulls_url":"https://api.github.com/repos/geometree/displaz/pulls{/number}","milestones_url":"https://api.github.com/repos/geometree/displaz/milestones{/number}","notifications_url":"https://api.github.com/repos/geometree/displaz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geometree/displaz/labels{/name}","releases_url":"https://api.github.com/repos/geometree/displaz/releases{/id}","created_at":"2015-10-03T06:23:19Z","updated_at":"2015-10-03T06:23:20Z","pushed_at":"2015-10-20T06:05:01Z","git_url":"git://github.com/geometree/displaz.git","ssh_url":"git@github.com:geometree/displaz.git","clone_url":"https://github.com/geometree/displaz.git","svn_url":"https://github.com/geometree/displaz","homepage":"http://c42f.github.io/displaz","size":2044,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"c42f:master","ref":"master","sha":"046bb6b0ca352fab49ef8356cd1c2d993c25cbef","user":{"login":"c42f","id":601473,"avatar_url":"https://avatars.githubusercontent.com/u/601473?v=3","gravatar_id":"","url":"https://api.github.com/users/c42f","html_url":"https://github.com/c42f","followers_url":"https://api.github.com/users/c42f/followers","following_url":"https://api.github.com/users/c42f/following{/other_user}","gists_url":"https://api.github.com/users/c42f/gists{/gist_id}","starred_url":"https://api.github.com/users/c42f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c42f/subscriptions","organizations_url":"https://api.github.com/users/c42f/orgs","repos_url":"https://api.github.com/users/c42f/repos","events_url":"https://api.github.com/users/c42f/events{/privacy}","received_events_url":"https://api.github.com/users/c42f/received_events","type":"User","site_admin":false},"repo":{"id":6596947,"name":"displaz","full_name":"c42f/displaz","owner":{"login":"c42f","id":601473,"avatar_url":"https://avatars.githubusercontent.com/u/601473?v=3","gravatar_id":"","url":"https://api.github.com/users/c42f","html_url":"https://github.com/c42f","followers_url":"https://api.github.com/users/c42f/followers","following_url":"https://api.github.com/users/c42f/following{/other_user}","gists_url":"https://api.github.com/users/c42f/gists{/gist_id}","starred_url":"https://api.github.com/users/c42f/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c42f/subscriptions","organizations_url":"https://api.github.com/users/c42f/orgs","repos_url":"https://api.github.com/users/c42f/repos","events_url":"https://api.github.com/users/c42f/events{/privacy}","received_events_url":"https://api.github.com/users/c42f/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/c42f/displaz","description":"A las viewer for geospatial lidar","fork":false,"url":"https://api.github.com/repos/c42f/displaz","forks_url":"https://api.github.com/repos/c42f/displaz/forks","keys_url":"https://api.github.com/repos/c42f/displaz/keys{/key_id}","collaborators_url":"https://api.github.com/repos/c42f/displaz/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/c42f/displaz/teams","hooks_url":"https://api.github.com/repos/c42f/displaz/hooks","issue_events_url":"https://api.github.com/repos/c42f/displaz/issues/events{/number}","events_url":"https://api.github.com/repos/c42f/displaz/events","assignees_url":"https://api.github.com/repos/c42f/displaz/assignees{/user}","branches_url":"https://api.github.com/repos/c42f/displaz/branches{/branch}","tags_url":"https://api.github.com/repos/c42f/displaz/tags","blobs_url":"https://api.github.com/repos/c42f/displaz/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/c42f/displaz/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/c42f/displaz/git/refs{/sha}","trees_url":"https://api.github.com/repos/c42f/displaz/git/trees{/sha}","statuses_url":"https://api.github.com/repos/c42f/displaz/statuses/{sha}","languages_url":"https://api.github.com/repos/c42f/displaz/languages","stargazers_url":"https://api.github.com/repos/c42f/displaz/stargazers","contributors_url":"https://api.github.com/repos/c42f/displaz/contributors","subscribers_url":"https://api.github.com/repos/c42f/displaz/subscribers","subscription_url":"https://api.github.com/repos/c42f/displaz/subscription","commits_url":"https://api.github.com/repos/c42f/displaz/commits{/sha}","git_commits_url":"https://api.github.com/repos/c42f/displaz/git/commits{/sha}","comments_url":"https://api.github.com/repos/c42f/displaz/comments{/number}","issue_comment_url":"https://api.github.com/repos/c42f/displaz/issues/comments{/number}","contents_url":"https://api.github.com/repos/c42f/displaz/contents/{+path}","compare_url":"https://api.github.com/repos/c42f/displaz/compare/{base}...{head}","merges_url":"https://api.github.com/repos/c42f/displaz/merges","archive_url":"https://api.github.com/repos/c42f/displaz/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/c42f/displaz/downloads","issues_url":"https://api.github.com/repos/c42f/displaz/issues{/number}","pulls_url":"https://api.github.com/repos/c42f/displaz/pulls{/number}","milestones_url":"https://api.github.com/repos/c42f/displaz/milestones{/number}","notifications_url":"https://api.github.com/repos/c42f/displaz/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/c42f/displaz/labels{/name}","releases_url":"https://api.github.com/repos/c42f/displaz/releases{/id}","created_at":"2012-11-08T13:48:08Z","updated_at":"2015-10-17T02:17:21Z","pushed_at":"2015-10-25T19:21:49Z","git_url":"git://github.com/c42f/displaz.git","ssh_url":"git@github.com:c42f/displaz.git","clone_url":"https://github.com/c42f/displaz.git","svn_url":"https://github.com/c42f/displaz","homepage":"http://c42f.github.io/displaz","size":3338,"stargazers_count":26,"watchers_count":26,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":34,"forks":14,"open_issues":34,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/c42f/displaz/pulls/79"},"html":{"href":"https://github.com/c42f/displaz/pull/79"},"issue":{"href":"https://api.github.com/repos/c42f/displaz/issues/79"},"comments":{"href":"https://api.github.com/repos/c42f/displaz/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/c42f/displaz/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/c42f/displaz/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/c42f/displaz/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/c42f/displaz/statuses/8802383feda9857bc3438a2787ad285ddad372ac"}}}}