05-26-2012 12:16 AM
It has been awhile since I have used GLUT, but I think that glutInit should only be called once per process. When you run a VI, we don't start a new process. My guess then is that glut fails due to the duplicate call
I have confirmed this experimentally. If I guard my call to glutInit such that I only call it once per process, things seem to be much better. This can be accomplished by a simple static in your dll.
Example:
static bool first = true; int argc = 0; char* argv[] = {"foo"}; if(first) glutInit(&argc, argv); first = false;
Quick question: why aren't you using the 3d picture API instead? We have full support for having either an embedded control or a stand alone window to render your scene into. I would be very interested to hear why you chose to interface with GLUT as opposed to a LabVIEW only solution.
05-26-2012 01:35 PM
Thanks for reply and solution! Works just fine.
To your question:
I am using CUDA in LabVIEW and since calculation result (hologram) computed by CUDA is stored on GPU I decided to use CUDA/OpenGL interface to directly display hologram (now it is not neccessary to copy hologram back to labview which send it back to GPU to display it).
I am not very familiar with OpenGL so I decided that the simplest way how to make my first CUDA/OpenGL/LabVIEW program is to modificate example from here. I did not expect this problem and second reason is that I did not know about 3d picture API.
Is there some nice tutorial for 3d picture API?
05-27-2012 01:13 PM
brano.s wrote: [...]
Is there some nice tutorial for 3d picture API?
Look at the LabVIEW Help: Search for "Using the 3D Picture Control".
LabVIEW also comes with examples for this control. In the example finder, search for "3d picture".