MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0030429Community[OCCT] OCCT:Samplespublic2019-01-02 18:192019-01-18 22:44
Reportermahaidong 
Assigned Tomahaidong 
PrioritynormalSeverityintegration request 
StatusfeedbackResolutionopen 
Platformwin10 mac ubuntuOSOS Version
Product Version 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0030429: Samples - add simple glfw 3D Viewer sample
Descriptiona sample based on GLFW for demonstrating usage of OCCT 3D Viewer
TagsNo tags attached.
Test case number
Attached Files

- Relationships

-  Notes
(0081675)
mahaidong (reporter)
2019-01-02 18:22
edited on: 2019-01-02 18:25

almost finished, try to push codes https://www.opencascade.com/content/it-possible-initialize-v3dview-glfw%EF%BC%88-lightweight-utility-library-use-opengl%EF%BC%89 [^]

(0081676)
git (administrator)
2019-01-03 15:22

Branch CR30429 has been created by mahaidong.

SHA-1: 6a25e180ab887766e37e7dc67e917b031ddf64ef


Detailed log of new commits:

Author: mahaidong
Date: Thu Jan 3 20:11:22 2019 +0800

    a simple cross-plotform demo for opencascade in glfw
(0081677)
mahaidong (reporter)
2019-01-03 15:31

@kgv I had push a branch CRCR30429 with sample codes.
(0081678)
git (administrator)
2019-01-03 15:51

Branch CR30429 has been updated by mahaidong.

SHA-1: 9134ffbc5fec28ab49eb3d5bedab0b9a98ae4cac


Detailed log of new commits:

Author: mahaidong
Date: Thu Jan 3 20:47:21 2019 +0800

    change readme

Author: mahaidong
Date: Thu Jan 3 20:11:22 2019 +0800

    a simple cross-plotform demo for opencascade in glfw

(0081679)
kgv (developer)
2019-01-04 13:18
edited on: 2019-01-04 13:21

If you would like to prepare a proper patch, please take a look onto Coding Rules and Bug Advancement Workflow:
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__coding_rules.html [^]
https://dev.opencascade.org/doc/overview/html/occt_dev_guides__contribution_workflow.html [^]

In particular, indentation should be 2 spaces, figure brackets should be on new line, class members starting with "my", etc. (consider using autoformatting to fix indentation/spacing).

+++ b/samples/glfw/readme.md
@@ -0,0 +1,3 @@
+a simple demo for opencascade in glfw

This looks a little incomplete.

+static void error_callback(int error, const char* description)
+{
+       fprintf(stderr, "Error %d: %s\n", error, description);
+}

The preferred way is redirecting messages to Message::DefaultMessenger()->Send() with proper message gravity.

+       glewInit();

Could you please comment why GLEW is needed here?

+       Handle_V3d_Viewer m_viewer;
+       Handle_V3d_View m_view;
+       Handle_OpenGl_Context m_GLcontext;
+       Handle_AIS_InteractiveContext mContext;

Handle_ syntax is deprecated, Handle() is preferred.

+  void Destroy();
+  ~OccWindow()
+  {
+    Destroy();
+  }

Destroy() is an obsolete alias of class destructor from WOK (CDL class declaration) times.

+    /*** todo cleanup imgui ***/

TODOs related to imgui looks unrelated (as long as you are not going to add them).

+void GlfwOccView::s_onMouseButton(GLFWwindow* window, int button, int action, int mods)
+{
+       GlfwOccView* app = reinterpret_cast<GlfwOccView*>(glfwGetWindowUserPointer(window));
+       app->OnMouseButton(button, action, mods);
+}
+void GlfwOccView::s_onMouseMove(GLFWwindow* window, double xpos, double ypos)
+{
+       GlfwOccView* app = reinterpret_cast<GlfwOccView*>(glfwGetWindowUserPointer(window));
+       app->OnMouseMove(xpos, ypos);
+}

These proxy callbacks are probably will be better inlined within declaration to make code more compact.

