PDA

View Full Version : How to design drawing tool using opengl??



applehaha
08-05-2003, 04:33 PM
There is a sample in MSDN of Visual C++ which named "Drawcli",I want to use opengl make the same resule,it is 2D.I think when I design a drawing tool such as line,rectangle,or polygon,I must know the cursor's position of mouse,I'm searching for a long time but without any result,please help me!!

nexusone
08-05-2003, 05:00 PM
You can use glut, simple mouse routines that you can use to get mouse position.

I wrote a simple drawing program using glut, if you drop me an e-mail I can e-mail it to you.


Originally posted by applehaha:
There is a sample in MSDN of Visual C++ which named "Drawcli",I want to use opengl make the same resule,it is 2D.I think when I design a drawing tool such as line,rectangle,or polygon,I must know the cursor's position of mouse,I'm searching for a long time but without any result,please help me!!

applehaha
08-07-2003, 04:11 PM
My E-mail is dangchunqiu@163.com.

applehaha
08-12-2003, 08:25 PM
Originally posted by nexusone:
You can use glut, simple mouse routines that you can use to get mouse position.

I wrote a simple drawing program using glut, if you drop me an e-mail I can e-mail it to you.


Your program is very useful, but after compiling in my program, it warns that ¡°glutMouseFunc' : cannot convert parameter 1 from 'void (int,int,int,int)' to 'void (__cdecl *)(int,int,int,int)'¡±.In my program, I use functions not only from the ¡°glut¡± library, but also use ¡°gl¡± functions for initializing, using ¡°glutMouseFunc¡± and ¡°glutMotionFunc¡± only for the drawing tool. Is there something wrong? That is to say, whether I can use other functions for initializing without glut function? And I have another two questions, the first, whether ¡°glut¡± based on the message-response mechanism? I have read a text which says ¡°GLUT dose not support menu bar type function¡±, so I fear I can¡¯t use it in my program, because what I want to do is a drawing tool, I need a menu bar interface, which can be used applying to the user at will. The second , the common opengl programs what I saw are based on SDI in Visual C++, but once use ¡°glut¡± function, it seems that there must has a ¡°main¡± function and without the concept of ¡°class¡± , can you explain it to me? Thank you very much!!