LabView - OpenGL - collision detection

[b]Hi, all.

I have spent several months trying to find the way to accomplish some tasks in a project, without success, and I think you may have the solution.

Well, my project is written in LabView, and consists of a 3D scene where it’s displayed a robot arm. It has been represented using the 3D Picture Control (LabView toolkit for 3D scene representation). Every mechanical part of the robot is a VRML model (they’re not simple geometries) that has been loaded and placed defining relationships between them, and I can control their relative movements with some controls placed on the LabView control panel window.

The representation with the 3D Picture Control has been fairly easy and satisfactory, but now I need to add several advanced capabilities, such as collision detection (between the robot itself, with other objects and with the ground). Since the 3D Picture Control doesn’t have these functions, I began to learn OpenGL.

I don’t want to redisplay the model again in the OpenGL render window, because it’s properly displayed in the 3D Picture Control; but I want to pass geometric data to the C-OpenGL program, rebuilt in this program those mechanical parts that could collide, and use some kind of algorithm for collision detection between them. This code would run once every LabView processing cycle, and check whether there’s collision or not.

I have found several problems:

  1. I’m trying to execute a C program with OpenGL in LabView. I compile it into a dll and use the Call Library Function Node. I have also replaced the glutMainLoop of GLUT for glutMainLoopEvent of freeGLUT. This is because glutMainLoop never exits the OpenGL main loop and doesn’t return the control to the calling function (LabView, in this case); but glutMainLoopEvent does. However, I found that LabView goes wrong when trying to run the program (well, more exactly, the first time I run, it goes OK; but the second, LabView crashes and closes itself).

  2. Is it worth learning OpenGL or should I learn OpenSG (OpenSceneGraph, based on C++) since there are high level libraries based on it that detect collisions? Are there efficient algorithms in OpenGL for collision detection? On the other hand, I’ve found on the internet an OpenSG-based library, called CollDet, that seems to perform these calculations:

CollDet website:[/b]

I paste here the code of the OpenGL program:

#include “stdafx.h”
#include <freeglut.h>

extern “C” __declspec(dllexport)int MyFunction();

void display(void)

void init(void)

void MyOpenGL()
int argc = 1;
char* argv[1] = {{""}};
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutCreateWindow(“My Window”);

int MyFunction()
return 0;

Well, I hope you can help me.

Thanks in advance,

OpenGL has nothing to do with collision detection, what made you believe that ?

Collision detection (and what to do when it happens) is not a graphic task at all.
It may or may not be a problem for you, but CollDet is not opensource :
Instead there is Bullet, with more features :
or ODE :

Thank you very much for your help, Zbuffer.

Well, in my application, I only want to predict collisions, I mean, to define some kind of distance function between solid parts and create an alert when a certain distance threshold is exceeded. So, it’s not needed any physical modelling (it won’t be any contact, what I want to do is just prevent from them).

In addition, solid parts are not simple models like cylinders or boxes… instead they’re complex mechanical models created in Solid Edge and saved into VRML files.

In that case, which library do you best recommend me, ODE or Bullet?

Is it possible to import such VRML models (or other similar file types) using these libraries?

Thanks again, it was very useful information.