}
+// this way of drawing characters, came from the red open gl book
const int PT = 1;
const int STROKE = 2;
const int END =3;
CP Xdata[] = {{ 0, 5, PT}, {5, -5,STROKE},{0,-5,PT},{5, 5, END}};
CP Ndata[] = {{ 0, -5, PT}, {0, 5, PT}, {5, -5, PT}, {5, 5, END}};
+//! the maximum width used for a charcter glyph
+const int max_glyph_width = 5;
+
static void drawLetter(CP *l, GLfloat z)
{
glBegin(GL_LINE_STRIP);
Sequence::const_iterator seq_itor = sequence_begin(left, right);
Sequence::const_iterator seq_end = sequence_end(left, right);
Sequence::size_type basepair = 0;
+ const float glyph_x_scale = 0.1;
+ const float glyph_margin = ((1.0 / glyph_x_scale) - max_glyph_width) / 4.0;
assert(seq_end - seq_itor >= 0);
while(seq_itor != seq_end)
{
assert ( basepair < seq->size() );
glPushMatrix();
- glTranslatef( seq_x+leftbase(left) + basepair, seq_y, 1.0 );
- glScalef(0.1, 1.0, 1.0);
+ glTranslatef( seq_x+leftbase(left) + basepair + glyph_margin, seq_y, 1.0 );
+ glScalef(glyph_x_scale, 1.0, 1.0);
switch (*seq_itor) {
case 'A': case 'a':
drawLetter(Adata, z);