OpenGL-GLFW
view release on metacpan or search on metacpan
// for (n=0; n<numimages; n++) {
// printf("images[%d].width = %d\n", n, images[n]->width);
// printf("images[%d].height = %d\n", n, images[n]->height);
// printf("images[%d].pixels = %p\n", n, images[n]->pixels);
// }
glfwSetWindowIcon(window, numimages, *images);
} else if (items > 10) {
croak("glfwSetWindowIcon got too many images (max is 10)\n");
}
#//-------------------------------------------------------------------
#// GLFWcursor routines
#//-------------------------------------------------------------------
#// GLFWcursor*
#// glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
GLFWcursor*
glfwCreateCursor(SV* image, int xhot, int yhot);
PREINIT:
GLFWimage imgstruct;
HV * imghv;
SV** svp;
int width, height;
unsigned char* pixels;
CODE:
if ( SvROK(image) && SvTYPE(SvRV(image))==SVt_PVHV) {
imghv = (HV *)SvRV(image);
}
if (svp = hv_fetch(imghv, "width", 5, 0))
imgstruct.width = width = SvIV(*svp);
if (svp = hv_fetch(imghv, "height", 6, 0))
imgstruct.height = height = SvIV(*svp);
if (svp = hv_fetch(imghv, "pixels", 6, 0))
imgstruct.pixels = pixels = (unsigned char *)SvPV_nolen(*svp);
RETVAL = glfwCreateCursor(&imgstruct, xhot, yhot);
OUTPUT:
RETVAL
GLFWcursor*
glfwCreateStandardCursor(int shape);
void
glfwDestroyCursor(GLFWcursor* cursor);
void
glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
#//-------------------------------------------------------------------
#// GLFWmonitor routines
#//-------------------------------------------------------------------
GLFWmonitor*
glfwGetPrimaryMonitor();
#// GLFWmonitor**
#// glfwGetMonitors(OUTLIST int count);
void
glfwGetMonitors();
PREINIT:
GLFWmonitor** monitors = NULL;
int n, count;
PPCODE:
monitors = glfwGetMonitors(&count);
printf("glfwGetMonitors() returns %d values\n",count);
for (n=0; n<count; n++)
XPUSHs(sv_2mortal(newRV_noinc(newSViv(PTR2IV(monitors+n)))));
const char*
glfwGetMonitorName(GLFWmonitor* monitor);
void
glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, OUTLIST int widthMM, OUTLIST int heightMM);
void
glfwGetMonitorPos(GLFWmonitor* monitor, OUTLIST int xpos, OUTLIST int ypos);
void
glfwGetMonitorWorkarea(GLFWmonitor* monitor, OUTLIST int xpos, OUTLIST int ypos, OUTLIST int width, OUTLIST int height);
void
glfwSetGamma(GLFWmonitor* monitor, float gamma);
#// const GLFWgammaramp*
HV*
glfwGetGammaRamp(GLFWmonitor* monitor);
PREINIT:
HV * hash;
const GLFWgammaramp * gramp = NULL;
CODE:
// get video mode
gramp = glfwGetGammaRamp(monitor);
if (!gramp) croak("null pointer as GLFWgammaramp");
// pack gammaramp into hash
hash = (HV*)sv_2mortal((SV*)newHV());
hv_store(hash, "size", 4, newSViv(gramp->size), 0); // implict
hv_store(hash, "red", 3, newSVpvn((char*)gramp->red, 2*gramp->size), 0);
hv_store(hash, "green", 5, newSVpvn((char*)gramp->green,2*gramp->size), 0);
hv_store(hash, "blue", 4, newSVpvn((char*)gramp->blue, 2*gramp->size), 0);
// return hash reference
RETVAL = hash;
OUTPUT:
RETVAL
#// void
#// glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void
glfwSetGammaRamp(GLFWmonitor* monitor, SV* ramp);
PREINIT:
GLFWgammaramp rampstruct;
HV * ramphv;
SV** svp;
int size;
CODE:
if ( SvROK(ramp) && SvTYPE(SvRV(ramp))==SVt_PVHV) {
ramphv = (HV *)SvRV(ramp);
}
if (svp = hv_fetch(ramphv, "size", 4, 0))
rampstruct.size = size = SvIV(*svp);
if (svp = hv_fetch(ramphv, "red", 3, 0))
rampstruct.red = (unsigned short *)SvPV_nolen(*svp);
if (svp = hv_fetch(ramphv, "green", 5, 0))
rampstruct.green = (unsigned short *)SvPV_nolen(*svp);
if (svp = hv_fetch(ramphv, "blue", 4, 0))
rampstruct.blue = (unsigned short *)SvPV_nolen(*svp);
glfwSetGammaRamp(monitor,&rampstruct);
#// const GLFWvidmode*
HV*
glfwGetVideoMode(GLFWmonitor* monitor);
PREINIT:
HV * hash;
const GLFWvidmode* vidm = NULL;
CODE:
// get video mode
vidm = glfwGetVideoMode(monitor);
if (!vidm) croak("null pointer as GLFWvidmode");
// pack vidmode into hash
hash = (HV*)sv_2mortal((SV*)newHV());
hv_store(hash, "width", 5, newSViv(vidm->width), 0);
hv_store(hash, "height", 6, newSViv(vidm->height), 0);
hv_store(hash, "redBits", 7, newSViv(vidm->redBits), 0);
hv_store(hash, "greenBits", 9, newSViv(vidm->greenBits), 0);
hv_store(hash, "blueBits", 8, newSViv(vidm->blueBits), 0);
hv_store(hash, "refreshRate", 11, newSViv(vidm->refreshRate), 0);
// return hash reference
RETVAL = hash;
OUTPUT:
RETVAL
#// const GLFWvidmode*
void
glfwGetVideoModes(GLFWmonitor* monitor);
PREINIT:
HV * hash;
const GLFWvidmode* vidms = NULL;
int nmodes = -1;
int n;
PPCODE:
// get video modes
vidms = glfwGetVideoModes(monitor,&nmodes);
if (!vidms) croak("null pointer as GLFWvidmode-s");
if (nmodes <= 0) croak("no GLFWvidmode-s returned");
for (n=0; n<nmodes; n++) {
// pack vidmode into hash
hash = (HV*)sv_2mortal((SV*)newHV());
hv_store(hash, "width", 5, newSViv((vidms+n)->width), 0);
hv_store(hash, "height", 6, newSViv((vidms+n)->height), 0);
hv_store(hash, "redBits", 7, newSViv((vidms+n)->redBits), 0);
hv_store(hash, "greenBits", 9, newSViv((vidms+n)->greenBits), 0);
hv_store(hash, "blueBits", 8, newSViv((vidms+n)->blueBits), 0);
hv_store(hash, "refreshRate", 11, newSViv((vidms+n)->refreshRate), 0);
// push onto output stack
XPUSHs( newRV_noinc((SV*)hash) );
}
#//-------------------------------------------------------------------
#// GLFWmonitor with GLFWwindow routines
#//-------------------------------------------------------------------
GLFWmonitor*
glfwGetWindowMonitor(GLFWwindow* window);
GLFWwindow*
glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
void
glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
#//-------------------------------------------------------------------
#// GLFWwindow routines
#//-------------------------------------------------------------------
GLFWwindow*
glfwGetCurrentContext();
int
glfwGetInputMode(GLFWwindow* window, int mode);
int
glfwGetKey(GLFWwindow* window, int key);
int
glfwGetMouseButton(GLFWwindow* window, int button);
int
glfwGetWindowAttrib(GLFWwindow* window, int attrib);
int
glfwWindowShouldClose(GLFWwindow* window);
void
glfwDestroyWindow(GLFWwindow* window);
void
glfwFocusWindow(GLFWwindow* window);
const char*
for (i=0; i<AVlen; i++)
av_store((AV*)upoint,i,&PL_sv_undef);
glfwSetWindowUserPointer(window,upoint);
RETVAL = &PL_sv_undef;
} else {
sav = av_fetch((AV*)upoint,userpointer,0);
RETVAL = newSVsv(*sav);
}
OUTPUT:
RETVAL
#//-------------------------------------------------------------------
#// Standard types routines
#//-------------------------------------------------------------------
void
glfwDefaultWindowHints();
void
glfwGetVersion(OUTLIST int major, OUTLIST int minor, OUTLIST int rev);
void
glfwPollEvents();
void
glfwPostEmptyEvent();
void
glfwSetTime(double time);
void
glfwSwapInterval(int interval);
void
glfwTerminate();
void
glfwWaitEvents();
void
glfwWaitEventsTimeout(double timeout);
void
glfwWindowHint(int hint, int value);
const char*
glfwGetJoystickName(int joy);
const char*
glfwGetKeyName(int key, int scancode);
const char*
glfwGetVersionString();
#// const float*
#// glfwGetJoystickAxes(int joy, OUTLIST int count);
void
glfwGetJoystickAxes(int joy);
PREINIT:
const float* axes = NULL;
int n, count;
PPCODE:
axes = glfwGetJoystickAxes(joy,&count);
printf("glfwGetJoystickAxes() returns %d values\n",count);
for (n=0; n<count; n++)
XPUSHs(sv_2mortal(newSVnv(*(axes+n))));
#// const unsigned char*
#// glfwGetJoystickButtons(int joy, OUTLIST int count);
void
glfwGetJoystickButtons(int joy);
PREINIT:
const unsigned char* buttons = NULL;
int n, count;
PPCODE:
buttons = glfwGetJoystickButtons(joy,&count);
printf("glfwGetJoystickButtons() returns %d values\n",count);
for (n=0; n<count; n++)
XPUSHs(sv_2mortal(newSViv(*(buttons+n))));
int
glfwInit();
int
glfwJoystickPresent(int joy);
double
glfwGetTime();
uint64_t
glfwGetTimerFrequency();
uint64_t
glfwGetTimerValue();
#if (GLFW_VERSION_MAJOR*10000 + GLFW_VERSION_MINOR*100) >= 30300
void
glfwRequestWindowAttention(GLFWwindow* window);
#endif
#if (GLFW_VERSION_MAJOR*10000 + GLFW_VERSION_MINOR*100) >= 30400
int
glfwPlatformSupported(int platform);
int
glfwGetPlatform();
#endif
void
glfwGetError();
PREINIT:
int errcode;
char* description;
PPCODE:
errcode = glfwGetError((const char**)&description);
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv(errcode)));
PUSHs(!description ? &PL_sv_undef : sv_2mortal(newSVpv(description, 0)));
void
glfwInitHint(int hint, int value);
#//-------------------------------------------------------------------
#// OpenGL not supported (use GLEW)
#//-------------------------------------------------------------------
int
glfwExtensionSupported(const char* extension);
CODE:
croak("glfwExtensionSupported not implemented (use glewIsSupported)");
void
glfwGetProcAddress(const char* procname);
CODE:
croak("glfwGetProcAddress not implemented (use GLEW)");
#//-------------------------------------------------------------------
#// Vulkan not supported
#//-------------------------------------------------------------------
int
glfwVulkanSupported();
CODE:
RETVAL = 0;
OUTPUT:
RETVAL
void
glfwGetRequiredInstanceExtensions(...)
CODE:
croak("No Vulkan Support: glfwGetRequiredInstanceExtensions not implemented!");
void
glfwGetInstanceProcAddress(...)
CODE:
croak("No Vulkan Support: glfwGetInstanceProcAddress not implemented!");
void
glfwGetPhysicalDevicePresentationSupport(...)
CODE:
croak("No Vulkan Support: glfwGetPhysicalDevicePresentationSupport not implemented!");
void
glfwCreateWindowSurface(...)
CODE:
croak("No Vulkan Support: glfwCreateWindowSurface not implemented!");
( run in 0.452 second using v1.01-cache-2.11-cpan-5511b514fd6 )