diff --git a/api/gutil.C b/api/gutil.C index 0623f63460..02a4e62b00 100755 --- a/api/gutil.C +++ b/api/gutil.C @@ -119,6 +119,23 @@ void mode_ortho() { scale_screen(viewport[2],viewport[3]); } +void mode_ortho_ratio() { + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + gluOrtho2D(0,4,0,3); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + gluLookAt(0.0,0.0,1.0, // eye position + 0,0,0, // where we're looking + 0.0, 1.0, 0.); // up is in positive Y direction + int viewport[4]; + get_viewport(viewport); + center_screen_ratio(viewport[2],viewport[3]); + scale_screen(viewport[2],viewport[3]); +} + void ortho_done() { glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -340,6 +357,19 @@ void center_screen(int w,int h) } } +void center_screen_ratio(int w,int h) +{ + double aspect_ratio = 4.0/3.0; + if ((double)h*aspect_ratio > (double)w) + { + glTranslatef(0.0f*4.0f,(((double)h/2.0f-((double)w/aspect_ratio/2.0f))/(double)h)*3.0f,0.0f); + } + else + { + glTranslatef((((double)w/2.0f-((double)h*aspect_ratio/2.0f))/(double)w)*4.0f,0.0f,0.0f); + } +} + void drawSphere(GLfloat* pos, GLfloat rad) { GLUquadricObj* x = gluNewQuadric(); glPushMatrix(); diff --git a/api/gutil.h b/api/gutil.h index e09c6a02ea..32b36e485e 100755 --- a/api/gutil.h +++ b/api/gutil.h @@ -38,6 +38,7 @@ extern void set_viewport_full(int w, int h); extern void set_viewport_fixed(int w, int h); extern void scale_screen(int w,int h); extern void center_screen(int w,int h); +extern void center_screen_ratio(int w,int h); extern void drawSphere(float* pos, float rad); @@ -83,6 +84,7 @@ extern void draw_text_panel( extern void mode_texture(); extern void mode_ortho(); +extern void mode_ortho_ratio(); extern void mode_shaded(float*); extern void mode_unshaded(); extern void mode_lines(); diff --git a/checkin_notes b/checkin_notes index 73f44d4379..4bd6bc4d62 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7192,3 +7192,11 @@ Karl 2003-10-28 M lib/app_ipc.C M lib/app_ipc.h +Oliver 29 Oct 2003 + + - fixed improperly scaled logos + + api/ + gutil.C,h + +