mirror of https://github.com/BOINC/boinc.git
Added code for stars to Astropulse client
Added support for draw_rotated_text Changed axes drawing methods svn path=/trunk/boinc/; revision=2321
This commit is contained in:
parent
626ab44e15
commit
d1341edcec
18
api/gutil.C
18
api/gutil.C
|
@ -190,13 +190,14 @@ static void draw_text_line_aux(char *text) {
|
|||
|
||||
static void draw_text_start(GLfloat* pos, GLfloat char_height, GLfloat line_width) {
|
||||
glLineWidth(line_width);
|
||||
glPushMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(pos[0], pos[1], pos[2]);
|
||||
float w = char_height/STROKE_SCALE;
|
||||
glScalef(w, w, w);
|
||||
glScalef(w, w, w);
|
||||
|
||||
}
|
||||
|
||||
static void draw_text_end() {
|
||||
static void draw_text_end() {
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -228,6 +229,17 @@ void draw_text_line(
|
|||
draw_text_end();
|
||||
}
|
||||
|
||||
// draw rotated text
|
||||
void draw_rotated_text(
|
||||
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text,
|
||||
GLfloat rotation, GLfloat* rotation_vector)
|
||||
{
|
||||
draw_text_start(pos, height, width);
|
||||
glRotatef(rotation,rotation_vector[0],rotation_vector[1],rotation_vector[2]);
|
||||
draw_text_line_aux(text);
|
||||
draw_text_end();
|
||||
}
|
||||
|
||||
// draw multiple lines of text
|
||||
//
|
||||
void draw_text(
|
||||
|
|
|
@ -45,6 +45,11 @@ extern void draw_text_line(
|
|||
extern void draw_text(
|
||||
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text
|
||||
);
|
||||
|
||||
extern void draw_rotated_text(
|
||||
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text, GLfloat rotation, GLfloat* rotation_vector
|
||||
);
|
||||
|
||||
extern GLfloat text_width(char* text);
|
||||
extern void draw_text_panel(
|
||||
GLfloat* _pos, GLfloat* size, GLfloat margin, COLOR color,
|
||||
|
|
95
api/reduce.C
95
api/reduce.C
|
@ -258,7 +258,7 @@ void REDUCED_ARRAY::draw_row_quad(int row) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void REDUCED_ARRAY::draw_row_rect_x(int row) {
|
||||
void REDUCED_ARRAY::draw_row_rect_x(int row) {
|
||||
float z0 = draw_pos[2] + (draw_size[2]*row)/rdimy;
|
||||
float x0, x1, y0, y1;
|
||||
float* row0 = rrow(row);
|
||||
|
@ -394,7 +394,98 @@ void REDUCED_ARRAY::draw_part(double frac) {
|
|||
draw(0, nr);
|
||||
}
|
||||
|
||||
|
||||
void REDUCED_ARRAY::draw_axis_labels()
|
||||
{
|
||||
GLfloat char_height = .5f;
|
||||
GLfloat line_width = 3.0f;
|
||||
GLfloat spacing = 2.0f;
|
||||
GLfloat rotation = -90;
|
||||
GLfloat rotation_vector[3] = {0,0,0};
|
||||
|
||||
float w;
|
||||
|
||||
char* x_label = "Time";
|
||||
char* y_label = "Frequency";
|
||||
char* y_begin_label = "0";
|
||||
char* y_end_label = "9 Khz";
|
||||
|
||||
float x_text_pos[3] = {0,0,0};
|
||||
w = text_width(x_label);
|
||||
x_text_pos[0]=draw_pos[0]-.3;//+draw_size[0];
|
||||
x_text_pos[1]=draw_pos[1];//+draw_size[1];
|
||||
x_text_pos[2]=draw_pos[2]+draw_size[2]-(w/2.0f);
|
||||
|
||||
rotation_vector[0]=0;
|
||||
rotation_vector[1]=draw_size[1];
|
||||
rotation_vector[2]=0;
|
||||
|
||||
draw_rotated_text(x_text_pos,char_height,line_width,spacing,x_label,rotation,rotation_vector);
|
||||
//draw_text_line(x_text_pos,char_height,line_width,x_label,0);
|
||||
|
||||
}
|
||||
|
||||
void REDUCED_ARRAY::draw_axes() {
|
||||
|
||||
mode_unshaded();
|
||||
|
||||
glLineWidth(1.0);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glBegin(GL_LINES);
|
||||
glColor4d(1,1,1,.9);
|
||||
|
||||
//base square
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]);
|
||||
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
|
||||
//top square
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
//connecting lines
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]);
|
||||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]);
|
||||
glEnd();
|
||||
|
||||
//text
|
||||
|
||||
|
||||
|
||||
//mode_texture();
|
||||
|
||||
GLfloat violet[] = {0.6f, 0.3f, .8f, .7f};
|
||||
mode_shaded(violet);
|
||||
//mode_unshaded();
|
||||
//mode_lines();
|
||||
|
||||
/*
|
||||
glBegin(GL_QUADS);
|
||||
glColor3d(.2, .2, .2);
|
||||
|
||||
|
@ -403,4 +494,6 @@ void REDUCED_ARRAY::draw_axes() {
|
|||
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]);
|
||||
glEnd();
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -73,4 +73,5 @@ public:
|
|||
void draw_all();
|
||||
void draw_part(double frac);
|
||||
void draw_axes();
|
||||
void draw_axis_labels();
|
||||
};
|
||||
|
|
|
@ -85,7 +85,7 @@ void file_append(FILE* in, MFILE &out, int skip, int filenum) {
|
|||
#ifdef _WIN32
|
||||
#include <afxwin.h>
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) {
|
||||
LPWSTR command_line;
|
||||
LPWSTR command_line;
|
||||
LPWSTR *args;
|
||||
char* argv[100];
|
||||
int i, argc;
|
||||
|
|
Loading…
Reference in New Issue