mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3459
This commit is contained in:
parent
d0cd37de2f
commit
4add3da6fa
|
@ -61,11 +61,10 @@ GRAPHICS_INFO gi;
|
|||
bool graphics_inited = false;
|
||||
|
||||
int boinc_init_graphics() {
|
||||
#ifdef HAVE_GL_LIB
|
||||
FILE* f;
|
||||
int retval;
|
||||
|
||||
f = boinc_file_exists(GRAPHICS_DATA_FILE)?boinc_fopen(GRAPHICS_DATA_FILE, "r"):0;
|
||||
f = boinc_fopen(GRAPHICS_DATA_FILE, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "boinc_init_graphics(): can't open graphics data file\n");
|
||||
fprintf(stderr, "boinc_init_graphics(): Using default graphics settings.\n");
|
||||
|
@ -148,10 +147,8 @@ int boinc_init_graphics() {
|
|||
#endif
|
||||
|
||||
graphics_inited = true;
|
||||
#else
|
||||
graphics_inited = false;
|
||||
#endif
|
||||
return !graphics_inited;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int boinc_finish_graphics() {
|
||||
|
@ -218,89 +215,4 @@ bool throttled_app_render(int x, int y, double t) {
|
|||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GL_LIB
|
||||
// Custom GL "Print" Routine
|
||||
GLvoid glPrint(GLuint font, const char *fmt, ...) {
|
||||
/*
|
||||
char text[256]; // Holds Our String
|
||||
va_list ap; // Pointer To List Of Arguments
|
||||
|
||||
if (fmt == NULL) // If There's No Text
|
||||
return; // Do Nothing
|
||||
|
||||
va_start(ap, fmt); // Parses The String For Variables
|
||||
vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers
|
||||
va_end(ap); // Results Are Stored In Text
|
||||
|
||||
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
|
||||
glListBase(font); // Sets The Base Character
|
||||
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text
|
||||
glPopAttrib(); // Pops The Display List Bits
|
||||
*/
|
||||
}
|
||||
|
||||
// All Setup For OpenGL Goes Here
|
||||
//
|
||||
GLenum InitGL(GLvoid) {
|
||||
GLenum err;
|
||||
|
||||
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glShadeModel Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glClearColor Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
glClearDepth(1.0f); // Depth Buffer Setup
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glClearDepth Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glEnable Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glDepthFunc Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
|
||||
err = glGetError();
|
||||
if (err) {
|
||||
fprintf(stderr, "glHint Error: %d '%s'", err, gluErrorString(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
return GL_NO_ERROR; // Initialization Went OK
|
||||
}
|
||||
|
||||
// Resize And Initialize The GL Window
|
||||
//
|
||||
GLenum ReSizeGLScene(GLsizei width, GLsizei height) {
|
||||
GLenum err;
|
||||
glViewport(0,0,(int)width,(int)(height));
|
||||
|
||||
err = glGetError();
|
||||
if (err) return err;
|
||||
|
||||
app_graphics_resize(width,height);
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,84 +1,10 @@
|
|||
#ifndef BOINC_GRAPHICS_API_H
|
||||
#define BOINC_GRAPHICS_API_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef HAVE_GL_LIB
|
||||
#define HAVE_GL_LIB 1
|
||||
#endif
|
||||
#ifndef HAVE_GL_GL_H
|
||||
#define HAVE_GL_GL_H 1
|
||||
#endif
|
||||
#ifndef HAVE_GL_GLU_H
|
||||
#define HAVE_GL_GLU_H 1
|
||||
#endif
|
||||
#ifndef HAVE_GL_GLAUX_H
|
||||
#define HAVE_GL_GLAUX_H 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE_CC__
|
||||
#ifndef HAVE_GL_LIB
|
||||
#define HAVE_GL_LIB 1
|
||||
#endif
|
||||
#ifndef HAVE_OPENGL_GL_H
|
||||
#define HAVE_OPENGL_GL_H
|
||||
#endif
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GL_H
|
||||
#include <gl.h>
|
||||
#elif defined(HAVE_GL_GL_H)
|
||||
#include <GL/gl.h>
|
||||
#elif defined(HAVE_OPENGL_GL_H)
|
||||
#include <OpenGL/gl.h>
|
||||
#elif defined(HAVE_MESAGL_GL_H)
|
||||
#include <MesaGL/gl.h>
|
||||
#else
|
||||
#error No gl.h
|
||||
#endif
|
||||
#ifdef HAVE_GLU_H
|
||||
#include <glu.h>
|
||||
#elif defined(HAVE_GL_GLU_H)
|
||||
#include <GL/glu.h>
|
||||
#elif defined(HAVE_OPENGL_GLU_H)
|
||||
#include <OpenGL/glu.h>
|
||||
#elif defined(HAVE_MESAGL_GLU_H)
|
||||
#include <MesaGL/glu.h>
|
||||
#endif
|
||||
#ifdef HAVE_GLUT_H
|
||||
#include <glut.h>
|
||||
#elif defined(HAVE_GL_GLUT_H)
|
||||
#include <GL/glut.h>
|
||||
#elif defined(HAVE_OPENGL_GLUT_H)
|
||||
#include <OpenGL/glut.h>
|
||||
#elif defined(HAVE_MESAGL_GLUT_H)
|
||||
#include <MesaGL/glut.h>
|
||||
#elif defined(HAVE_GLUT_GLUT_H)
|
||||
#include <GLUT/glut.h>
|
||||
#endif
|
||||
#ifdef HAVE_GLAUX_H
|
||||
#include <glaux.h>
|
||||
#elif defined(HAVE_GL_GLAUX_H)
|
||||
#include <GL/glaux.h>
|
||||
#elif defined(HAVE_OPENGL_GLAUX_H)
|
||||
#include <OpenGL/glaux.h>
|
||||
#elif defined(HAVE_MESAGL_GLAUX_H)
|
||||
#include <MesaGL/glaux.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GL_LIB) && defined(HAVE_X11)
|
||||
#include "x_opengl.h"
|
||||
#endif
|
||||
|
||||
// The API (functions called by the app)
|
||||
extern int boinc_init_graphics();
|
||||
extern int boinc_finish_graphics();
|
||||
|
||||
#ifdef HAVE_GL_LIB
|
||||
extern GLvoid glPrint(GLuint font, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
// Functions that must be supplied by the app
|
||||
//
|
||||
extern void app_graphics_render(int xs, int ys, double time_of_day);
|
||||
|
@ -94,8 +20,6 @@ extern void app_graphics_resize(int width, int height);
|
|||
//
|
||||
extern double boinc_max_fps;
|
||||
extern double boinc_max_gfx_cpu_frac;
|
||||
extern GLenum InitGL(GLvoid);
|
||||
extern GLenum ReSizeGLScene(GLsizei width, GLsizei height);
|
||||
extern bool throttled_app_render(int, int, double);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -282,7 +282,7 @@ LRESULT CALLBACK WndProc(
|
|||
} else {
|
||||
visible = TRUE;
|
||||
}
|
||||
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));
|
||||
app_graphics_resize(LOWORD(lParam), HIWORD(lParam));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ BOOL VerifyPassword(HWND hwnd)
|
|||
return bres;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
float txt_widths[256];
|
||||
|
||||
unsigned int MyCreateFont(char *fontName, int Size, int weight) {
|
||||
|
@ -456,3 +456,4 @@ unsigned int MyCreateFont(char *fontName, int Size, int weight) {
|
|||
float get_char_width(unsigned char c) {
|
||||
return txt_widths[c];
|
||||
}
|
||||
#endif
|
|
@ -12748,3 +12748,13 @@ David May 27 2004
|
|||
|
||||
sched/
|
||||
start
|
||||
|
||||
David May 27 2004
|
||||
- The BOINC app graphics framework does not use
|
||||
(or require the use of) OpenGL.
|
||||
Get rid of all OpenGL stuff in the code.
|
||||
Note: windows_opengl.C is misnamed.
|
||||
|
||||
api/
|
||||
graphics_api.C,h
|
||||
windows_opengl.C
|
||||
|
|
Loading…
Reference in New Issue