| OLD | NEW |
| (Empty) |
| 1 // | |
| 2 // Book: OpenGL(R) ES 2.0 Programming Guide | |
| 3 // Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner | |
| 4 // ISBN-10: 0321502795 | |
| 5 // ISBN-13: 9780321502797 | |
| 6 // Publisher: Addison-Wesley Professional | |
| 7 // URLs: http://safari.informit.com/9780321563835 | |
| 8 // http://www.opengles-book.com | |
| 9 // | |
| 10 | |
| 11 // ESUtil.c | |
| 12 // | |
| 13 // A utility library for OpenGL ES. This library provides a | |
| 14 // basic common framework for the example applications in the | |
| 15 // OpenGL ES 2.0 Programming Guide. | |
| 16 // | |
| 17 | |
| 18 /// | |
| 19 // Includes | |
| 20 // | |
| 21 #include <stdio.h> | |
| 22 #include <stdlib.h> | |
| 23 #include <stdarg.h> | |
| 24 #include <string.h> | |
| 25 | |
| 26 #include <GLES2/gl2.h> | |
| 27 | |
| 28 #include "esUtil.h" | |
| 29 #include "esUtil_win.h" | |
| 30 | |
| 31 /// | |
| 32 // esInitContext() | |
| 33 // | |
| 34 // Initialize ES utility context. This must be called before calling any o
ther | |
| 35 // functions. | |
| 36 // | |
| 37 void esInitContext ( ESContext *esContext ) | |
| 38 { | |
| 39 if ( esContext != NULL ) | |
| 40 { | |
| 41 memset( esContext, 0, sizeof( ESContext) ); | |
| 42 } | |
| 43 } | |
| 44 | |
| 45 /// | |
| 46 // esLogMessage() | |
| 47 // | |
| 48 // Log an error message to the debug output for the platform | |
| 49 // | |
| 50 void esLogMessage ( const char *formatStr, ... ) | |
| 51 { | |
| 52 va_list params; | |
| 53 char buf[BUFSIZ]; | |
| 54 | |
| 55 va_start ( params, formatStr ); | |
| 56 vsprintf_s ( buf, sizeof(buf), formatStr, params ); | |
| 57 | |
| 58 printf ( "%s", buf ); | |
| 59 | |
| 60 va_end ( params ); | |
| 61 } | |
| 62 | |
| 63 /// | |
| 64 // esLoadTGA() | |
| 65 // | |
| 66 // Loads a 24-bit TGA image from a file | |
| 67 // | |
| 68 char* esLoadTGA ( char *fileName, int *width, int *height ) | |
| 69 { | |
| 70 char *buffer; | |
| 71 | |
| 72 if ( WinTGALoad ( fileName, &buffer, width, height ) ) | |
| 73 { | |
| 74 return buffer; | |
| 75 } | |
| 76 | |
| 77 return NULL; | |
| 78 } | |
| OLD | NEW |