3 This file is part of gldbg
4 Copyright © 2009 Mikko Rasa, Mikkosoft Productions
5 Distributed under the GPL
13 typedef struct sGlPrintData
19 static void init_print(GlDecoder *);
20 static void glprint_data_free(void *);
21 static void print_gldError(void *, GLenum);
23 GlDecoder *glprint_new(char *buffer, unsigned bufsize)
28 gpd = (GlPrintData *)malloc(sizeof(GlPrintData));
30 gpd->bufsize = bufsize;
35 gpd->buffer = (char *)malloc(gpd->bufsize);
36 dec = gldecoder_new(gpd, glprint_data_free);
39 dec = gldecoder_new(gpd, free);
42 dec->gldError = print_gldError;
47 char *glprint_get_buffer(GlDecoder *dec)
49 return ((GlPrintData *)dec->user_data)->buffer;
52 static void glprint_data_free(void *data)
54 GlPrintData *gpd = (GlPrintData *)data;
59 static void print_gldError(void *user_data, GLenum code)
61 GlPrintData *gpd = (GlPrintData *)user_data;
62 snprintf(gpd->buffer, gpd->bufsize, "ERROR: %s", describe_enum(code, "ErrorCode"));
65 #include "glprint.funcs"