3D Dialog using OpenGL

3D Dialog using OpenGL

Anonymous
Not applicable
415 Views
1 Reply
Message 1 of 2

3D Dialog using OpenGL

Anonymous
Not applicable
I am trying to create my own AutoCAD dialog box with interactive 3D graphics and animation. To this end, I wrote a simple ARX program that use OpenGL's GLUT utilities. Everything works beautifully until I close the dialog box. I have tried many things, but so far nothing works. Here is the basic code:

// (arxload "Test.arx")
#include
#include // glut.h
int argc=1, dialog; char *argv[]={""};
void display(void) {char str[]="Press 'Esc' to exit";
glColor3f(1,1,1); glRasterPos2f(0,0);
for(int i=0; i<(int)strlen(str); i++) {
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str);
}
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y) {if(key==27) {
glutDestroyWindow(dialog);
glutLeaveMainLoop(); // requires freeglut.h
}}
extern "C" AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt) {
switch (msg) {
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(pkt);
acrxDynamicLinker->registerAppMDIAware(pkt);
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE);
dialog=glutCreateWindow("My Dialog");
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutMainLoop(); // this might be a problem
break;
}
return AcRx::kRetOK;
}

Maybe it has something to do with my acrxEntryPoint. Any suggestions? I think it will be very cool if I can get this to work right.
0 Likes
416 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
You can't use glut as it is expecting a main program, if you have an Arx program it is a .dll and Autocdad is the main program.

You need to encapsulate the opengl in an activeX control, then you should be able to use it like any other control in VC++ or VB or dotnet.
0 Likes