comparison src/video/SDL_renderer_gl.c @ 2918:bd518fc76f28

Updated to build on Windows
author Sam Lantinga <slouken@libsdl.org>
date Thu, 25 Dec 2008 05:11:29 +0000
parents 133601e3b255
children dc4523c7c22d
comparison
equal deleted inserted replaced
2917:4cecb110195d 2918:bd518fc76f28
517 static GLuint 517 static GLuint
518 compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code) 518 compile_shader(GL_RenderData * data, GLenum shader_type, const char *_code)
519 { 519 {
520 const int have_texture_rects = data->GL_ARB_texture_rectangle_supported; 520 const int have_texture_rects = data->GL_ARB_texture_rectangle_supported;
521 const char *replacement = have_texture_rects ? "RECT" : "2D"; 521 const char *replacement = have_texture_rects ? "RECT" : "2D";
522 const size_t replacementlen = strlen(replacement); 522 const size_t replacementlen = SDL_strlen(replacement);
523 const char *token = "%TEXTURETARGET%"; 523 const char *token = "%TEXTURETARGET%";
524 const size_t tokenlen = strlen(token); 524 const size_t tokenlen = SDL_strlen(token);
525 char *code = NULL; 525 char *code = NULL;
526 char *ptr = NULL; 526 char *ptr = NULL;
527 GLuint program = 0; 527 GLuint program = 0;
528 528
529 /* 529 /*
534 code = SDL_strdup(_code); 534 code = SDL_strdup(_code);
535 if (code == NULL) 535 if (code == NULL)
536 return 0; 536 return 0;
537 537
538 for (ptr = SDL_strstr(code, token); ptr; ptr = SDL_strstr(ptr + 1, token)) { 538 for (ptr = SDL_strstr(code, token); ptr; ptr = SDL_strstr(ptr + 1, token)) {
539 memcpy(ptr, replacement, replacementlen); 539 SDL_memcpy(ptr, replacement, replacementlen);
540 memmove(ptr + replacementlen, ptr + tokenlen, 540 SDL_memmove(ptr + replacementlen, ptr + tokenlen,
541 strlen(ptr + tokenlen) + 1); 541 SDL_strlen(ptr + tokenlen) + 1);
542 } 542 }
543 543
544 #if DEBUG_PROGRAM_COMPILE 544 #if DEBUG_PROGRAM_COMPILE
545 printf("compiling shader:\n%s\n\n", code); 545 printf("compiling shader:\n%s\n\n", code);
546 #endif 546 #endif