Hi
I’m pretty green when it comes to graphics programming, though I have played a little with java 2d previously.
Currently I’m writing an application that visualises the features and structures of DNA. I want to show coding regions and other features as boxes on a line. I have actually gotten this far, however I am wondering that I might be doing things in a not so optimal way.
I use GLCanvas, and an Animator. Each feature is identified with a start position (given in the number of the basepair at which it starts) and a stop position. The GLEventListener has a reference to an object that knows the interval of basepairs at which i am currently displaying.
The display() method does the following: Retrieve a list of in-range features, from a TreeMap. Draw rectangles on the screen, using the features’ starting and stopping position as x values, and constant y values. I translate from amount of basepairs to pixels using a zoom coefficient. Then I call gluOrtho2d to set the view, in case the user has shifted the view.
I have noticed that calling gluOrtho2d triggers a call to reshape(), which is partly why I’m wondering if I am doing it right. I also see some examples with source that uses gluLookAt to move the “camera”. But I haven’t had any luck using this in my 2d set up.
Anyway I will be thankful for any pointers on what I am doing wrong/right.
Thanks
Jorgen