Mercurial > pub > dyncall > bindings
diff R/rdyncall/demo/gles.R @ 0:0cfcc391201f
initial from svn dyncall-1745
author | Daniel Adler |
---|---|
date | Thu, 19 Mar 2015 22:26:28 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/R/rdyncall/demo/gles.R Thu Mar 19 22:26:28 2015 +0100 @@ -0,0 +1,43 @@ +library(rdyncall) +dynport(SDL) +dynport(EGL) +dynbind("X11", "XOpenDisplay(Z)p;") + +init <- function() { +SDL_Init(SDL_INIT_VIDEO) +srf <- SDL_SetVideoMode(640,480,32,SDL_SWSURFACE) +dpy <- XOpenDisplay(NULL) +egl <- eglGetDisplay(dpy) +if (is.nullptr(egl)) { + error("failed: eglGetDisplay") +} +status <- eglInitialize(egl,NULL,NULL) +if (!status) { + error("failed: eglInitialize") +} +numConfigOuts <- integer(1) +g_configAttribs <- as.integer(c( + EGL_RED_SIZE, 5, + EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, + EGL_DEPTH_SIZE, 16, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, + EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE, + EGL_NONE +)) + +g_eglConfig <- raw(4) + +s <- eglChooseConfig(egl, g_configAttribs, g_eglConfig, 1, numConfigOuts) +if (s != EGL_TRUE || numConfigOuts == 0) { + error("failed: eglChooseConfig") +} + + +} + +init() + + +