2003-07-01 20:37:09 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
2003-05-20 00:03:39 +00:00
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
2003-07-01 20:37:09 +00:00
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
2003-05-20 00:03:39 +00:00
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
|
|
|
|
|
|
|
// various utility classes for OpenGL programming,
|
|
|
|
// used in Astropulse and SETI@home
|
|
|
|
// See also graphics_data.C,h
|
|
|
|
|
2003-01-29 21:13:15 +00:00
|
|
|
struct COLOR {
|
|
|
|
GLfloat r;
|
|
|
|
GLfloat g;
|
|
|
|
GLfloat b;
|
|
|
|
GLfloat a;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void HLStoRGB( double H, double L, double S, COLOR& c);
|
|
|
|
|
|
|
|
extern float frand();
|
|
|
|
|
|
|
|
extern void drawSphere(GLfloat* pos, GLfloat rad);
|
|
|
|
extern void drawCylinder(bool vertical, GLfloat* pos, GLfloat len, GLfloat rad);
|
|
|
|
|
|
|
|
#define TEXT_LEFT 0
|
|
|
|
#define TEXT_CENTER 1
|
|
|
|
#define TEXT_RIGHT 2
|
|
|
|
extern void draw_text_line(
|
|
|
|
GLfloat* pos, GLfloat height, GLfloat width, char *text,
|
|
|
|
int justify=TEXT_LEFT
|
|
|
|
);
|
2003-09-16 23:45:29 +00:00
|
|
|
|
|
|
|
void draw_text_simple(char* text,float line_width,float char_height);
|
|
|
|
|
2003-01-29 21:13:15 +00:00
|
|
|
extern void draw_text(
|
|
|
|
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text
|
|
|
|
);
|
2003-09-10 23:44:46 +00:00
|
|
|
|
2003-09-18 23:55:11 +00:00
|
|
|
extern void draw_text_new(
|
|
|
|
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text
|
|
|
|
);
|
|
|
|
|
2003-09-10 23:44:46 +00:00
|
|
|
extern void draw_rotated_text(
|
|
|
|
GLfloat* pos, GLfloat height, GLfloat width, GLfloat spacing, char *text, GLfloat rotation, GLfloat* rotation_vector
|
|
|
|
);
|
|
|
|
|
2003-01-29 21:13:15 +00:00
|
|
|
extern GLfloat text_width(char* text);
|
|
|
|
extern void draw_text_panel(
|
|
|
|
GLfloat* _pos, GLfloat* size, GLfloat margin, COLOR color,
|
|
|
|
GLfloat char_height, GLfloat line_width, GLfloat line_spacing,
|
2003-05-20 00:03:39 +00:00
|
|
|
char* text
|
|
|
|
);
|
2003-03-27 18:20:25 +00:00
|
|
|
|
2003-03-30 23:27:22 +00:00
|
|
|
extern void mode_texture();
|
2003-09-16 23:45:29 +00:00
|
|
|
extern void mode_ortho();
|
2003-03-27 18:20:25 +00:00
|
|
|
extern void mode_shaded(GLfloat*);
|
|
|
|
extern void mode_unshaded();
|
|
|
|
extern void mode_lines();
|
2003-09-16 23:45:29 +00:00
|
|
|
extern void ortho_done();
|
|
|
|
extern bool get_matrix_invert(float[16]);
|
2003-09-17 23:17:09 +00:00
|
|
|
extern bool get_matrix(double src[16]);
|
|
|
|
extern bool get_projection(double src[16]);
|
|
|
|
extern bool get_viewport(int view[4]);
|
|
|
|
extern void get_2d_positions(float p1,float p2,float p3,
|
|
|
|
double model[16], double proj[16], int viewport[4], double proj_pos[3]);
|
2003-03-27 18:20:25 +00:00
|
|
|
|
|
|
|
// draw a progress bar as an opaque cylinder within a translucent cylinder
|
|
|
|
//
|
|
|
|
class PROGRESS {
|
|
|
|
GLfloat pos[3];
|
|
|
|
GLfloat color[4], inner_color[4];
|
|
|
|
GLfloat len, rad, inner_rad;
|
|
|
|
public:
|
|
|
|
PROGRESS(GLfloat* pos, GLfloat len, GLfloat diam, GLfloat inner, GLfloat* c, GLfloat* ic);
|
|
|
|
void draw(float);
|
|
|
|
};
|
|
|
|
|
|
|
|
// draw a graph as a ribbon
|
|
|
|
//
|
|
|
|
class GRAPH_2D {
|
|
|
|
float pos[3], size[3];
|
|
|
|
float color[4], tick_color[4];
|
|
|
|
float *data, dmax;
|
|
|
|
int len;
|
|
|
|
void draw_x(int);
|
|
|
|
void draw_y(int);
|
|
|
|
public:
|
|
|
|
GRAPH_2D(float* pos, float* size, float* color, float* tick_color);
|
|
|
|
void draw(float* data, int len);
|
|
|
|
void add_tick(float x, float yfrac);
|
2003-03-28 18:30:39 +00:00
|
|
|
};
|
|
|
|
|
2003-05-20 00:03:39 +00:00
|
|
|
// read a portable pixmap file
|
|
|
|
//
|
2003-03-28 18:30:39 +00:00
|
|
|
extern int read_ppm(char* name, int& w, int& h, unsigned char** arrayp);
|
|
|
|
|
2003-06-17 22:57:47 +00:00
|
|
|
extern int init_texture(char* filename);
|
2003-05-20 00:03:39 +00:00
|
|
|
extern void draw_texture(float* pos, float* size);
|
|
|
|
|
2003-09-16 23:45:29 +00:00
|
|
|
//stars
|
|
|
|
struct Star
|
|
|
|
{
|
|
|
|
float x,y,z,v;
|
|
|
|
Star* next;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern void build_stars();
|
|
|
|
extern void update_stars();
|
|
|
|
extern void replaceStar(Star* tmpStar);
|
2003-09-17 23:17:09 +00:00
|
|
|
|
|
|
|
#include "jpeglib.h"
|
|
|
|
#include "bmplib.h"
|
|
|
|
#define MAX_TEXTURES 16
|
|
|
|
extern UINT g_Texture[MAX_TEXTURES];
|
|
|
|
extern bool CreateTextureJPG(UINT textureArray[], LPSTR strFileName, int textureID);
|
|
|
|
extern bool CreateTextureBMP(UINT textureArray[], LPSTR strFileName, int textureID);
|
|
|
|
extern bool CreateTexturePPM(UINT textureArray[], LPSTR strFileName, int textureID);
|
2003-09-18 23:55:11 +00:00
|
|
|
extern tImageJPG *LoadJPG(const char *filename);
|
|
|
|
extern void print_text(unsigned int base, char *string);
|
|
|
|
extern void MyCreateFont(unsigned int &base, char *fontName, int Size);
|