X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fopengl.hh;fp=src%2Fmoof%2Fopengl.hh;h=06ffbaa9866dec512ce397be6179ed867e0d06f5;hp=347f3e5bd55da409c47e32a0115ec65d43ae0ae8;hb=6f1b787a10d8ab1a3117a4b8c004dd2d90599608;hpb=c143f7e806766a73cd69dc6e084e977641019ce6 diff --git a/src/moof/opengl.hh b/src/moof/opengl.hh index 347f3e5..06ffbaa 100644 --- a/src/moof/opengl.hh +++ b/src/moof/opengl.hh @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include @@ -105,6 +107,36 @@ OPENGL_GENERIC_FUNC(void, Rect, S4); OPENGL_GENERIC_FUNC(void, Rect, V4); +inline void glMaterial(GLenum face, GLenum pname, moof::scalar s) +{ + glMaterialf(face, pname, float(s)); +} + +inline void glMaterial(GLenum face, GLenum pname, const moof::vector4& v) +{ +#if USE_DOUBLE_PRECISION + float f[] = {v[0], v[1], v[2], v[3]}; + glMaterialfv(face, pname, f); +#else + glMaterialfv(face, pname, v.data()); +#endif +} + +inline void glVertexPointer(const std::vector& v) +{ + glVertexPointer(3, GL_SCALAR, 0, v[0].data()); +} +inline void glTexCoordPointer(const std::vector& v) +{ + glTexCoordPointer(2, GL_SCALAR, 0, v[0].data()); +} + +inline void glDrawElements(GLenum type, const std::vector& v) +{ + glDrawElements(type, v.size(), GL_UNSIGNED_INT, &v[0]); +} + + #if USE_DOUBLE_PRECISION inline void glGetScalar(GLenum a, GLscalar* b) { glGetDoublev(a, b); } #else