|
From: Tapio V. <aa...@us...> - 2010-11-02 15:24:20
|
Module: performous
Branch: opengl2
Commit: 5b6dc1b3a2b0fdd8f8b915b39fab3662953efaba
Author: Tapio Vierros <tap...@gm...>
Date: Tue Nov 2 17:22:50 2010 +0200
Since ~everything is drawed with GL_TRIANGLE_STRIP, make that default for VertexArray::Draw().
---
game/dancegraph.cc | 6 +++---
game/glutil.hh | 8 +-------
game/guitargraph.cc | 14 +++++++-------
game/notegraph.cc | 2 +-
game/screen_sing.cc | 2 +-
game/screen_songs.cc | 10 +++++-----
game/surface.hh | 2 +-
7 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index cb7a657..ed1bf46 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -403,7 +403,7 @@ void DanceGraph::drawArrow(int arrow_i, Texture& tex, float x, float y, float sc
glutil::VertexArray va;
vertexPair(va, arrow_i, 0.0f, -arrowSize, ty1);
vertexPair(va, arrow_i, 0.0f, arrowSize, ty2);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
@@ -480,7 +480,7 @@ void DanceGraph::drawBeats(double time) {
va.Color(c); va.Normal(0.0f, 1.0f, 0.0f); va.TexCoord(0.0f, texCoord); va.Vertex(-w, time2y(tEnd));
va.Color(c); va.Normal(0.0f, 1.0f, 0.0f); va.TexCoord(1.0f, texCoord); va.Vertex(w, time2y(tEnd));
}
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
/// Draws a single note (or hold)
@@ -519,7 +519,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
vertexPair(va, arrow_i, x, yMid, 2.0f/3.0f, s);
// Draw middle
vertexPair(va, arrow_i, x, yBeg + 2*arrowSize, 1.0f/3.0f, s);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
// Draw begin
if (note.isHit && tEnd < 0.1) {
diff --git a/game/glutil.hh b/game/glutil.hh
index 44a2837..74e7d53 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -140,7 +140,7 @@ namespace glutil {
m_colors.push_back(c.a);
}
- void Draw(GLint mode) {
+ void Draw(GLint mode = GL_TRIANGLE_STRIP) {
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(m_dimension, GL_FLOAT, 0, &m_vertices.front());
if (m_texcoords.size()) {
@@ -164,12 +164,6 @@ namespace glutil {
}
VertexArray() {}
- ~VertexArray() {
- m_vertices.clear();
- m_normals.clear();
- m_texcoords.clear();
- m_colors.clear();
- }
};
/// easy line
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index e871412..e6e0cb8 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -826,7 +826,7 @@ void GuitarGraph::draw(double time) {
va.Normal(0.0f, 1.0f, 0.0f); va.Color(c); va.TexCoord(0.0f, texCoord); va.Vertex(-w, time2y(tEnd));
va.Normal(0.0f, 1.0f, 0.0f); va.Color(c); va.TexCoord(1.0f, texCoord); va.Vertex(w, time2y(tEnd));
}
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
// Draw the cursor
@@ -942,7 +942,7 @@ void GuitarGraph::draw(double time) {
va.TexCoord(1.0f, 1.0f); va.Color(c); va.Vertex(x + fretWid, time2y(0.0f), 0.0f);
va.TexCoord(0.0f, 0.0f); va.Color(c); va.Vertex(x - fretWid, time2y(0.0f), h);
va.TexCoord(1.0f, 0.0f); va.Color(c); va.Vertex(x + fretWid, time2y(0.0f), h);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
} else {
it = m_flames[fret].erase(it);
continue;
@@ -964,7 +964,7 @@ void GuitarGraph::draw(double time) {
va.Color(c); va.Vertex(x, y + maxsize);
va.Color(c); va.Vertex(x - thickness, y - maxsize);
va.Color(c); va.Vertex(x, y - maxsize);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
float error = m_errorMeter.get();
if (error != 0) {
@@ -979,7 +979,7 @@ void GuitarGraph::draw(double time) {
va.Color(c); va.Vertex(x, y1 + y);
va.Color(c); va.Vertex(x - thickness, y2 + y);
va.Color(c); va.Vertex(x, y2 + y);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
if (m_errorMeter.get() == m_errorMeter.getTarget())
m_errorMeter.setTarget(0.0);
@@ -1069,7 +1069,7 @@ void GuitarGraph::drawNote(int fret, Color color, float tBeg, float tEnd, float
y = yEnd + fretWid;
vertexPair(va, x, y, color, doanim ? tc(y + t) : 0.20f);
vertexPair(va, x, yEnd, color, doanim ? tc(yEnd + t) : 0.0f);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
} else {
// Too short note: only render the ring
if (m_use3d) { // 3D
@@ -1130,7 +1130,7 @@ void GuitarGraph::drawDrumfill(float tBeg, float tEnd) {
vertexPair(va, x, yEnd + 2.0 * fretWid, c, 0.25f);
}
vertexPair(va, x, yEnd, c, tcEnd); // Last vertex pair
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
@@ -1186,7 +1186,7 @@ void GuitarGraph::drawBar(double time, float h) {
va.Normal(0.0f, 1.0f, 0.0f); va.Vertex(-2.5f, time2y(time - h));
va.Normal(0.0f, 1.0f, 0.0f); va.Vertex(2.5f, time2y(time - h));
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
/// Create the Chord structures for the current track/difficulty level
diff --git a/game/notegraph.cc b/game/notegraph.cc
index d6cf465..d431be0 100644
--- a/game/notegraph.cc
+++ b/game/notegraph.cc
@@ -56,7 +56,7 @@ namespace {
va.TexCoord(1.0f, 0.0f); va.Vertex(x + w, yend);
va.TexCoord(1.0f, 1.0f); va.Vertex(x + w, yend + h);
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 0ab1f11..0e70d46 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -396,7 +396,7 @@ namespace {
va.Vertex(dim.x2(), dim.y1());
va.Vertex(dim.x1(), dim.y2());
va.Vertex(dim.x2(), dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index c46624d..9bbbc52 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -320,7 +320,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
x = dim.x1()+xincr*(dim.x2()-dim.x1());
va.Color(c); va.TexCoord(getIconTex(2), 0.0f); va.Vertex(x, dim.y1());
va.Color(c); va.TexCoord(getIconTex(2), 1.0f); va.Vertex(x, dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
{
// guitars
@@ -336,7 +336,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
x = dim.x1()+(2*xincr+i*0.04)*(dim.x2()-dim.x1());
va.Color(c); va.TexCoord(getIconTex(3), 0.0f); va.Vertex(x, dim.y1());
va.Color(c); va.TexCoord(getIconTex(3), 1.0f); va.Vertex(x, dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
{
@@ -351,7 +351,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
x = dim.x1()+3*xincr*(dim.x2()-dim.x1());
va.Color(c); va.TexCoord(getIconTex(4), 0.0f); va.Vertex(x, dim.y1());
va.Color(c); va.TexCoord(getIconTex(4), 1.0f); va.Vertex(x, dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
{
// drums
@@ -365,7 +365,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
x = dim.x1()+4*xincr*(dim.x2()-dim.x1());
va.Color(c); va.TexCoord(getIconTex(5), 0.0f); va.Vertex(x, dim.y1());
va.Color(c); va.TexCoord(getIconTex(5), 1.0f); va.Vertex(x, dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
{
// dancing
@@ -379,7 +379,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
x = dim.x1()+5*xincr*(dim.x2()-dim.x1());
va.Color(c); va.TexCoord(getIconTex(6), 0.0f); va.Vertex(x, dim.y1());
va.Color(c); va.TexCoord(getIconTex(6), 1.0f); va.Vertex(x, dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
}
diff --git a/game/surface.hh b/game/surface.hh
index dbb8e9b..9882a25 100644
--- a/game/surface.hh
+++ b/game/surface.hh
@@ -162,7 +162,7 @@ template <GLenum Type> void OpenGLTexture<Type>::draw(Dimensions const& dim, Tex
va.TexCoord(tex.x1, tex.y2); va.Vertex(dim.x1(), dim.y2());
va.TexCoord(tex.x2, tex.y2); va.Vertex(dim.x2(), dim.y2());
- va.Draw(GL_TRIANGLE_STRIP);
+ va.Draw();
}
template <GLenum Type> void OpenGLTexture<Type>::drawCropped(Dimensions const& orig, TexCoords const& tex) const {
|