diff options
author | mwturvey <michael.w.turvey@intel.com> | 2017-03-23 09:56:33 -0700 |
---|---|---|
committer | mwturvey <michael.w.turvey@intel.com> | 2017-03-23 09:56:33 -0700 |
commit | 78b7b6fb520c287caecbe895501898ef5c1440a5 (patch) | |
tree | a72988c97dfc7e724661d0dbed1699f76e9f6498 /redist/CNFGFunctions.c | |
parent | 280a6599fea76a7d2c16cfe0fcc5c8f37fde66de (diff) | |
parent | 39ef5af74702c8825a82f65cf68e6af875a814ee (diff) | |
download | libsurvive-78b7b6fb520c287caecbe895501898ef5c1440a5.tar.gz libsurvive-78b7b6fb520c287caecbe895501898ef5c1440a5.tar.bz2 |
Merge branch 'master' into alternate_disambiguator
# Conflicts:
# src/survive_data.c
# src/survive_vive.c
Diffstat (limited to 'redist/CNFGFunctions.c')
-rw-r--r-- | redist/CNFGFunctions.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/redist/CNFGFunctions.c b/redist/CNFGFunctions.c index 947456f..25e9298 100644 --- a/redist/CNFGFunctions.c +++ b/redist/CNFGFunctions.c @@ -270,3 +270,89 @@ void CNFGDrawTextbox( int x, int y, const char * text, int textsize ) CNFGPenY = y + textsize; CNFGDrawText( text, textsize ); } + + +#ifdef CNFGOGL + +#ifdef _MSC_VER +#include <windows.h> +#pragma comment( lib, "OpenGL32.lib" ) +#endif +#include <GL/gl.h> + +uint32_t CNFGColor( uint32_t RGB ) +{ + unsigned char red = RGB & 0xFF; + unsigned char grn = ( RGB >> 8 ) & 0xFF; + unsigned char blu = ( RGB >> 16 ) & 0xFF; + glColor3ub( red, grn, blu ); +} + +void CNFGClearFrame() +{ + short w, h; + unsigned char red = CNFGBGColor & 0xFF; + unsigned char grn = ( CNFGBGColor >> 8 ) & 0xFF; + unsigned char blu = ( CNFGBGColor >> 16 ) & 0xFF; + glClearColor( red/255.0, grn/255.0, blu/255.0, 1.0 ); + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + CNFGGetDimensions( &w, &h ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glViewport( 0, 0, w, h ); + glOrtho( 0, w, h, 0, 1, -1 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + + +void CNFGTackSegment( short x1, short y1, short x2, short y2 ) +{ + if( x1 == x2 && y1 == y2 ) + { + glBegin( GL_POINTS ); + glVertex2f( x1+.5, y1+.5 ); + glEnd(); + } + else + { + glBegin( GL_LINES ); + glVertex2f( x1+.5, y1+.5 ); + glVertex2f( x2+.5, y2+.5 ); + glEnd(); + } +} + +void CNFGTackPixel( short x1, short y1 ) +{ + glBegin( GL_POINTS ); + glVertex2f( x1, y1 ); + glEnd(); +} + +void CNFGTackRectangle( short x1, short y1, short x2, short y2 ) +{ + glBegin( GL_QUADS ); + glVertex2f( x1, y1 ); + glVertex2f( x2, y1 ); + glVertex2f( x2, y2 ); + glVertex2f( x1, y2 ); + glEnd(); +} + +void CNFGTackPoly( RDPoint * points, int verts ) +{ + int i; + glBegin( GL_TRIANGLE_FAN ); + glVertex2f( points[0].x, points[0].y ); + for( i = 1; i < verts; i++ ) + { + glVertex2f( points[i].x, points[i].y ); + } + glEnd(); +} + +void CNFGInternalResize( short x, short y ) { } + + +#endif |