Type RenderContext Field group:tgadget Field panel:tgadget Field hWnd Field hDC Field hRC Field FPS# Field FPSLastUpdateTime Field frames Method Render() 'Setup Viewport w=ClientWidth(group) h=ClientHeight(group) glViewport 0.0,0.0,w,h glClearColor 0.0,0.0,1.0,0.0 glClear GL_DEPTH_BUFFER_BIT+GL_COLOR_BUFFER_BIT glMatrixMode GL_PROJECTION glLoadIdentity() glPushMatrix() gluPerspective 45.0,Float(w)/Float(h),1.0,100.0 'Draw Triangle glBegin GL_TRIANGLES glVertex3f 0.0,0.0,-10.0 glVertex3f 1.0,1.0,-10.0 glVertex3f 1.0,0.0,-10.0 glEnd glpopmatrix() glLoadIdentity() glPushMatrix() glOrtho 0,w,h,0,-1,1 glRasterPos2f 1,13 s$=fps Local buffer@ Ptr=s.ToCString() glListBase(listBase) glCallLists(s.Length,GL_UNSIGNED_BYTE,buffer) MemFree(buffer) glpopmatrix() 'Flip buffer SwapBuffers hdc frames=frames+1 time=MilliSecs() elapsed=(time-FPSLastUpdateTime) If elapsed>1000 fps#=frames/(elapsed/1000.0) FPSLastUpdateTime=time frames=0 EndIf EndMethod EndType
Methods are ****ing awesome!
BlitzMax Forums/BlitzMax Beginners Area/Methods are ****ing awesome!The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.