this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added initialization (clearing) of new image in GPU_CreateImage() so it doesn't have arbitrary GPU garbage in it.

+18 -3
+18 -3
SDL_gpu/GL_common/SDL_gpu_GL_common.inl
··· 741 741 742 742 static void changeCamera(GPU_Target* target) 743 743 { 744 - GPU_CONTEXT_DATA* cdata = (GPU_CONTEXT_DATA*)GPU_GetContextTarget()->context->data; 744 + //GPU_CONTEXT_DATA* cdata = (GPU_CONTEXT_DATA*)GPU_GetContextTarget()->context->data; 745 745 746 746 //if(cdata->last_camera_target != target || !equal_cameras(cdata->last_camera, target->camera)) 747 747 { ··· 1600 1600 h = getNearestPowerOf2(h); 1601 1601 } 1602 1602 1603 - // Initialize texture 1603 + // Initialize texture using a blank buffer 1604 + static unsigned char* zero_buffer = NULL; 1605 + static unsigned int zero_buffer_size = 0; 1606 + if(zero_buffer_size < w*h*result->channels) 1607 + { 1608 + free(zero_buffer); 1609 + zero_buffer_size = w*h*result->channels; 1610 + zero_buffer = (unsigned char*)malloc(zero_buffer_size); 1611 + memset(zero_buffer, 0, zero_buffer_size); 1612 + } 1613 + 1614 + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 1615 + #ifdef SDL_GPU_USE_OPENGL 1616 + glPixelStorei(GL_UNPACK_ROW_LENGTH, w); 1617 + #endif 1618 + 1604 1619 glTexImage2D(GL_TEXTURE_2D, 0, internal_format, w, h, 0, 1605 - internal_format, GL_UNSIGNED_BYTE, NULL); 1620 + internal_format, GL_UNSIGNED_BYTE, zero_buffer); 1606 1621 // Tell SDL_gpu what we got. 1607 1622 result->texture_w = w; 1608 1623 result->texture_h = h;