Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Goers <mega@osirion.org>2012-11-26 06:29:34 +0000
committerEvan Goers <mega@osirion.org>2012-11-26 06:29:34 +0000
commita3a57df0be5c9d1d4ebbd153cabadbca48d16e79 (patch)
treec745f693d46e4f966e9ebc478bf09da795144c2e /src/render/draw.cc
parentbc8fb513b967d9c4eaa5f478e112c7f479093bbf (diff)
Abstracted many more GL functions.
Added in useful texture unit info to State::init(). Cleaned up many non-abstracted GL functions used in draw.cc and state.cc.
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index dea0c6b..59f4a59 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -91,7 +91,7 @@ void pass_prepare(float seconds)
zone_ambient[i] = core::localplayer()->zone()->ambient_color()[i];
}
zone_ambient[3] = 1.0f;
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, zone_ambient);
+ gl::lightmodel(GL_LIGHT_MODEL_AMBIENT, zone_ambient);
// zone light sources
for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) {
@@ -249,13 +249,13 @@ void draw_globe_corona(const math::Vector3f location, const math::Color & color,
gl::color(drawcolor);
gl::begin(gl::Quads);
- glTexCoord2f(0, 1);
+ gl::texcoord(0, 1);
gl::vertex((Camera::axis().up() - Camera::axis().left()) * radius * 4.0f);
- glTexCoord2f(0, 0);
+ gl::texcoord(0, 0);
gl::vertex((Camera::axis().up() + Camera::axis().left()) * radius * 4.0f);
- glTexCoord2f(1, 0);
+ gl::texcoord(1, 0);
gl::vertex((Camera::axis().up() * -1 + Camera::axis().left()) * radius * 4.0f);
- glTexCoord2f(1, 1);
+ gl::texcoord(1, 1);
gl::vertex((Camera::axis().up() * -1 - Camera::axis().left()) * radius * 4.0f);
gl::end();
@@ -272,7 +272,7 @@ void draw_pass_globes()
{
// FIXME is this ever reset ?
GLfloat globe_specular[] = { 0.25f, 0.25f, 0.25f, 1.0f };
- glMaterialfv(GL_FRONT, GL_SPECULAR, globe_specular);
+ gl::material(GL_FRONT, GL_SPECULAR, globe_specular);
// Globes have to be rendered distance sorted, closest last.
// Globes behind farplane are rescaled and repositioned.
@@ -852,13 +852,13 @@ void draw_model_lights(model::Model *model, const float scale,
// draw the quad
gl::color(color);
- glTexCoord2f(1, 0);
+ gl::texcoord(1, 0);
gl::vertex(location + (Camera::axis().up() - Camera::axis().left()) * light_size);
- glTexCoord2f(0, 0);
+ gl::texcoord(0, 0);
gl::vertex(location + (Camera::axis().up() + Camera::axis().left()) * light_size);
- glTexCoord2f(0, 1);
+ gl::texcoord(0, 1);
gl::vertex(location + (Camera::axis().up() * -1 + Camera::axis().left()) * light_size);
- glTexCoord2f(1, 1);
+ gl::texcoord(1, 1);
gl::vertex(location + (Camera::axis().up() * -1 - Camera::axis().left()) * light_size);
Stats::quads++;
@@ -946,13 +946,13 @@ void draw_model_lights(model::Model *model, const float scale,
// draw the quad
gl::color(color);
- glTexCoord2f(1, 0);
+ gl::texcoord(1, 0);
gl::vertex(location + (flare_axis.up() + flare_axis.left()) * light_size);
- glTexCoord2f(0, 0);
+ gl::texcoord(0, 0);
gl::vertex(location + (flare_axis.up() - flare_axis.left()) * light_size);
- glTexCoord2f(0, 1);
+ gl::texcoord(0, 1);
gl::vertex(location + (flare_axis.up() * -1 - flare_axis.left()) * light_size);
- glTexCoord2f(1, 1);
+ gl::texcoord(1, 1);
gl::vertex(location + (flare_axis.up() * -1 + flare_axis.left()) * light_size);
Stats::quads++;
@@ -1096,7 +1096,7 @@ void draw(float seconds)
gl::disable(GL_DEPTH_TEST); // disable depth testing
gl::depthmask(GL_FALSE); // disable depth buffer writing
- glPolygonMode(GL_FRONT, GL_FILL);
+ gl::polygonmode(GL_FRONT, GL_FILL);
draw_pass_sky(); // draw the skybox
@@ -1124,20 +1124,20 @@ void draw(float seconds)
// Interleaved format is GL_T2F_N3F_V3F
// void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr )
- glTexCoordPointer(2, GL_FLOAT, 8 * sizeof(GLfloat), 0);
+ gl::texcoordpointer(2, GL_FLOAT, 8 * sizeof(GLfloat), 0);
// void glNormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
- glNormalPointer(GL_FLOAT, 8 * sizeof(GLfloat), (void*) (2 * sizeof(GLfloat)));
+ gl::normalpointer(GL_FLOAT, 8 * sizeof(GLfloat), (void*) (2 * sizeof(GLfloat)));
// void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
- glVertexPointer(3, GL_FLOAT, 8 * sizeof(GLfloat), (void*) (5 * sizeof(GLfloat)));
+ gl::vertexpointer(3, GL_FLOAT, 8 * sizeof(GLfloat), (void*) (5 * sizeof(GLfloat)));
} else {
- glInterleavedArrays(GL_T2F_N3F_V3F, 0, core::game()->vertexarray()->ptr());
+ gl::interleavedarrays(GL_T2F_N3F_V3F, 0, core::game()->vertexarray()->ptr());
}
// enable vertex arrays
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glEnableClientState(GL_NORMAL_ARRAY);
- glEnableClientState(GL_VERTEX_ARRAY);
+ gl::enableclientstate(GL_TEXTURE_COORD_ARRAY);
+ gl::enableclientstate(GL_NORMAL_ARRAY);
+ gl::enableclientstate(GL_VERTEX_ARRAY);
State::set_normalize(true);
@@ -1198,9 +1198,9 @@ void draw(float seconds)
}
}
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ gl::disableclientstate(GL_VERTEX_ARRAY);
+ gl::disableclientstate(GL_NORMAL_ARRAY);
+ gl::disableclientstate(GL_TEXTURE_COORD_ARRAY);
// draw physics
if (r_physics && r_physics->value()) {