+                       mContext->MoveTo((int)xpos,(int)ypos,m_view,Standard_True);
...
+void GlfwOccView::redraw()
+{

Looks like a misconception or at least confusing to have a special redraw() method and not implementing actual redraw with it...

+INCLUDE_DIRECTORIES(/usr/local/include/opencascade/)

Doesn't look correct (multi-platform / flexible).

(0081680)
git (administrator)
2019-01-04 20:38

Branch CR30429 has been updated by mahaidong.

SHA-1: b0ad08264ca32c8c53a937d6ac0713eb9ba236fd


Detailed log of new commits:

Author: mahaidong
Date: Sat Jan 5 01:34:44 2019 +0800

    Follow the Coding Rules

(0081681)
git (administrator)
2019-01-06 09:23

Branch CR30429 has been updated by mahaidong.

SHA-1: e4e6e72ed65070afb96d31fe74468eb9345959bd


Detailed log of new commits:

Author: mahaidong
Date: Sun Jan 6 14:18:23 2019 +0800

    let codes be more clean

(0081682)
mahaidong (reporter)
2019-01-06 09:26

@kgv, thanks your comments, I had modified my codes according to your comments.
(0081689)
mahaidong (reporter)
2019-01-09 13:04

@kgv, should I add more function or just keep on making code clean?
(0081812)
git (administrator)
2019-01-18 11:04

Branch CR30429_1 has been created by kgv.

SHA-1: 78c96200cc223f460685277a6e4411684883cfaf


Detailed log of new commits:

Author: kgv
Date: Fri Jan 18 11:00:30 2019 +0300

    0030429: Samples - add simple glfw 3D Viewer sample
(0081813)
git (administrator)
2019-01-18 11:06

Branch CR30429_1 has been updated forcibly by kgv.

SHA-1: 86a908405dfa897c884b1b25761ef0dbb91dd56c
(0081816)
git (administrator)
2019-01-18 15:40

Branch CR30429_2 has been created by kgv.

SHA-1: 2b292b6fdcebd9970ca7b7cc8c1d9bd2ac276c79


Detailed log of new commits:

Author: mahaidong
Date: Fri Jan 18 11:00:30 2019 +0300

    0030429: Samples - add simple glfw 3D Viewer sample
(0081817)
git (administrator)
2019-01-18 15:57

Branch CR30429_2 has been updated forcibly by kgv.

SHA-1: 0a80014b39a5c14c6adef23f43686abe0bf83c49
(0081819)
git (administrator)
2019-01-18 16:57

Branch CR30429_2 has been updated forcibly by kgv.

SHA-1: fc5dd1d5649cdede893fc92f4b7d25506d8daf84
(0081820)
git (administrator)
2019-01-18 17:17

Branch CR30429_2 has been updated forcibly by kgv.

SHA-1: 2f237962fddee1199043d3fd7babea51ce2aaff9
(0081821)
git (administrator)
2019-01-18 19:07

Branch CR30429_2 has been updated by kgv.

SHA-1: bf3295e64b76aff312ae66df416d0d84d501acf8


Detailed log of new commits:

Author: kgv
Date: Fri Jan 18 19:03:35 2019 +0300

    Aspect_DisplayConnection - provide constructor wrapping existing X Display connection.

(0081822)
git (administrator)
2019-01-18 21:52

Branch CR30429_2 has been updated by kgv.

SHA-1: c1bf295e8562164fd3845f976b9d6e654bfc71a9


Detailed log of new commits:

Author: kgv
Date: Fri Jan 18 21:48:22 2019 +0300

    # fix macOS compilation

(0081823)
git (administrator)
2019-01-18 22:16

Branch CR30429_2 has been updated by kgv.

SHA-1: e776e7db2d60c10ec3a4e5e7cb7a23b4d7ea932a


Detailed log of new commits:

Author: kgv
Date: Fri Jan 18 22:12:37 2019 +0300

    # corrections

(0081824)
git (administrator)
2019-01-18 22:18

Branch CR30429_3 has been created by kgv.

SHA-1: 68bec45a543409c4da9d6dc84f37e92b7c150535


Detailed log of new commits:

Author: mahaidong
Date: Fri Jan 18 11:00:30 2019 +0300

    0030429: Samples - add simple glfw 3D Viewer sample
    
    Aspect_DisplayConnection now provides constructor wrapping existing X Display connection.
(0081825)
git (administrator)
2019-01-18 22:20

Branch CR30429_3 has been updated forcibly by kgv.

SHA-1: e5ac2c75ab1cebfa10eea015ffd4c999998bd1ff
(0081826)
kgv (developer)
2019-01-18 22:36

The sample has been updated and pushed to branch CR30429_3:
- GLEW dependency has been removed as redundant.
- CMakeLists now uses find_package() for searching OCCT instead of CASROOT.
- The issue with glXSwapBuffers() has been fixed by adding Aspect_DisplayConnection constructor wrapping existing X Display connection.
- Prefer using glfwWaitEvents() instead of glfwPollEvents().
- Code clean up / simplification.

Please comment, if you have some objections / questions to changes.

>    glfwWindowHint (GLFW_CONTEXT_VERSION_MAJOR, 3);
>    glfwWindowHint (GLFW_CONTEXT_VERSION_MINOR, 3);
>    glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
>    glfwWindowHint (GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

Requesting a Forward-Compatible OpenGL profile 3.3 looks like a copy-paste from some another GLFW sample, since it might not the best OpenGL configuration.
Forward-compatible bit is rarely used, and limiting to 3.3 would disable some OCCT features requiring OpenGL 4.x.
(0081827)
git (administrator)
2019-01-18 22:44

Branch CR30429_3 has been updated forcibly by kgv.

SHA-1: 185f0251c529e408b80299c5b8ab67d0e8b380d1

- Issue History
Date Modified Username Field Change
2019-01-02 18:19 mahaidong New Issue
2019-01-02 18:19 mahaidong Assigned To => kgv
2019-01-02 18:22 mahaidong Note Added: 0081675
2019-01-02 18:24 kgv Summary glfw sample => Samples - glfw sample
2019-01-02 18:25 mahaidong Note Edited: 0081675 View Revisions
2019-01-03 15:22 git Note Added: 0081676
2019-01-03 15:31 mahaidong Note Added: 0081677
2019-01-03 15:51 git Note Added: 0081678
2019-01-04 04:57 mahaidong Assigned To kgv => mahaidong
2019-01-04 04:57 mahaidong Assigned To mahaidong => kgv
2019-01-04 13:18 kgv Note Added: 0081679
2019-01-04 13:18 kgv Severity feature => integration request
2019-01-04 13:18 kgv Product Version 7.3.0 =>
2019-01-04 13:18 kgv Target Version => 7.4.0*
2019-01-04 13:19 kgv Note Edited: 0081679 View Revisions
2019-01-04 13:20 kgv Note Edited: 0081679 View Revisions
2019-01-04 13:21 kgv Note Edited: 0081679 View Revisions
2019-01-04 20:38 git Note Added: 0081680
2019-01-06 09:23 git Note Added: 0081681
2019-01-06 09:26 mahaidong Note Added: 0081682
2019-01-09 13:04 mahaidong Note Added: 0081689
2019-01-18 11:03 kgv Summary Samples - glfw sample => Samples - add simple glfw 3D Viewer sample
2019-01-18 11:04 git Note Added: 0081812
2019-01-18 11:06 git Note Added: 0081813
2019-01-18 15:40 git Note Added: 0081816
2019-01-18 15:57 git Note Added: 0081817
2019-01-18 16:57 git Note Added: 0081819
2019-01-18 17:17 git Note Added: 0081820
2019-01-18 19:07 git Note Added: 0081821
2019-01-18 21:52 git Note Added: 0081822
2019-01-18 22:16 git Note Added: 0081823
2019-01-18 22:18 git Note Added: 0081824
2019-01-18 22:19 kgv Status new => resolved
2019-01-18 22:20 git Note Added: 0081825
2019-01-18 22:36 kgv Note Added: 0081826
2019-01-18 22:44 git Note Added: 0081827
2019-01-18 22:44 kgv Assigned To kgv => mahaidong
2019-01-18 22:44 kgv Status resolved => feedback


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker