MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0024699Open CASCADE[OCCT] OCCT:Visualizationpublic2014-03-07 12:202015-07-27 13:39
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeverityfeature 
StatusclosedResolutionfixed 
PlatformWindowsOSOS Version
Product Version 
Target Version[OCCT] 6.8.0Fixed in Version[OCCT] 6.8.0 
Summary0024699: Visualization - prototype interoperation of TKOpenGl viewer with Direct3D viewer
DescriptionOCCT viewer is based on OpenGL for portability reasons and common sense. However some applications might be restricted to Direct3D viewer (WPF) or require some Direct3D features (DXVA).

In 2010 NVIDIA introduced WGL_NV_DX_interop extension to their OpenGL implementation for such purposes. Nowadays this extension has been implemented by other vendors as well (AMD, Intel).

This issue suggest prototyping a sample application using this extension to incorporate TKOpenGl off-screen renderer into Direct3D viewer.

The main application work-flow would look like this:
- create off-screen WNT_Window and V3d_View in it.
- create visible Direct3D viewer.
- create D3D rendering target and dedicated depth/stencil buffers with sharing capabilities (required on Vista+).
- make dummy V3d_View redraw call to bind OpenGL context.
- create D3D->OpenGL handle using WGL_NV_DX_interop extension.
- create D3D->OpenGL handles for D3D surfaces and create OpenGL FBO based on them.
- inherit class from OpenGl_FrameBuffer to define custom FBO (fields must be re-defined as protected).
- assigns it to the V3d_View for rendering (which previously has been used only for snapshot dump functionality - see ToPixMap() method).
- perform consequential rendering of OpenGL / D3D viewers, locking shared resources when needed.

See discussion on development portal:
http://dev.opencascade.org/index.php?q=node/766 [^]
TagsNo tags attached.
Test case numberNot needed
Attached Files7z file icon OcctDirect3D.7z (93,659 bytes) 2014-04-04 19:06
jpg file icon screen.jpg (70,896 bytes) 2014-04-04 19:20
gif file icon wpf.gif (33,994 bytes) 2014-10-06 16:25
gif file icon wpf-D3D.gif (33,807 bytes) 2014-10-06 16:25

- Relationships
related to 0024894closedbugmaster Open CASCADE TKOpenGl - refactor OpenGl_FrameBuffer and OpenGl_Texture classes. 

-  Notes
(0028696)
dbp (developer)
2014-04-04 19:08

Dear kgv,

Could you look at this demo (attached)?
(0028697)
dbp (developer)
2014-04-04 19:29
edited on: 2014-04-04 19:30

To compile and run this demo:

1) Install Microsoft DirectX SDK 2010.

2) Configure CASROOT directory in msvc10.bat/msvc12.bat.

3) Build custom OCCT version: move OpenGL_Framebuffer.hxx private variables to protected section. Next release of OCCT will include this fix.

(0028704)
kgv (developer)
2014-04-07 10:03

Dear dbp,

the patch should be prepared in proper way - as sample example in OCCT git.
(0028769)
dbp (developer)
2014-04-09 19:47

Dear kgv,

The initial version of modified sample was implemented. Please review branch CR24699_1.
(0028772)
kgv (developer)
2014-04-10 10:49

Dear dbp,

the workaround for initialization on AMD cards has been pushed to branch CR24699 (including some extra minor changes).
Please investigate VBO creation failures on NVIDIA drivers - this may describe the crash on AMD drivers.

Please implement also software fallback mode (copying GL->D3D through system memory).
(0028788)
dbp (developer)
2014-04-11 10:14
edited on: 2014-04-11 10:18

Dear kgv,

please review the patch in branch CR24699_2.

(0028793)
dbp (developer)
2014-04-11 14:12

Dear kgv,

the rebased squashed version is in branch CR24699_3.
(0028800)
kgv (developer)
2014-04-11 16:13

Please test the patch (including updated sample).
(0028848)
mkv (tester)
2014-04-15 18:18

Dear BugMaster,

Branch CR24699_3 (and products from GIT master) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 2166418c792977e9d6f2a8c44ccc5bbdf9ada806

Number of compiler warnings:

occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)
MacOS: 413 (413 on master)

products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 352987340 / 352653700
Total CPU difference: 74262.01999999965 / 67343.38000000024

Testing on Windows:
Total MEMORY difference: 381286492 / 380717640
Total CPU difference: 35453.984375 / 39760.234375

There are no differences in images found by testdiff.
(0029643)
kgv (developer)
2014-06-03 10:14

Dear bugmaster,

re-based patch has been pushed to branch CR24699_5.
Please test CSharp samples within the patch (no need to test OCCT - patch affects only sample).
(0029656)
bugmaster (administrator)
2014-06-03 18:17

It is suggested (by ABV) to make this functionality optional for developers who want to install DirectX SDK and has powerful video card.
(0029702)
abv (manager)
2014-06-05 13:53

The current version cannot be integrated as-is since it does not build in standard environment (without DirectX SDK) and it is not described how to build it with even if SDK is available. If it is possible to make DirectX dependency optional, we can keep it as part of WPF sample, just providing option to enable it and instructions on how to build. Otherwise, we can separate DirectX sample from "standard" WPF sample. In any case build instructions are required.
(0030012)
san (developer)
2014-07-08 18:09

The proposed solution:

1. Since the redesigned WPF sample including DirectX support is very different from the "standard" WPF sample, it is necessary to restore the original one and add a specific DirectX demo as proposed by ABV.

2. Presence of DirectX SDK can be checked in the Visual Studio launcher batch file, corresponding preprocessor definition is to be added. If this definition is missing, compilation of the DirectX sample should fail with a user-friendly message, e.g. DirectX SDK is required in order to build the sample but it is not found in your system. Please install DirectX SDK and retry.
(0031439)
git (administrator)
2014-09-08 09:42

Branch CR24699_6 has been created by dln.

SHA-1: 6dcbaa102f8ceeed7529d085cddead4de9afb434


Detailed log of new commits:

Author: dln
Date: Mon Sep 8 09:41:43 2014 +0400

    0024699: Visualization - prototype interoperation of TKOpenGl viewer with Direct3D viewer
    
    - edit of the C# samples documentation

Author: dln
Date: Fri Sep 5 15:50:55 2014 +0400

    0024699: Visualization - prototype interoperation of TKOpenGl viewer with Direct3D viewer
    
    - separate DirectX sample from "standard" WPF sample
    - check of installed DirectX SDK on PC
(0031445)
git (administrator)
2014-09-08 15:49

Branch CR24699_6 has been updated forcibly by dln.

SHA-1: d84535313d183e291da886d1d9fb539ab257074e
(0031489)
git (administrator)
2014-09-08 16:19

Branch CR24699_7 has been created by dln.

SHA-1: d98322b58cafa4a4dd097d0dd5f834e9be38e99a


Detailed log of new commits:

Author: dbp
Date: Tue Jun 3 10:11:33 2014 +0400

    0024699: Visualization - prototype interoperation of TKOpenGl viewer with Direct3D viewer
    
    Add new C# sample which allow to render the OCCT scene to a Direct3D context in a WPF application.
    DirectX SDK is required in order to build this sample.
(0031499)
git (administrator)
2014-09-09 08:33

Branch CR24699_7 has been updated forcibly by dln.

SHA-1: 87db7c50f44f4473681561fb55b755c5e0bdfdce
(0031616)
abv (manager)
2014-09-11 16:03

Would not it be possible to avoid moving existing samples (WinForms and WPF) to different location? Why not re-using the same code for OCCProxy, icons etc., and just adding new projects (and may be solution) for DirectX version?
(0032453)
git (administrator)
2014-09-30 13:16

Branch CR24699_7 has been updated forcibly by dln.

SHA-1: 6b5bdd2ceca69c916d9234c02a272c0e8789679d
(0032555)
dln (developer)
2014-10-02 10:11

Done, Check it please. Branch CR24699_7
(0032702)
kgv (developer)
2014-10-06 13:11

Please test changed samples.
(0032709)
git (administrator)
2014-10-06 14:34

Branch CR24699_7 has been updated forcibly by mkv.

SHA-1: f9d79f33c658a41d292f1cb62868cb7c200c3f2d
(0032719)
abv (manager)
2014-10-06 16:44

Do we really need to have OCCProxy-D3D and D3DProxy as separated libs, why not to combine them?
(0032721)
bugmaster (administrator)
2014-10-06 16:58
edited on: 2014-10-06 17:03

1. Microsoft DirectX SDK 2010 has been installed but unsuccessfully with error on installation redistributable. Despite this DXSDK_DIR variable is defined in system environment variables and I were able to continue.

2. wpf and wpf-D3D samples were compiled without problems.

3. wpf and wpf-D3D samples behavior is different
3.1 shape in wpf sample is displayed originally in wareframe mode but in wpf-D3D in shading one.
3.2 tone of shading in samples is different. See attached pictures
3.3 rectangle selection is not realized in wpf-D3D sample. In wpf sample it is realized very bad (no update).
3.4 context menu after clicking MB3 on selected shape is not realized in wpf-D3D sample.

(0032894)
git (administrator)
2014-10-09 14:37

Branch CR24699_7 has been updated forcibly by dln.

SHA-1: 49b2221010e35302d51949579a4daf7db4080efe
(0032897)
dln (developer)
2014-10-09 14:45

Done, Check it please. Branch CR24699_7
(0032901)
kgv (developer)
2014-10-09 15:35

Please re-check samples.

Note that different tone of viewers is not covered by updated patch, please ignore it.
(0033414)
git (administrator)
2014-10-21 16:41

Branch CR24699_7 has been deleted by inv.

SHA-1: 49b2221010e35302d51949579a4daf7db4080efe
(0033488)
git (administrator)
2014-10-21 16:45

Branch CR24699_6 has been deleted by inv.

SHA-1: d84535313d183e291da886d1d9fb539ab257074e
(0033496)
git (administrator)
2014-10-21 16:45

Branch CR24699_5 has been deleted by inv.

SHA-1: 8ae0eeca4d233b9eb71f85a67ddf947ab5c3e990
(0033497)
git (administrator)
2014-10-21 16:45

Branch CR24699_4 has been deleted by inv.

SHA-1: 57bfbd99f5d78edd6646d42f5085ea30a4109a50
(0033500)
git (administrator)
2014-10-21 16:46

Branch CR24699_3 has been deleted by inv.

SHA-1: 2166418c792977e9d6f2a8c44ccc5bbdf9ada806
(0033501)
git (administrator)
2014-10-21 16:46

Branch CR24699_2 has been deleted by inv.

SHA-1: a158f742a24faa5de0e0c61e37ffd6e94a2a24ac
(0033502)
git (administrator)
2014-10-21 16:46

Branch CR24699 has been deleted by inv.

SHA-1: 8570f99aa4b81bf7f521df11c9c57f97f7340165
(0033503)
git (administrator)
2014-10-21 16:46

Branch CR24699_1 has been deleted by inv.

SHA-1: c8930abffcc834d8f264407c54ac9ed809fe2f72
(0042096)
git (administrator)
2015-06-11 07:46

Branch CR24699_1 has been created by kgv.

SHA-1: 9676dfb9d436229c1cb80225b31a42e81e991d21


Detailed log of new commits:

Author: kgv
Date: Thu Jun 11 07:45:46 2015 +0300

    TKD3DHost - D3D host for OpenGL window
(0042678)
git (administrator)
2015-07-02 15:39

Branch CR24699_1 has been updated forcibly by kgv.

SHA-1: 11db3c668d86a00b9209d9220f23d7aada9e6fad
(0042688)
git (administrator)
2015-07-02 18:52

Branch CR24699_1 has been updated by kgv.

SHA-1: 0eeed1afdc2f1e39f0d7bc623ed48697ea97bcb2


Detailed log of new commits:

Author: kgv
Date: Thu Jul 2 18:52:45 2015 +0300

    V3d_View::IsInvalidated() - add method to check view cache validation state

Author: kgv
Date: Thu Jul 2 18:51:18 2015 +0300

    OpenGl_FrameBuffer::Init(), D3DHost_FrameBuffer::Init() - add protection against 0 dimensions
    
    ~D3DHost_Workspace() - release D3D/WGL FBO.

(0042734)
git (administrator)
2015-07-03 18:49

Branch CR24699_1 has been updated by kgv.

SHA-1: 12cb8ff3ed546ab8fe075f9cf65100c61850b070


Detailed log of new commits:

Author: kgv
Date: Fri Jul 3 18:49:17 2015 +0300

    cosmetics

(0043516)
git (administrator)
2015-07-27 13:39

Branch CR24699_1 has been deleted by kgv.

SHA-1: 12cb8ff3ed546ab8fe075f9cf65100c61850b070

- Related Changesets
occt: master 15534713
Timestamp: 2014-06-03 06:11:33
Author: dln
Committer: bugmaster
Details ] Diff ]
0024699: Visualization - prototype interoperation of TKOpenGl viewer with Direct3D viewer

Add new C# sample which allow to render the OCCT scene to a Direct3D context in a WPF application.
DirectX SDK is required in order to build this sample.
mod - dox/FILES_HTML.txt Diff ] File ]
mod - dox/overview/overview.md Diff ] File ]
mod - samples/CSharp/msvc.bat Diff ] File ]
add - samples/CSharp/msvc_D3D.bat Diff ] File ]
mod - samples/CSharp/OCCTProxy/OCCTProxy.cpp Diff ] File ]
mod - samples/CSharp/OCCTProxy/OCCTProxy.vcxproj Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/BridgeFBO.cxx Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/BridgeFBO.hxx Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/Direct3DProxy.cpp Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/OCCTProxyD3D.cpp Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj Diff ] File ]
add - samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcxproj Diff ] File ]
mod - samples/CSharp/ReadMe.md Diff ] File ]
add - samples/CSharp/ReadMe_D3D.md Diff ] File ]
mod - samples/CSharp/run_wpf.bat Diff ] File ]
add - samples/CSharp/run_wpf_D3D.bat Diff ] File ]
add - samples/CSharp/WPF_D3D/D3DViewer.cs Diff ] File ]
add - samples/CSharp/WPF_D3D/MainWindow.xaml.cs Diff ] File ]
add - samples/CSharp/WPF_D3D/OCCViewer.cs Diff ] File ]

- Issue History
Date Modified Username Field Change
2014-03-07 12:20 kgv New Issue
2014-03-07 12:20 kgv Assigned To => san
2014-03-07 12:21 kgv Description Updated View Revisions
2014-03-07 12:22 kgv Assigned To san => aba
2014-03-07 12:22 kgv Assigned To aba => vpa
2014-03-07 12:22 kgv Status new => assigned
2014-03-07 14:55 kgv Description Updated View Revisions
2014-04-03 12:05 san Assigned To vpa => dbp
2014-04-03 15:38 dbp Status assigned => resolved
2014-04-03 15:39 dbp Status resolved => assigned
2014-04-04 17:47 abv Target Version 6.7.1 => 6.8.0
2014-04-04 19:06 dbp File Added: OcctDirect3D.7z
2014-04-04 19:08 dbp Note Added: 0028696
2014-04-04 19:08 dbp Assigned To dbp => kgv
2014-04-04 19:08 dbp Status assigned => feedback
2014-04-04 19:19 dbp File Added: screen.png
2014-04-04 19:19 dbp File Deleted: screen.png
2014-04-04 19:20 dbp File Added: screen.jpg
2014-04-04 19:29 dbp Note Added: 0028697
2014-04-04 19:29 dbp Note Edited: 0028697 View Revisions
2014-04-04 19:30 dbp Note Edited: 0028697 View Revisions
2014-04-07 10:03 kgv Note Added: 0028704
2014-04-07 10:03 kgv Assigned To kgv => dbp
2014-04-07 10:03 kgv Status feedback => assigned
2014-04-09 19:47 dbp Note Added: 0028769
2014-04-09 19:47 dbp Assigned To dbp => kgv
2014-04-09 19:47 dbp Status assigned => feedback
2014-04-10 10:49 kgv Note Added: 0028772
2014-04-10 10:49 kgv Assigned To kgv => dbp
2014-04-10 10:49 kgv Status feedback => assigned
2014-04-11 10:14 dbp Note Added: 0028788
2014-04-11 10:14 dbp Assigned To dbp => kgv
2014-04-11 10:14 dbp Status assigned => resolved
2014-04-11 10:18 dbp Note Edited: 0028788 View Revisions
2014-04-11 14:12 dbp Note Added: 0028793
2014-04-11 16:13 kgv Note Added: 0028800
2014-04-11 16:13 kgv Assigned To kgv => bugmaster
2014-04-11 16:13 kgv Status resolved => reviewed
2014-04-14 16:41 mkv Assigned To bugmaster => mkv
2014-04-15 18:18 mkv Note Added: 0028848
2014-04-15 18:19 mkv Test case number => Not needed
2014-04-15 18:19 mkv Assigned To mkv => apn
2014-04-15 18:19 mkv Status reviewed => feedback
2014-05-05 16:16 kgv Relationship added related to 0024894
2014-06-03 10:14 kgv Note Added: 0029643
2014-06-03 10:14 kgv Assigned To apn => bugmaster
2014-06-03 18:17 bugmaster Note Added: 0029656
2014-06-03 18:17 bugmaster Assigned To bugmaster => kgv
2014-06-03 18:17 bugmaster Status feedback => assigned
2014-06-03 18:22 kgv Assigned To kgv => dbp
2014-06-03 19:25 kgv Assigned To dbp => abv
2014-06-03 19:25 kgv Status assigned => feedback
2014-06-05 13:53 abv Note Added: 0029702
2014-06-06 08:17 kgv Assigned To abv => san
2014-06-06 08:17 kgv Status feedback => assigned
2014-07-08 17:35 san Assigned To san => dbp
2014-07-08 18:09 san Note Added: 0030012
2014-07-16 16:29 kgv Assigned To dbp => dln
2014-09-01 10:38 kgv Assigned To dln => isz
2014-09-04 08:24 kgv Assigned To isz => dln
2014-09-08 09:42 git Note Added: 0031439
2014-09-08 15:49 git Note Added: 0031445
2014-09-08 16:19 git Note Added: 0031489
2014-09-09 08:33 git Note Added: 0031499
2014-09-11 16:03 abv Note Added: 0031616
2014-09-30 13:16 git Note Added: 0032453
2014-10-02 10:11 dln Note Added: 0032555
2014-10-02 10:11 dln Assigned To dln => kgv
2014-10-02 10:11 dln Status assigned => resolved
2014-10-06 13:11 kgv Note Added: 0032702
2014-10-06 13:11 kgv Assigned To kgv => bugmaster
2014-10-06 13:11 kgv Status resolved => reviewed
2014-10-06 14:22 mkv Assigned To bugmaster => mkv
2014-10-06 14:34 git Note Added: 0032709
2014-10-06 14:34 mkv Assigned To mkv => bugmaster
2014-10-06 16:25 bugmaster File Added: wpf.gif
2014-10-06 16:25 bugmaster File Added: wpf-D3D.gif
2014-10-06 16:44 abv Note Added: 0032719
2014-10-06 16:58 bugmaster Note Added: 0032721
2014-10-06 16:58 bugmaster Assigned To bugmaster => kgv
2014-10-06 16:58 bugmaster Status reviewed => feedback
2014-10-06 16:59 bugmaster Note Edited: 0032721 View Revisions
2014-10-06 17:01 kgv Assigned To kgv => dln
2014-10-06 17:01 kgv Status feedback => assigned
2014-10-06 17:03 bugmaster Note Edited: 0032721 View Revisions
2014-10-09 14:37 git Note Added: 0032894
2014-10-09 14:45 dln Note Added: 0032897
2014-10-09 14:46 dln Assigned To dln => kgv
2014-10-09 14:46 dln Status assigned => resolved
2014-10-09 15:35 kgv Note Added: 0032901
2014-10-09 15:35 kgv Assigned To kgv => bugmaster
2014-10-09 15:35 kgv Status resolved => reviewed
2014-10-13 17:52 bugmaster Changeset attached => occt master 15534713
2014-10-13 17:52 bugmaster Status reviewed => verified
2014-10-13 17:52 bugmaster Resolution open => fixed
2014-10-21 16:41 git Note Added: 0033414
2014-10-21 16:45 git Note Added: 0033488
2014-10-21 16:45 git Note Added: 0033496
2014-10-21 16:45 git Note Added: 0033497
2014-10-21 16:46 git Note Added: 0033500
2014-10-21 16:46 git Note Added: 0033501
2014-10-21 16:46 git Note Added: 0033502
2014-10-21 16:46 git Note Added: 0033503
2014-11-11 12:43 aiv Fixed in Version => 6.8.0
2014-11-11 13:02 aiv Status verified => closed
2015-06-11 07:46 git Note Added: 0042096
2015-07-02 15:39 git Note Added: 0042678
2015-07-02 15:55 kgv Relationship added related to 0026392
2015-07-02 18:52 git Note Added: 0042688
2015-07-03 18:49 git Note Added: 0042734
2015-07-27 13:39 git Note Added: 0043516


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker