rendered paste body#include "Python.h"
#include "GL/gl.h"
#include "GL/glext.h"
//#include "cppgfx.h"
/*
#include <IL/il.h>
#include <IL/ilu.h>
#include <IL/ilut.h>
*/
static PyObject*
gfx_getMaxTextures(PyObject* self, PyObject* args)
{
GLint m;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &m);
return PyInt_FromLong(m);
};
static PyObject*
gfx_loadFonts(PyObject* self, PyObject* args)
{
//if (!loadFont())
//{
// PyErr_SetString(PyExc_RuntimeError, "c++ side loadFont returned error");
// return NULL;
//};
Py_RETURN_NONE;
};
static PyObject*
gfx_removeFonts(PyObject* self, PyObject* args)
{
//removeFonts();
Py_RETURN_NONE;
};
static PyObject*
gfx_renderString(PyObject* self, PyObject* args)
{
//const char* string;
//if (!PyArg_ParseTuple(args, "s", &string))
//{
// PyErr_SetString(PyExc_RuntimeError, "renderString expects one string as an argument");
// return NULL;
//};
//renderString(string);
Py_RETURN_NONE;
};
static PyObject*
gfx_stringExtents(PyObject* self, PyObject* args)
{
//const char* string;
//float llx, lly, urx, ury;
//if (!PyArg_ParseTuple(args, "s", &string))
//{
// PyErr_SetString(PyExc_RuntimeError, "stringExtents expects one string as an argument");
// return NULL;
//}
//stringExtents(string, &llx, &lly, &urx, &ury);
return Py_BuildValue("ffff", 0.0, 0.0, 0.0, 0.0);
};
/*
static PyObject*
gfx_initDevil(PyObject* self, PyObject* args)
{
ilInit();
iluInit();
ilutRenderer(ILUT_OPENGL);
Py_RETURN_NONE;
};
static PyObject*
gfx_initGlew(PyObject* self, PyObject* args)
{
glewInit();
Py_RETURN_NONE;
};
static PyObject*
gfx_loadImage(PyObject* self, PyObject* args)
{
char* filename;
unsigned int iid;
if (!PyArg_ParseTuple(args, "s", &filename))
{
PyErr_SetString(PyExc_RuntimeError, "loadImage expects one string as an argument");
return NULL;
};
ilGenImages(1, &iid);
ilBindImage(iid);
ilLoadImage(filename);
if (ilGetError() != IL_NO_ERROR)
{
PyErr_SetString(PyExc_RuntimeError, "ilLoadImage returned with error");
return NULL;
}
return Py_BuildValue("I", iid);
};
static PyObject*
gfx_deleteImage(PyObject* self, PyObject* args)
{
unsigned int iid;
if (!PyArg_ParseTuple(args, "I", &iid))
{
PyErr_SetString(PyExc_RuntimeError, "deleteImage expects one integer as an argument");
return NULL;
}
ilDeleteImages(1, &iid);
Py_RETURN_NONE;
};
static PyObject*
gfx_imgTexId(PyObject* self, PyObject* args)
{
unsigned int iid;
unsigned int tid;
if (!PyArg_ParseTuple(args, "I", &iid))
{
PyErr_SetString(PyExc_RuntimeError, "deleteImage expects one integer as an argument");
return NULL;
}
ilBindImage(iid);
tid = ilutGLBindMipmaps();
return Py_BuildValue("I", tid);
};
*/
static PyMethodDef gfxMethods[] = {
{"getMaxTextures", gfx_getMaxTextures, METH_VARARGS, "load fonts"},
{"loadFonts", gfx_loadFonts , METH_VARARGS, "load fonts"},
{"removeFonts", gfx_removeFonts , METH_VARARGS, "load fonts"},
{"renderString", gfx_renderString , METH_VARARGS, "load fonts"},
{"stringExtents", gfx_stringExtents , METH_VARARGS, "load fonts"},
/*
{"initGlew", gfx_initGlew , METH_VARARGS, "load fonts"},
{"initDevil", gfx_initDevil , METH_VARARGS, "load fonts"},
{"loadImage", gfx_loadImage , METH_VARARGS, "load fonts"},
{"deleteImage", gfx_deleteImage , METH_VARARGS, "load fonts"},
{"imgTexId", gfx_imgTexId , METH_VARARGS, "load fonts"},
*/
{NULL, NULL, 0, NULL}
};
PyMODINIT_FUNC
initgfx(void)
{
PyObject *m;
m = Py_InitModule("gfx", gfxMethods);
};