Re: GLdrawing Area Questions...
- From: carlos pehoe civil ist utl pt (Carlos Pereira)
- To: gtk-app-devel-list gnome org
- Subject: Re: GLdrawing Area Questions...
- Date: Sat, 16 Aug 2003 21:55:01 +0100 (WEST)
My current code uses a switch statement in the button_press,
button_release and motion_notify events based on the status of the
current menu item. This worked well when using only a couple of
drawing primatives, but as I implement new features, my switch
statements are getting out of control.
switch statement in the button_press: fine
switch statement in the button_release: fine, if you need it
switch statement in the motion_notify: fine, but be carefull
You should have some enumeration to specify
the various actions on the switch (and use the switch
only to call external functions, on different files)
I want to do everything in the menu_response function, but am not sure
how to impliment. I guess my first question is does program control
return to the menu_function after an event in the drawing area ?
Some experiments I have done suggest control is not always sent back to
the menu_response function.
I am not sure what you mean, after an event in the drawing area
YOU receive the event in button_press/release/notify, then
YOU send control to wathever you want, namely to the
menu_response function.
Are you using some sort of gtk_main loop to wait on the dialog?
For example the user selects a menu item to draw a point. Then clicks
on the drawing area to establish the location of the first vertex, then
move the cursor to a new location and clicks the mouse to establish the
second vertex. I want the menu_response function to handle the
backgroud processing once the vertex locations are established.
In my app, after some dialog is open and properties set,
you click somewhere on the screen and an atom is created and
drawn there, then you click on a different spot and a new atom
is created and drawn there, etc...
This looks exactly what you want...
The way I do this is just to receive the Gtk 2D x,y coordinates
on the press callback (using a switch as you), convert to OpenGL
2D x,y coordinates (Gtk counts y from top, OpenGl counts y from bottom),
convert to OpenGL 3D x,y,z coordinates and voila...
No matter what you do, the starting point is always
going to be your button_press|release_event callback,
after that you control everything!
Carlos
http://www.gamgi.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]