Re: [fltk.opengl] event_x() To Get FL_Gl_Window Coordinates

2013-04-05 Thread Albrecht Schlosser
On 03.04.2013 22:54, Mike Werner wrote:
 I want to be able to left click in an OpenGL window and have the mouse 
 coordinates in that window returned (i.e. relative to the upper left corner 
 of the window). Seems like I should be able to do this using Fl::event_x.  
 However it's turning out to be difficult. First of all the only way I can get 
 event_x to return anything is to put it in the draw function of my 
 Fl_Gl_Window with the syntax Fl::event_x(). But this doesn't return anything 
 when I click in the OpenGL window. It ONLY returns coordinates when I click 
 on a button outside the OGL window. And the X value returned is relative to 
 main FLTK window. Not what I need.

First of all: Fl::event_x() is only valid in the event handling code
or in a callback called from this code. Putting Fl::event_x() in a
draw() method can only give you _undefined_ values, i.e. it _can_
sometimes be what you expect. This is because Fl::event_x() uses
a static variable that is updated only on some events like mouse
clicks, but also on FL_MOVE and maybe others.

I saw your follow-up: using a button underneath the OGL window
might do what you need, since you get the button callback when
the click event is handled. There is no way other than to do
the coordinate translation yourself, since the OGL window has
its own coordinate system, but the button coordinates are
relative to the button's window().

 Was hoping to be able to put event_x() in the draw function

never put it in the draw() method, see above.

 or in the callback to Fl_Gl_Window and get OGL window relative coordinates.

 The only idea I have now is to put a large button underneath the OGL window. 
 When I click inside the OGL window, this button will be activated and I'll 
 get an x cord. relative to the main FLTK window and have to subtract off the 
 upper left corner coordinates of the OGL window.

 Anyone have a more elegant solution?

I'd try to put an invisible box or button in the OGL window that
serves the same purpose as your button in the main window. The
invisible box could be an own derived class, so that you can
use the handle() method, but a simple callback would also do
the job. However, event handling in GL Windows might differ
from normal windows, so I don't know if this would work.


Albrecht

___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] How to enable Drag n Drop on OpenGL window ?

2013-02-22 Thread Albrecht Schlosser
On 18.02.2013 12:17, Furqan wrote:

 ... File only accepted when drop over the Fl_Double_Window.

 Here is my code..

 MainWindow-begin(); // Fl_Double_Window

 DnDReceiver b(0,0,WINDOW_SIZE_W, WINDOW_SIZE_H); // Drag n Drop Box

 glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_ACCUM | 
 GLUT_ALPHA | GLUT_STENCIL | GLUT_MULTISAMPLE);
 GLUT_MAIN_WINDOW = glutCreateWindow(RACS_VERSION);
 MainWindow-end();
 MainWindow-show(argc, argv);

 I tried to put DnDReceiver box before, after, middle, everywhere, inside of 
 begin and end of Fl_Double_Window but no success.

 Please guide me Where to put DnDReceiver box in the code.

To receive events first, you must put the invisible receiver
box last, but within begin()/end() of the main window. You can
imagine that this box is the top-most widget in the widget
layer(s) of your window, so it gets the events first. If it
returns zero on an event, then the event falls through to
the lower layers.

BTW: in contrast, drawing is done first to last widget within
each group/window, which is essentially the same principle:
bottom layer drawn first, top layer drawn last.

Albrecht

___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] problems for input Widget in a browser

2012-02-13 Thread Albrecht Schlosser
On 13.02.2012 07:21, goodwood wrote:

 please see the following code, it simply puts two input widgets into a 
 browser. But it's running, the caption of the input widget won't appear 
 unless setting its align as INSIDE (compare input1 and input2). And the 
 mouse cannot correctly position the text in the input windows.

 Helps are greatly appreciate. thanks in advance.

You've posted in the wrong group. This one is for OpenGL problems
only, and only few users are reading here. Please post your question
in fltk.general with a wider audience, and there you'd be on topic.

 //using fltk2

Seeing your question, I assume that you're maybe new to fltk (maybe
I'm wrong and you only wanted to show a specific issue). If I'm
right, please consider using FLTK 1.3 instead of 2.0, since FLTK 2
is only experimental, dormant, there is almost no support available,
and there (probably) won't be bug fixes any more.

Despite the numbering, FLTK 1.3 is the current development version,
stable, and supported. See:

http://www.fltk.org/articles.php?L825

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] how to use glutWire* functions ?

2011-03-15 Thread Albrecht Schlosser
On 15.03.2011 04:48, Greg Ercolano wrote:
 Greg Ercolano wrote:
  Maybe show us your FLTK2 translated sphere.cxx file.

 I decided to take a shot at translating this example to FLTK2.

 I'm not sure if it's right because I get the same error you do,
 with or without the glutInit() call, and no matter where I put it in 
 main().

 With this code I'm trying to use FLTK2 to completely handle the
 windows, and calling fltk::run().

 I could probably make it work if I made it more like the fractal.cxx
 program where the fltk widgets are in an FLTK window, and the glut stuff
 in a separate window. Might try that next.

I still don't know more about glut, but reading the FLTK 1.3 (!) docs
about Mixing GLUT and FLTK Code

http://www.fltk.org/doc-1.3/glut.html#glut_mixing

your code seems to be faulty. I understand the docs so that you
shall not call glutInit() if (and only if?) you want to make your
GLUT window a child of a Fl_Window. Then you must also show() your
main window *before* you add the glut subwindow (this is not correct
in your example code).

HTH

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] how to use glutWire* functions ?

2011-03-14 Thread Albrecht Schlosser
On 13.03.2011 11:20, jseb wrote:
 I put a freeglut window in fltk gui.

 In my redraw function, i draw a sphere:

 glutWireSphere(0.7,10,10);

 I compile and link like this:
 g++ *.cxx -Wall -lfltk2 -lfltk2_gl -lfltk2_glut -lGL -lGLU -lglut

 And when executing:
 freeglut ERROR: Function glutWireSphere called without first calling 
 'glutInit'.

Did you try to call glutInit ?

 If i remove the call to glutWireSphere, everything is right.

I don't have any knowledge about glut etc., but I hope that I can
help anyway. There are two example programs that ought to work,
but I see different code. :-( One is calling glutInit, whereas the
other doesn't. Please take a look at those, maybe it can help. Do they
work for you?

Example 1: test/fractals.cxx

fractals.cxx:775://  glutInit(argc, argv); // this line removed for FLTK


Example 2: test/glpuzzle.cxx

glpuzzle.cxx:1438:  glutInit(argc, argv);


Both examples work for me (Windows, compiled with MinGW), but as I said
already, I have no idea what's right or wrong.

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] linking error.

2010-11-29 Thread Albrecht Schlosser
Ben Stott wrote:
 I think you might need to link against ws2_32.lib - note that linking
 order is important, so you'll have to link to ws2_32.lib before you link
 to any of fltk's openGL stuff.

Hmm? I think you're right, but the order should be the opposite, i.e.
ws2_32.lib last.

And additionally you also need COMCTL32.LIB for TrackMouseEvent.

The following is from a cygwin/mingw build (use it only as an example
for the right order, and add ws2_32.lib, as said above):

$ ./fltk-config --use-images --use-gl --ldflags
[...] -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg -lfltk_gl -lglu32 
-lopengl32 -lfltk -lole32 -luuid -lcomctl32 [-lws2_32]

Your opengl and image libraries may be different.

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] FLTK installation Windows7 64-bit using VS2008

2010-03-10 Thread Albrecht Schlosser
Nikhil Navkar wrote:

 Could anyone please tell which version of FLTK should be used for 
 installation as per the given configuration:
 Windows 7 (64-bit)
 Microsoft Visual Studio 2008
 x64 Platform, Release or Debug - Configuration

First of all: your question should be in fltk.general, there
you would probably get more and faster answers.

That said: it depends...

The current stable version is FLTK 1.1.10, but this is only for
8-bit character code pages, whereas the current development
version FLTK 1.3 uses unicode (UTF-8), but is not yet released
(although the majority of code works well).

If you start a new project, pick one of these, they are mostly
API compatible, so that you can even switch the versions.

 Which IDE files should I use?

That's more difficult to answer.

FLTK 1.3: try the files in ide/VisualC6. They are maybe not yet
tested well, but if they work for you, we'd appreciate feedback
(and if they don't work also, please).  The ide/visualc files
should work as well, but you'd better not use ide/vc2005.

FLTK 1.1: I don't know, but I guess that the visualc files would
probably be the best, but you should try yourself. They are all
in direct subdirectories of the fltk root, there's no ide/ folder.

Whenever you find a missing Cairo dependency in any project, please
switch to another compilation setup (Debug or Release) without Cairo
in its name.

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl


Re: [fltk.opengl] handle not called when mouse dragged

2009-03-10 Thread Albrecht Schlosser
Livia Koch wrote:
 I have subclassed Fl_Gl_Window (class My_Window) and written an own 
  handle-function. It works fine, but recently I have made a new
  subclass My_Window_2 to my first subclass. As a handle function,
 it is still calling My_Window::handle(int event).

Do you really mean calling, i.e. did you define your own handle
method, and this calls My_Window::handle(), or is it done by
inheritance? I don't think that it would matter, but maybe there
are other subtle differences ...

 For My_Window_2 dragging doesn't work. FL_PUSH and FL_RELEASE are
  recognized correctly, however inbetween handle isn't called anymore.

Is there something different WRT widget hierarchies? Are these GL
windows main windows or subwindows?

 Do you have any suggestions?

Maybe it's a focus problem. See below.

 Thanks a lot!
 
 Here is the code:
 
 
 int My_Window::handle(int event)
 {
 
 if (event == FL_MOUSEWHEEL)   // wheelmouse support
 {
 cout  FL_MOUSEWHEEL  endl;
   return 1;
 }
 else if (event == FL_PUSH){// mouse button
   cout  FL_PUSH  endl;

  take_focus(); // try adding this here

 return 1;
 }

[ ... snip ... ]

Albrecht
___
fltk-opengl mailing list
fltk-opengl@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-opengl