parent
49d32a98c5
commit
e3db7749ba
5 changed files with 59 additions and 6 deletions
|
@ -163,7 +163,10 @@ static void Callback(void *user_data, Uint8 *stream_uint8, int len)
|
|||
BOOL AudioBackend_Init(void)
|
||||
{
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDL2 audio backend)", "'SDL_InitSubSystem(SDL_INIT_AUDIO)' failed", NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
puts("Available SDL2 audio drivers:");
|
||||
|
@ -185,7 +188,10 @@ BOOL AudioBackend_Init(void)
|
|||
output_frequency = obtained_specification.freq;
|
||||
|
||||
if (device_id == 0)
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDL2 audio backend)", "'SDL_OpenAudioDevice' failed", NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
SDL_PauseAudioDevice(device_id, 0);
|
||||
|
||||
|
|
|
@ -310,7 +310,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme
|
|||
{
|
||||
char buffer[0x200];
|
||||
glGetShaderInfoLog(vertex_shader, sizeof(buffer), NULL, buffer);
|
||||
printf("Vertex shader: %s", buffer);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Vertex shader error", buffer, window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme
|
|||
{
|
||||
char buffer[0x200];
|
||||
glGetShaderInfoLog(fragment_shader, sizeof(buffer), NULL, buffer);
|
||||
printf("Fragment shader: %s", buffer);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fragment shader error", buffer, window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ static GLuint CompileShader(const char *vertex_shader_source, const char *fragme
|
|||
{
|
||||
char buffer[0x200];
|
||||
glGetProgramInfoLog(program_id, sizeof(buffer), NULL, buffer);
|
||||
printf("Shader linker: %s", buffer);
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Shader linker error", buffer, window);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -455,13 +455,11 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
{
|
||||
#ifndef USE_OPENGLES2
|
||||
if (gladLoadGLLoader((GLADloadproc)SDL_GL_GetProcAddress))
|
||||
#endif
|
||||
{
|
||||
#ifndef USE_OPENGLES2
|
||||
// Check if the platform supports OpenGL 3.2
|
||||
if (GLAD_GL_VERSION_3_2)
|
||||
#endif
|
||||
{
|
||||
#endif
|
||||
#ifndef NDEBUG
|
||||
printf("GL_VENDOR = %s\n", glGetString(GL_VENDOR));
|
||||
printf("GL_RENDERER = %s\n", glGetString(GL_RENDERER));
|
||||
|
@ -552,15 +550,37 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
#ifndef USE_OPENGLES2
|
||||
glDeleteVertexArrays(1, &vertex_array_id);
|
||||
#endif
|
||||
#ifndef USE_OPENGLES2
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (OpenGL rendering backend)", "Your system does not support OpenGL 3.2", window);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (OpenGL rendering backend)", "Could not load OpenGL functions", window);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (OpenGL rendering backend)", "SDL_GL_MakeCurrent failed", window);
|
||||
}
|
||||
|
||||
SDL_GL_DeleteContext(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (OpenGL rendering backend)", "Could not create OpenGL context", window);
|
||||
}
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (OpenGL rendering backend)", "Could not create window", NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,15 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
|
||||
if (framebuffer.sdlsurface != NULL)
|
||||
return &framebuffer;
|
||||
else
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDLSurface rendering backend)", "Could not create framebuffer surface", window);
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDLSurface rendering backend)", "Could not create window", NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -110,12 +110,25 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
|
||||
return &framebuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDLTexture rendering backend)", "Could not create framebuffer", window);
|
||||
}
|
||||
|
||||
SDL_DestroyRenderer(renderer);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDLTexture rendering backend)", "Could not create renderer", window);
|
||||
}
|
||||
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (SDLTexture rendering backend)", "Could not create window", NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,17 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
|
||||
return &framebuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (software rendering backend)", "Could not create framebuffer surface", window);
|
||||
}
|
||||
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error (software rendering backend)", "Could not create window", NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue