Hi,
I am using JOGL with jdk1.4 on Red Hat Linux 7.2 and am a JOGL newbie.
I am writing a bit analyser program which, in simple terms, reads in a digital signal and raster bits (shown as small 2d rectangles - one colour for a 1, another colour for a 0) on a GLCanvas. It is vitally important that I can drag the mouse over any area of these rectangles and hence get the corresponding 1’s and 0’s into a buffer for further analysis. Note -I need graphics acceleration because when a fast baud rate signal is being read in the graphics needs to update pretty rapidly to keep up a smooth rastering effect.
I have added my GLCanvas (canvas) to a Swing JFrame and so far my bits are displaying ok. My problem is that I have added both a MouseMotionListener/MouseListener and the coordinates I get for the mouse clicks in the y axis are totally incompatible with the GLCanvas coordinate system. I know it is documented that the y axis is upside down in relation to awt/swing but that isn’t the only issue - for an arbitry example drawing a dot with glVertex2i(10, canvas.getsize().height) should, in theory draw dot in a position 10 pixels from the left (yes, this is ok) and at the very top of the canvas - but it displays at a point 60 or so pixels from the top of the canvas - to draw it at the top I would need to do glVertex2i(10, canvas.getsize.height+60). But my mouse click events report the coordinates exactly as I would expect them (0,0 is right in the top leftmost corner of the canvas - 60 pixels above canvas.getsize().y. The difference is not consistent when my frame is resized either, so if I shrink the frame the gap may change from 60 pixels difference to 30 pixels etc, which means I may have to write some complicated code to map my mouse click coordinates to the GLCanvas coordinates.
Just wondered if anybody else had experienced this issue and if there is an easy solution to it.
Regards,
Sally