From f030154fe727e25a2afe1f78b3998c2d2dba95e4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 18 Aug 2009 09:24:15 +0000 Subject: astyle cleanup, corrects not loading of material textures --- src/render/gl.cc | 111 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 44 deletions(-) (limited to 'src/render/gl.cc') diff --git a/src/render/gl.cc b/src/render/gl.cc index 31c473f..355efab 100644 --- a/src/render/gl.cc +++ b/src/render/gl.cc @@ -1,13 +1,14 @@ /* render/gl.cc - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 */ #include "render/gl.h" #include "math/matrix4f.h" -namespace gl { +namespace gl +{ using math::Vector2f; using math::Vector3f; @@ -15,31 +16,32 @@ using math::Color; std::string renderer() { - return std::string ((char *)glGetString(GL_RENDERER)); + return std::string((char *)glGetString(GL_RENDERER)); } std::string vendor() { - return std::string ((char *)glGetString(GL_VENDOR)); + return std::string((char *)glGetString(GL_VENDOR)); } std::string version() { - return std::string ((char *)glGetString(GL_VERSION)); + return std::string((char *)glGetString(GL_VERSION)); } std::string extensions() { - return std::string ((char *)glGetString(GL_EXTENSIONS)); + return std::string((char *)glGetString(GL_EXTENSIONS)); } -void begin(Primitive primitive) -{ - ::glBegin(primitive); +void begin(Primitive primitive) +{ + ::glBegin(primitive); } -void end() { - ::glEnd(); +void end() +{ + ::glEnd(); } void viewport(GLint x, GLint y, GLsizei width, GLsizei height) @@ -74,79 +76,96 @@ void blendfunc(GLenum sfactor, GLenum dfactor) } void enable(GLenum cap) -{ +{ glEnable(cap); } void disable(GLenum cap) -{ +{ glDisable(cap); } -void clear (GLbitfield mask) { +void clear(GLbitfield mask) +{ glClear(mask); } -void clearcolor(Color const & color) { +void clearcolor(Color const & color) +{ glClearColor(color.red(), color.green(), color.blue(), color.alpha()); } -void clearcolor(const float r, const float g, const float b, const float a) { - glClearColor(r,g,b, a); +void clearcolor(const float r, const float g, const float b, const float a) +{ + glClearColor(r, g, b, a); } -void rotate(const float angle, const Vector3f& vector) { - glRotatef(angle, vector[0], vector[1], vector[2]); +void rotate(const float angle, const Vector3f& vector) +{ + glRotatef(angle, vector[0], vector[1], vector[2]); } -void rotate(const float angle, const float x, const float y, const float z) { - glRotatef(angle, x, y, z); +void rotate(const float angle, const float x, const float y, const float z) +{ + glRotatef(angle, x, y, z); } -void translate(const Vector3f& vector) { - glTranslatef(vector[0], vector[1], vector[2]); +void translate(const Vector3f& vector) +{ + glTranslatef(vector[0], vector[1], vector[2]); } -void translate(const float x, const float y, const float z) { - glTranslatef(x, y, z); +void translate(const float x, const float y, const float z) +{ + glTranslatef(x, y, z); } -void scale(const Vector3f& vector) { - glScalef(vector[0], vector[1], vector[2]); +void scale(const Vector3f& vector) +{ + glScalef(vector[0], vector[1], vector[2]); } -void scale(const float x, const float y, const float z) { - glScalef(x, y, z); +void scale(const float x, const float y, const float z) +{ + glScalef(x, y, z); } -void vertex(const Vector2f& vector) { +void vertex(const Vector2f& vector) +{ glVertex2fv(vector.ptr()); } -void vertex(const float x, const float y) { +void vertex(const float x, const float y) +{ glVertex2f(x, y); } -void vertex(const Vector3f& vector) { +void vertex(const Vector3f& vector) +{ glVertex3fv(vector.ptr()); } -void vertex(const float x, const float y, const float z) { +void vertex(const float x, const float y, const float z) +{ glVertex3f(x, y, z); } -void normal(const Vector3f & vector) { +void normal(const Vector3f & vector) +{ glNormal3fv(vector.ptr()); } -void normal(const float x, const float y, const float z) { +void normal(const float x, const float y, const float z) +{ glNormal3f(x, y, z); } -void push() { +void push() +{ glPushMatrix(); } -void pop() { +void pop() +{ glPopMatrix(); } @@ -161,22 +180,26 @@ void multmatrix(const math::Axis & axis) glMultMatrixf(matrix.ptr()); } -void color(const float r, const float g, const float b, const float a) { - glColor4f(r,g,b,a); +void color(const float r, const float g, const float b, const float a) +{ + glColor4f(r, g, b, a); } -void color(Color const & color) { +void color(Color const & color) +{ glColor4fv(color.ptr()); } -void matrixmode(GLenum mode) { +void matrixmode(GLenum mode) +{ glMatrixMode(mode); } -void loadidentity() { +void loadidentity() +{ glLoadIdentity(); } -void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble znear, GLdouble zfar) +void frustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble znear, GLdouble zfar) { glFrustum(left, right, bottom, top, znear, zfar); } -- cgit v1.2.3