PDA

View Full Version : What GL libs reqd to write CAD app?



steve_hiemstra
04-02-2002, 02:29 PM
Hi All,

All this GL/GLU/GLUT/GLAUX stuff has my head spinning. My PC with an XP OS has GL and GLU libs/headers already on it (I use VC++ and MFC). So what do I need for the following?...

I'd like to write a 'simple' CAD program for my PC (probably MFC w/ SDI/MDI). I need to:

1) Import/export bitmaps(textures) and objects from other apps (DXF, BMP).

2) Put the textures on the objects.

3) Pick objects with the mouse and drag them (in 3D). The textures don't have to be visible during the drag (reverting to wireframe during move is fine).

4) Pick groups of objects <3D again> with the mouse (2D rubber band, or 3D <SHIFT + click, click, click...> ). Don't necessarily need to drag them, but would like to for future improvement.

5) Pick objects and do translate, scale, or rotate (one at a time) by sliding the mouse (holding a different key <mouse or kybd> down to change axis of trans/scale/rot).

6) Compatibility with 'most' current PC graphics cards (I'd like to give the app to others, and I wonder if there are any 'gotchas' about making OpenGL work on different cards <drivers???> ).

7) Don't need 'collision detect', but would like to easily move objects 'close' to other objects (snap-to, align).

As you can see I'm particularly concerned that I won't get enough stability/flexibility with the 2D/3D mouse 'pick' operations on the PC under MFC.

Also, I am concerned about 'what else' I need to install so other graphics cards get hardware acceleration of OpenGL on 'most' PCs.

Thanks in Advance,

SteveH

nexusone
04-02-2002, 06:12 PM
First let list what each library does:

opengl.lib Opengl main library needed to use OpenGL(So have to have it).

glu.lib Opengl utility library, advanced functions made up of from the base opengl library.

glaux.lib Another opengl utility library, BMP loader, object primitives. Most functions replaced in GLUT, is not recomemded for use in new programs as no longer supported.

glut.lib Opengl utility toolkit, window creation, menu management, mouse/keyboard input managment, object primitives. Write program with GLUT and get cross platform program that can be used with linux and Mac.

The rest of what you asked is not opengl functions or MFC functions, it is something you write.

points:

1> You can write your own texture inport routines or copy someone elses not a function of opengl.

2> nehe.gamedev.net has tutors on how to program opengl, one of them is using texture maps.

3> nehe.gamedev.net has a tutor on object picking and how to read the mouse. The other things you program how you want to objects to move, not a direct function of opengl or MFC.

4> Grouping and moving another thing that is not a built in routine, something in which you write the code yourself.

5> translate, rotate, scale are all functions of opengl, but you still have to write the code telling what function to preform and how the mouse effects the object.

6> Opengl hardware acceleration is done through the video driver, it the mfg of the video card who writes the opengl support for the card, you need not worry about it.

7> Another thing in which you write your own code as to how objects are to move and relate to each other.

stability/flexibility is all in how you code your program, a poorly writin program will be un-stable and unflexible.....

I think your first concern should be learning more about how to program C and how opengl works or for that fact any type of program.....


Originally posted by steve_hiemstra:
Hi All,

All this GL/GLU/GLUT/GLAUX stuff has my head spinning. My PC with an XP OS has GL and GLU libs/headers already on it (I use VC++ and MFC). So what do I need for the following?...

I'd like to write a 'simple' CAD program for my PC (probably MFC w/ SDI/MDI). I need to:

1) Import/export bitmaps(textures) and objects from other apps (DXF, BMP).

2) Put the textures on the objects.

3) Pick objects with the mouse and drag them (in 3D). The textures don't have to be visible during the drag (reverting to wireframe during move is fine).

4) Pick groups of objects <3D again> with the mouse (2D rubber band, or 3D <SHIFT + click, click, click...> ). Don't necessarily need to drag them, but would like to for future improvement.

5) Pick objects and do translate, scale, or rotate (one at a time) by sliding the mouse (holding a different key <mouse or kybd> down to change axis of trans/scale/rot).

6) Compatibility with 'most' current PC graphics cards (I'd like to give the app to others, and I wonder if there are any 'gotchas' about making OpenGL work on different cards <drivers???> ).

7) Don't need 'collision detect', but would like to easily move objects 'close' to other objects (snap-to, align).

As you can see I'm particularly concerned that I won't get enough stability/flexibility with the 2D/3D mouse 'pick' operations on the PC under MFC.

