009
10.12.2004, 11:03 Uhr
CaesarCortezz
minderer Student
|
uff ok:
C++: |
// hier stand mal Standard Zeug
GLuint base; float fps; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); GLvoid BuildFont(GLvoid) { HFONT font; HFONT oldfont; base=glGenLists(96); font = CreateFont( -24, 0, 0, 0, FW_BOLD, false, false, false, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH, "Courier New"); oldfont = (HFONT)SelectObject(hDC,font); wglUseFontBitmaps(hDC,32,96,base); SelectObject(hDC,oldfont); DeleteObject(font); } GLvoid KillFont(GLvoid) { glDeleteLists(base,96); } GLvoid glPrint(const char *fmt, ...) { char text[256]; va_list ap; if (fmt == NULL) return; va_start(ap, fmt); vsprintf(text, fmt, ap); va_end(ap); glPushAttrib(GL_LIST_BIT); glListBase(base - 32); glCallLists(strlen(text), GL_UNSIGNED_BYTE, text); glPopAttrib(); } GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { if (height==0) { height=1; } glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } int InitGL(GLvoid) { glShadeModel(GL_SMOOTH); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); BuildFont(); return TRUE; }
int DrawGLScene(GLvoid) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(0.0f,0.0f,-6.0f); glColor3f(1.3f,1.3f,0.0f); fps+=1; glRasterPos2f(-0.5f,0.0f); glPrint("Frames: %1.0f", fps); return TRUE; }
// und danach kommt das Fenster-Zeug (Standard NeHe) alles unwichtig bis auf killfont und die tastatureingaben usw...
|
so geschafft -- Thus spake the master programmer:
``When the program is being tested, it is too late to make design changes.'' |