19 unsigned char *
data,
bool is2D) {
21 unsigned char *tarData;
22 unsigned char *srcData;
30 glEnable(GL_TEXTURE_2D);
31 glShadeModel(GL_FLAT);
32 glEnable(GL_DEPTH_TEST);
33 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
34 glGenTextures(1, &t->
id);
35 if (glGetError() != GL_NO_ERROR) {
37 while (glGetError() != GL_NO_ERROR);
40 glBindTexture(GL_TEXTURE_2D, t->
id);
41 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
42 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
43 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
45 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
47 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0,
48 GL_RGBA, GL_UNSIGNED_BYTE,
data);
49 glDisable(GL_TEXTURE_2D);
56 sizeof(
unsigned char));
59 for (ind = 0; ind < height; ind++) {
60 srcData =
data + (height - 1 - ind) *
offset * width;
62 memcpy(tarData, srcData, 4 * (
unsigned)width);
72 t->
width = (float)width;
79 s->textures[
s->textureCount - 1] = t;
102 int Er, width, height;
104 cairo_surface_t *surface =
NULL;
112 for (
size_t ind = 0; ind <
s->textureCount; ind++) {
114 if (strcmp(def,
s->textures[ind]->def) == 0
116 && strcmp(text,
s->textures[ind]->text) == 0
117 &&
s->textures[ind]->fontSize==fs) {
118 s->textures[ind]->userCount++;
119 return s->textures[ind];
131 cairo_surface_destroy(surface);
glCompTex * glCompSetAddNewTexLabel(glCompSet *s, char *def, int fs, char *text, bool is2D)
glCompTex * glCompSetAddNewTexImage(glCompSet *s, int width, int height, unsigned char *data, bool is2D)
void glCompDeleteTexture(glCompTex *t)
static glCompTex * glCompSetAddNewTexture(glCompSet *s, int width, int height, unsigned char *data, bool is2D)
unsigned char * glCompCreatePangoTexture(char *fontdescription, int fontsize, char *txt, cairo_surface_t *surface, int *w, int *h)