Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/library_sdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3330,7 +3330,8 @@ var LibrarySDL = {
// SDL 2

SDL_GL_ExtensionSupported__proxy: 'sync',
SDL_GL_ExtensionSupported: (extension) => Module.ctx.getExtension(extension) | 0,
SDL_GL_ExtensionSupported__deps: ['$GLctx', '$UTF8ToString'],
SDL_GL_ExtensionSupported: (extension) => GLctx?.getExtension(UTF8ToString(extension)) ? 1 : 0,

SDL_DestroyWindow: (window) => {},

Expand Down
32 changes: 32 additions & 0 deletions test/browser/test_sdl_gl_extensions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "SDL/SDL.h"
#include "SDL/SDL_opengl.h"

#include <stdio.h>
#include <string.h>
#include <assert.h>

int main(int argc, char *argv[]) {
SDL_Surface *screen;

assert(SDL_Init(SDL_INIT_VIDEO) == 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
screen = SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL);
assert(screen);

char *extensions = (char*)glGetString(GL_EXTENSIONS);
printf("extensions: %s\n", extensions);
assert(extensions);

int supported = SDL_GL_ExtensionSupported("foobar");
assert(!supported);

char* end = strchr(extensions, ' ');
*end = '\0';
printf("testing for extension: %s\n", extensions);
supported = SDL_GL_ExtensionSupported(extensions);
printf("supported: %d\n", supported);
assert(supported);

SDL_Quit();
return 0;
}
4 changes: 4 additions & 0 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,10 @@ def test_sdl_canvas_size(self):
args=['-O2', '--minify=0', '--shell-file',
test_file('browser/test_sdl_canvas_size.html'), '-lSDL', '-lGL'])

@requires_graphics_hardware
def test_sdl_gl_extensions(self):
self.btest_exit('test_sdl_gl_extensions.c', args=['-lSDL', '-lGL'])

@requires_graphics_hardware
def test_sdl_gl_read(self):
# SDL, OpenGL, readPixels
Expand Down
Loading