Also, I am concerned about 'what else' I need to install so other graphics cards get hardware acceleration of OpenGL on 'most' PCs.

Thanks in Advance,

SteveH

steve_hiemstra
04-02-2002, 07:34 PM
Thanks for your detailed response - I really do appreciate it. The GLUT library sounds like it will help with the mouse and other things I need. It's the only library that wasn't already on my machine. Guess Microsoft didn't want to 'over-equip' OpenGL developers <...hmmmm...>, or maybe it's a licensing issue. I've heard about the 'non-restricted' version of GLUT.

My only real concerns are about OpenGL on MS Windows and it's compatibility under MFC. I've already looked at many tutorial sites and many of them mention minor glitches when working with multiple windows (MDI w/ Doc/View) and also with the mouse.

You needn't worry about my learning C,C++,MFC, or any of that stuff. I've been using them for many years, proabably longer than the majority. I even programmed on IRIS workstations for 3 years, before OpenGL was even conceived. So why do I ask these 'simple' questions?! Because I've been busy keeping up with Microsoft and their cavalcade of 'every-changing' APIs. Keeping up with Microsoft's tools is like walking up the 'down' escalator... plenty of horizontal progress.

I was programming 3D w/ Direct3D when it was very new, but my employment changed and I haven't had the need to write 3D for over 6 years, so I'm only a 'newbie' on OpenGL w/ Windows under MFC, and rusty in my 3D skills. So it's not whether I 'understand' what 3D is and how it's used, it's whether I can do it with OpenGL on a Microsoft OS w/ dev tools that are always changing... <.NET anyone?> (I'll fore-go that for now)

Oh, by-the-way (BTW)... I use a particular rendering 'studio' tool already, and it can export DXF -AND- 3D-Studio files (as ascii text). I want to create my custom complex wireframe 'primitives' from that tool, and import them into my CAD app for use. Any links to sites with DXF or 3DS import source code would be appreciated.

Thanks again for all your help,

SteveH



Originally posted by nexusone:
First let list what each library does:

opengl.lib Opengl main library needed to use OpenGL(So have to have it).

glu.lib Opengl utility library, advanced functions made up of from the base opengl library.

glaux.lib Another opengl utility library, BMP loader, object primitives. Most functions replaced in GLUT, is not recomemded for use in new programs as no longer supported.

glut.lib Opengl utility toolkit, window creation, menu management, mouse/keyboard input managment, object primitives. Write program with GLUT and get cross platform program that can be used with linux and Mac.

The rest of what you asked is not opengl functions or MFC functions, it is something you write.

points:

1> You can write your own texture inport routines or copy someone elses not a function of opengl.

2> nehe.gamedev.net has tutors on how to program opengl, one of them is using texture maps.

3> nehe.gamedev.net has a tutor on object picking and how to read the mouse. The other things you program how you want to objects to move, not a direct function of opengl or MFC.

4> Grouping and moving another thing that is not a built in routine, something in which you write the code yourself.

5> translate, rotate, scale are all functions of opengl, but you still have to write the code telling what function to preform and how the mouse effects the object.

6> Opengl hardware acceleration is done through the video driver, it the mfg of the video card who writes the opengl support for the card, you need not worry about it.

7> Another thing in which you write your own code as to how objects are to move and relate to each other.

stability/flexibility is all in how you code your program, a poorly writin program will be un-stable and unflexible.....

I think your first concern should be learning more about how to program C and how opengl works or for that fact any type of program.....



[This message has been edited by steve_hiemstra (edited 04-02-2002).]

[This message has been edited by steve_hiemstra (edited 04-02-2002).]

[This message has been edited by steve_hiemstra (edited 04-02-2002).]

mikael_aronsson
04-02-2002, 10:18 PM
Hi !

GLUT does not have a way to detect when the user clicks on the "Close" menu/button (X), so if you have some kind of application where you want to save something on termination you are out of luck with GLUT, if you are working on some kind of CAD application I would go for MFC.

OpenGL together with MFC works just fine, as long as everything is implemented the way it should there are no problems that I am aware of, there are a few nasty bugs in the MS software driver for OpenGL though (opengl32.lib), but as long as you use hardware OpenGL that is noi problem.

MFC itself has some off stuff to off course, but nothing related to OpenGL.

Make sure you set the right flags for the window WS_CLIPCHILDREN and WS_CLIPSIBLINGS, and maybe also the class flag CS_OWNDC to improve things a bit.

Don't forget to handle the WM_ERASEBKGND flag or you will get flashing when you render the OpenGL output.

Mikael

nexusone
04-03-2002, 06:16 AM
There are a few people out there working with opengl for CAD/ 3D object modeling.
I think that maybe you should try to contact them.
www.cornflakezone.com (http://www.cornflakezone.com) // simple drawing program for 3D.
www.sourceforge.com (http://www.sourceforge.com) // host a lot of programs in the works a few there are CAD.



Originally posted by steve_hiemstra:
Thanks for your detailed response - I really do appreciate it. The GLUT library sounds like it will help with the mouse and other things I need. It's the only library that wasn't already on my machine. Guess Microsoft didn't want to 'over-equip' OpenGL developers <...hmmmm...>, or maybe it's a licensing issue. I've heard about the 'non-restricted' version of GLUT.

My only real concerns are about OpenGL on MS Windows and it's compatibility under MFC. I've already looked at many tutorial sites and many of them mention minor glitches when working with multiple windows (MDI w/ Doc/View) and also with the mouse.

You needn't worry about my learning C,C++,MFC, or any of that stuff. I've been using them for many years, proabably longer than the majority. I even programmed on IRIS workstations for 3 years, before OpenGL was even conceived. So why do I ask these 'simple' questions?! Because I've been busy keeping up with Microsoft and their cavalcade of 'every-changing' APIs. Keeping up with Microsoft's tools is like walking up the 'down' escalator... plenty of horizontal progress.

I was programming 3D w/ Direct3D when it was very new, but my employment changed and I haven't had the need to write 3D for over 6 years, so I'm only a 'newbie' on OpenGL w/ Windows under MFC, and rusty in my 3D skills. So it's not whether I 'understand' what 3D is and how it's used, it's whether I can do it with OpenGL on a Microsoft OS w/ dev tools that are always changing... <.NET anyone?> (I'll fore-go that for now)

Oh, by-the-way (BTW)... I use a particular rendering 'studio' tool already, and it can export DXF -AND- 3D-Studio files (as ascii text). I want to create my custom complex wireframe 'primitives' from that tool, and import them into my CAD app for use. Any links to sites with DXF or 3DS import source code would be appreciated.

Thanks again for all your help,

SteveH


[This message has been edited by steve_hiemstra (edited 04-02-2002).]

[This message has been edited by steve_hiemstra (edited 04-02-2002).]

[This message has been edited by steve_hiemstra (edited 04-02-2002).]



[This message has been edited by nexusone (edited 04-03-2002).]

steve_hiemstra
04-03-2002, 07:09 AM
Yes, MFC still has some quirks with regards to the mouse. I've been doing high-end custom ActiveX controls with ATL/COM/DCOM/<blah..blah..blah..> for over 2 years. Both window 'focus' and mouse 'capture' have always been "challenging" <and don't even get me started on writing 'fully-compliant' HTML-compatible ActiveX controls!>.

I use Microsoft stuff because it's a 'big' market for programmers, and affordable for home use. Every platform has it's shortcomings. Microsoft's shortcoming is the overwhelming variety of inconsistent APIs, the 'no.. that's not it, use this instead..' syndrome, and other slight-of-hand.

Hopefully .NET with it's common IDE, all-languages-living-in-peace-and-harmony, all apps are web-pages philosophy will 'dumb-down' programming w/ Microsoft APIs enough so people doing more innovative things like 3D and mathematical/scientific/engineering programming can just focus on the internals, and stop fighting with the GUI Control and Window interfaces so much.

We can always fool ourselves into believing that things will get easier, right?! Oh what I wouldn't give to be programming my old Apple II+ right now <for a living>. It was more of a 'hobby' than a 'profession' back then...

SteveH





Originally posted by mikael_aronsson:
Hi !

GLUT does not have a way to detect when the user clicks on the "Close" menu/button (X), so if you have some kind of application where you want to save something on termination you are out of luck with GLUT, if you are working on some kind of CAD application I would go for MFC.

OpenGL together with MFC works just fine, as long as everything is implemented the way it should there are no problems that I am aware of, there are a few nasty bugs in the MS software driver for OpenGL though (opengl32.lib), but as long as you use hardware OpenGL that is noi problem.

MFC itself has some off stuff to off course, but nothing related to OpenGL.

Make sure you set the right flags for the window WS_CLIPCHILDREN and WS_CLIPSIBLINGS, and maybe also the class flag CS_OWNDC to improve things a bit.

Don't forget to handle the WM_ERASEBKGND flag or you will get flashing when you render the OpenGL output.

Mikael