mirror of https://github.com/BOINC/boinc.git
parent
08880e9c0e
commit
f15b50a7c5
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <afxwin.h>
|
#include <afxwin.h>
|
||||||
#include "glut.h"
|
|
||||||
#include <gl\gl.h> // Header File For The OpenGL32 Library
|
#include <gl\gl.h> // Header File For The OpenGL32 Library
|
||||||
#include <gl\glu.h> // Header File For The GLu32 Library
|
#include <gl\glu.h> // Header File For The GLu32 Library
|
||||||
#include <gl\glaux.h> // Header File For The Glaux Library
|
#include <gl\glaux.h> // Header File For The Glaux Library
|
||||||
|
@ -24,6 +23,10 @@ HINSTANCE hInstance; // Holds The Instance Of The Application
|
||||||
int mouse_thresh = 3;
|
int mouse_thresh = 3;
|
||||||
int initCursorPosx, initCursorPosy;
|
int initCursorPosx, initCursorPosy;
|
||||||
|
|
||||||
|
GLuint base; // Base Display List For The Font Set
|
||||||
|
GLfloat cnt1; // 1st Counter Used To Move Text & For Coloring
|
||||||
|
GLfloat cnt2; // 2nd Counter Used To Move Text & For Coloring
|
||||||
|
|
||||||
bool keys[256];
|
bool keys[256];
|
||||||
bool active=TRUE; // Window Active Flag Set To TRUE By Default
|
bool active=TRUE; // Window Active Flag Set To TRUE By Default
|
||||||
bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default
|
bool fullscreen=TRUE; // Fullscreen Flag Set To Fullscreen Mode By Default
|
||||||
|
@ -53,16 +56,55 @@ GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize Th
|
||||||
glLoadIdentity(); // Reset The Modelview Matrix
|
glLoadIdentity(); // Reset The Modelview Matrix
|
||||||
}
|
}
|
||||||
|
|
||||||
void renderBitmapString(
|
GLvoid BuildFont(GLvoid) // Build Our Bitmap Font
|
||||||
float x,
|
{
|
||||||
float y,
|
HFONT font; // Windows Font ID
|
||||||
void *font,
|
HFONT oldfont; // Used For Good House Keeping
|
||||||
char *string) {
|
|
||||||
char *c;
|
base = glGenLists(96); // Storage For 96 Characters
|
||||||
glRasterPos3f(x, y, -3);
|
|
||||||
for (c=string; *c != '\0'; c++) {
|
font = CreateFont( -24, // Height Of Font
|
||||||
glutBitmapCharacter(font, *c);
|
0, // Width Of Font
|
||||||
|
0, // Angle Of Escapement
|
||||||
|
0, // Orientation Angle
|
||||||
|
FW_BOLD, // Font Weight
|
||||||
|
FALSE, // Italic
|
||||||
|
FALSE, // Underline
|
||||||
|
FALSE, // Strikeout
|
||||||
|
ANSI_CHARSET, // Character Set Identifier
|
||||||
|
OUT_TT_PRECIS, // Output Precision
|
||||||
|
CLIP_DEFAULT_PRECIS, // Clipping Precision
|
||||||
|
ANTIALIASED_QUALITY, // Output Quality
|
||||||
|
FF_DONTCARE|DEFAULT_PITCH, // Family And Pitch
|
||||||
|
"Courier New"); // Font Name
|
||||||
|
|
||||||
|
oldfont = (HFONT)SelectObject(hDC, font); // Selects The Font We Want
|
||||||
|
wglUseFontBitmaps(hDC, 32, 96, base); // Builds 96 Characters Starting At Character 32
|
||||||
|
SelectObject(hDC, oldfont); // Selects The Font We Want
|
||||||
|
DeleteObject(font); // Delete The Font
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLvoid KillFont(GLvoid) // Delete The Font List
|
||||||
|
{
|
||||||
|
glDeleteLists(base, 96); // Delete All 96 Characters
|
||||||
|
}
|
||||||
|
|
||||||
|
GLvoid glPrint(const char *fmt, ...) // Custom GL "Print" Routine
|
||||||
|
{
|
||||||
|
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(base - 32); // Sets The Base Character to 32
|
||||||
|
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); // Draws The Display List Text
|
||||||
|
glPopAttrib(); // Pops The Display List Bits
|
||||||
}
|
}
|
||||||
|
|
||||||
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
|
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
|
||||||
|
@ -73,6 +115,7 @@ int InitGL(GLvoid) // All Setup For OpenGL Goes Here
|
||||||
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
|
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
|
||||||
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
|
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
|
||||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
|
||||||
|
BuildFont(); // Build The Font
|
||||||
return TRUE; // Initialization Went OK
|
return TRUE; // Initialization Went OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue