History

Restore gl* calls but record them with batch

Atlante45 committed 11 years ago

Commit c2204351 parent 90935d51 file · +76 −83Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+76−83
@@ -59,12 +59,6 @@ void GeometryCache::renderSphere(float radius, int slices, int stacks, const glm · 58 unmodified lines
59 gpu::Batch batch;59 gpu::Batch batch;
60 renderSphere(batch, radius, slices, stacks, color, solid, id);60 renderSphere(batch, radius, slices, stacks, color, solid, id);
61 gpu::GLBackend::renderBatch(batch);61 gpu::GLBackend::renderBatch(batch);
62
63 glDisableClientState(GL_VERTEX_ARRAY);
64 glDisableClientState(GL_COLOR_ARRAY);
65
66 glBindBuffer(GL_ARRAY_BUFFER, 0);
67 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
68}62}
69 63
70void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) {64void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color, bool solid, int id) {
@@ -302,6 +296,12 @@ void GeometryCache::renderSphere(gpu::Batch& batch, float radius, int slices, in · 231 unmodified lines
302 } else {296 } else {
303 batch.drawIndexed(gpu::LINES, indices);297 batch.drawIndexed(gpu::LINES, indices);
304 }298 }
299
300 batch._glDisableClientState(GL_VERTEX_ARRAY);
301 batch._glDisableClientState(GL_COLOR_ARRAY);
302
303 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
304 batch._glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
305}305}
306 306
307void GeometryCache::renderCone(float base, float height, int slices, int stacks) {307void GeometryCache::renderCone(float base, float height, int slices, int stacks) {
@@ -409,11 +409,6 @@ void GeometryCache::renderGrid(int xDivisions, int yDivisions, const glm::vec4& · 101 unmodified lines
409 gpu::Batch batch;409 gpu::Batch batch;
410 renderGrid(batch, xDivisions, yDivisions, color);410 renderGrid(batch, xDivisions, yDivisions, color);
411 gpu::GLBackend::renderBatch(batch);411 gpu::GLBackend::renderBatch(batch);
412
413 glDisableClientState(GL_VERTEX_ARRAY);
414 glDisableClientState(GL_COLOR_ARRAY);
415
416 glBindBuffer(GL_ARRAY_BUFFER, 0);
417}412}
418 413
419void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color) {414void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions, const glm::vec4& color) {
@@ -488,17 +483,17 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int xDivisions, int yDivisions · 68 unmodified lines
488 batch.setInputBuffer(VERTICES_SLOT, verticesView);483 batch.setInputBuffer(VERTICES_SLOT, verticesView);
489 batch.setInputBuffer(COLOR_SLOT, colorView);484 batch.setInputBuffer(COLOR_SLOT, colorView);
490 batch.draw(gpu::LINES, vertices, 0);485 batch.draw(gpu::LINES, vertices, 0);
486
487 batch._glDisableClientState(GL_VERTEX_ARRAY);
488 batch._glDisableClientState(GL_COLOR_ARRAY);
489
490 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
491}491}
492 492
493void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {493void GeometryCache::renderGrid(int x, int y, int width, int height, int rows, int cols, const glm::vec4& color, int id) {
494 gpu::Batch batch;494 gpu::Batch batch;
495 renderGrid(x, y, width, height, rows, cols, color, id);495 renderGrid(x, y, width, height, rows, cols, color, id);
496 gpu::GLBackend::renderBatch(batch);496 gpu::GLBackend::renderBatch(batch);
497
498 glDisableClientState(GL_VERTEX_ARRAY);
499 glDisableClientState(GL_COLOR_ARRAY);
500
501 glBindBuffer(GL_ARRAY_BUFFER, 0);
502}497}
503 498
504// TODO: properly handle the x,y,w,h changing for an ID499// TODO: properly handle the x,y,w,h changing for an ID
@@ -600,6 +595,11 @@ void GeometryCache::renderGrid(gpu::Batch& batch, int x, int y, int width, int h · 95 unmodified lines
600 batch.setInputBuffer(VERTICES_SLOT, verticesView);595 batch.setInputBuffer(VERTICES_SLOT, verticesView);
601 batch.setInputBuffer(COLOR_SLOT, colorView);596 batch.setInputBuffer(COLOR_SLOT, colorView);
602 batch.draw(gpu::LINES, vertices, 0);597 batch.draw(gpu::LINES, vertices, 0);
598
599 batch._glDisableClientState(GL_VERTEX_ARRAY);
600 batch._glDisableClientState(GL_COLOR_ARRAY);
601
602 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
603}603}
604 604
605void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, const glm::vec4& color) {605void GeometryCache::updateVertices(int id, const QVector<glm::vec2>& points, const glm::vec4& color) {
@@ -801,11 +801,6 @@ void GeometryCache::renderVertices(gpu::Primitive primitiveType, int id) { · 195 unmodified lines
801 gpu::Batch batch;801 gpu::Batch batch;
802 renderVertices(batch, primitiveType, id);802 renderVertices(batch, primitiveType, id);
803 gpu::GLBackend::renderBatch(batch);803 gpu::GLBackend::renderBatch(batch);
804
805 glDisableClientState(GL_VERTEX_ARRAY);
806 glDisableClientState(GL_COLOR_ARRAY);
807
808 glBindBuffer(GL_ARRAY_BUFFER, 0);
809}804}
810 805
811void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveType, int id) {806void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveType, int id) {
@@ -814,6 +809,11 @@ void GeometryCache::renderVertices(gpu::Batch& batch, gpu::Primitive primitiveTy · 2 unmodified lines
814 batch.setInputFormat(details.streamFormat);809 batch.setInputFormat(details.streamFormat);
815 batch.setInputStream(0, *details.stream);810 batch.setInputStream(0, *details.stream);
816 batch.draw(primitiveType, details.vertices, 0);811 batch.draw(primitiveType, details.vertices, 0);
812
813 batch._glDisableClientState(GL_VERTEX_ARRAY);
814 batch._glDisableClientState(GL_COLOR_ARRAY);
815
816 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
817 }817 }
818}818}
819 819
@@ -821,12 +821,6 @@ void GeometryCache::renderSolidCube(float size, const glm::vec4& color) { · 1 unmodified line
821 gpu::Batch batch;821 gpu::Batch batch;
822 renderSolidCube(batch, size, color);822 renderSolidCube(batch, size, color);
823 gpu::GLBackend::renderBatch(batch);823 gpu::GLBackend::renderBatch(batch);
824
825 glDisableClientState(GL_VERTEX_ARRAY);
826 glDisableClientState(GL_COLOR_ARRAY);
827
828 glBindBuffer(GL_ARRAY_BUFFER, 0);
829 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
830}824}
831 825
832void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {826void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {
@@ -941,18 +935,18 @@ void GeometryCache::renderSolidCube(gpu::Batch& batch, float size, const glm::ve · 108 unmodified lines
941 batch.setInputBuffer(COLOR_SLOT, colorView);935 batch.setInputBuffer(COLOR_SLOT, colorView);
942 batch.setIndexBuffer(gpu::UINT8, _solidCubeIndexBuffer, 0);936 batch.setIndexBuffer(gpu::UINT8, _solidCubeIndexBuffer, 0);
943 batch.drawIndexed(gpu::TRIANGLES, indices);937 batch.drawIndexed(gpu::TRIANGLES, indices);
938
939 batch._glDisableClientState(GL_VERTEX_ARRAY);
940 batch._glDisableClientState(GL_COLOR_ARRAY);
941
942 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
943 batch._glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
944}944}
945 945
946void GeometryCache::renderWireCube(float size, const glm::vec4& color) {946void GeometryCache::renderWireCube(float size, const glm::vec4& color) {
947 gpu::Batch batch;947 gpu::Batch batch;
948 renderWireCube(batch, size, color);948 renderWireCube(batch, size, color);
949 gpu::GLBackend::renderBatch(batch);949 gpu::GLBackend::renderBatch(batch);
950
951 glDisableClientState(GL_VERTEX_ARRAY);
952 glDisableClientState(GL_COLOR_ARRAY);
953
954 glBindBuffer(GL_ARRAY_BUFFER, 0);
955 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
956}950}
957 951
958void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {952void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {
@@ -1030,17 +1024,18 @@ void GeometryCache::renderWireCube(gpu::Batch& batch, float size, const glm::vec · 71 unmodified lines
1030 batch.setInputBuffer(COLOR_SLOT, colorView);1024 batch.setInputBuffer(COLOR_SLOT, colorView);
1031 batch.setIndexBuffer(gpu::UINT8, _wireCubeIndexBuffer, 0);1025 batch.setIndexBuffer(gpu::UINT8, _wireCubeIndexBuffer, 0);
1032 batch.drawIndexed(gpu::LINES, indices);1026 batch.drawIndexed(gpu::LINES, indices);
1027
1028 batch._glDisableClientState(GL_VERTEX_ARRAY);
1029 batch._glDisableClientState(GL_COLOR_ARRAY);
1030
1031 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1032 batch._glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
1033}1033}
1034 1034
1035void GeometryCache::renderBevelCornersRect(int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {1035void GeometryCache::renderBevelCornersRect(int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {
1036 gpu::Batch batch;1036 gpu::Batch batch;
1037 renderBevelCornersRect(batch, x, y, width, height, bevelDistance, color, id);1037 renderBevelCornersRect(batch, x, y, width, height, bevelDistance, color, id);
1038 gpu::GLBackend::renderBatch(batch);1038 gpu::GLBackend::renderBatch(batch);
1039
1040 glDisableClientState(GL_VERTEX_ARRAY);
1041 glDisableClientState(GL_COLOR_ARRAY);
1042
1043 glBindBuffer(GL_ARRAY_BUFFER, 0);
1044}1039}
1045 1040
1046void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {1041void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int width, int height, int bevelDistance, const glm::vec4& color, int id) {
@@ -1139,17 +1134,17 @@ void GeometryCache::renderBevelCornersRect(gpu::Batch& batch, int x, int y, int · 92 unmodified lines
1139 batch.setInputFormat(details.streamFormat);1134 batch.setInputFormat(details.streamFormat);
1140 batch.setInputStream(0, *details.stream);1135 batch.setInputStream(0, *details.stream);
1141 batch.draw(gpu::QUADS, 4, 0);1136 batch.draw(gpu::QUADS, 4, 0);
1137
1138 batch._glDisableClientState(GL_VERTEX_ARRAY);
1139 batch._glDisableClientState(GL_COLOR_ARRAY);
1140
1141 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1142}1142}
1143 1143
1144void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {1144void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {
1145 gpu::Batch batch;1145 gpu::Batch batch;
1146 renderQuad(batch, minCorner, maxCorner, color, id);1146 renderQuad(batch, minCorner, maxCorner, color, id);
1147 gpu::GLBackend::renderBatch(batch);1147 gpu::GLBackend::renderBatch(batch);
1148
1149 glDisableClientState(GL_VERTEX_ARRAY);
1150 glDisableClientState(GL_COLOR_ARRAY);
1151
1152 glBindBuffer(GL_ARRAY_BUFFER, 0);
1153}1148}
1154 1149
1155void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {1150void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner, const glm::vec4& color, int id) {
@@ -1221,6 +1216,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co · 65 unmodified lines
1221 batch.setInputFormat(details.streamFormat);1216 batch.setInputFormat(details.streamFormat);
1222 batch.setInputStream(0, *details.stream);1217 batch.setInputStream(0, *details.stream);
1223 batch.draw(gpu::QUADS, 4, 0);1218 batch.draw(gpu::QUADS, 4, 0);
1219
1220 batch._glDisableClientState(GL_VERTEX_ARRAY);
1221 batch._glDisableClientState(GL_COLOR_ARRAY);
1222
1223 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1224}1224}
1225 1225
1226void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner,1226void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxCorner,
@@ -1229,12 +1229,6 @@ void GeometryCache::renderQuad(const glm::vec2& minCorner, const glm::vec2& maxC · 2 unmodified lines
1229 gpu::Batch batch;1229 gpu::Batch batch;
1230 renderQuad(batch, minCorner, maxCorner, texCoordMinCorner, texCoordMaxCorner, color, id);1230 renderQuad(batch, minCorner, maxCorner, texCoordMinCorner, texCoordMaxCorner, color, id);
1231 gpu::GLBackend::renderBatch(batch);1231 gpu::GLBackend::renderBatch(batch);
1232
1233 glDisableClientState(GL_VERTEX_ARRAY);
1234 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1235 glDisableClientState(GL_COLOR_ARRAY);
1236
1237 glBindBuffer(GL_ARRAY_BUFFER, 0);
1238}1232}
1239 1233
1240void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,1234void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,
@@ -1315,17 +1309,18 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec2& minCorner, co · 74 unmodified lines
1315 batch.setInputFormat(details.streamFormat);1309 batch.setInputFormat(details.streamFormat);
1316 batch.setInputStream(0, *details.stream);1310 batch.setInputStream(0, *details.stream);
1317 batch.draw(gpu::QUADS, 4, 0);1311 batch.draw(gpu::QUADS, 4, 0);
1312
1313 batch._glDisableClientState(GL_VERTEX_ARRAY);
1314 batch._glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1315 batch._glDisableClientState(GL_COLOR_ARRAY);
1316
1317 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1318}1318}
1319 1319
1320void GeometryCache::renderQuad(const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {1320void GeometryCache::renderQuad(const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {
1321 gpu::Batch batch;1321 gpu::Batch batch;
1322 renderQuad(batch, minCorner, maxCorner, color, id);1322 renderQuad(batch, minCorner, maxCorner, color, id);
1323 gpu::GLBackend::renderBatch(batch);1323 gpu::GLBackend::renderBatch(batch);
1324
1325 glDisableClientState(GL_VERTEX_ARRAY);
1326 glDisableClientState(GL_COLOR_ARRAY);
1327
1328 glBindBuffer(GL_ARRAY_BUFFER, 0);
1329}1324}
1330 1325
1331void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {1326void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, const glm::vec3& maxCorner, const glm::vec4& color, int id) {
@@ -1397,6 +1392,11 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& minCorner, co · 65 unmodified lines
1397 batch.setInputFormat(details.streamFormat);1392 batch.setInputFormat(details.streamFormat);
1398 batch.setInputStream(0, *details.stream);1393 batch.setInputStream(0, *details.stream);
1399 batch.draw(gpu::QUADS, 4, 0);1394 batch.draw(gpu::QUADS, 4, 0);
1395
1396 batch._glDisableClientState(GL_VERTEX_ARRAY);
1397 batch._glDisableClientState(GL_COLOR_ARRAY);
1398
1399 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1400}1400}
1401 1401
1402void GeometryCache::renderQuad(const glm::vec3& topLeft, const glm::vec3& bottomLeft, 1402void GeometryCache::renderQuad(const glm::vec3& topLeft, const glm::vec3& bottomLeft,
@@ -1407,16 +1407,7 @@ void GeometryCache::renderQuad(const glm::vec3& topLeft, const glm::vec3& bottom · 4 unmodified lines
1407 gpu::Batch batch;1407 gpu::Batch batch;
1408 renderQuad(batch, topLeft, bottomLeft, bottomRight, topRight, texCoordTopLeft, texCoordBottomLeft,1408 renderQuad(batch, topLeft, bottomLeft, bottomRight, topRight, texCoordTopLeft, texCoordBottomLeft,
1409 texCoordBottomRight, texCoordTopRight, color, id);1409 texCoordBottomRight, texCoordTopRight, color, id);
1410
1411 glEnable(GL_TEXTURE_2D);
1412
1413 gpu::GLBackend::renderBatch(batch);1410 gpu::GLBackend::renderBatch(batch);
1414
1415 glDisableClientState(GL_VERTEX_ARRAY);
1416 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1417 glDisableClientState(GL_COLOR_ARRAY);
1418
1419 glBindBuffer(GL_ARRAY_BUFFER, 0);
1420}1411}
1421 1412
1422void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, const glm::vec3& bottomLeft, 1413void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, const glm::vec3& bottomLeft,
@@ -1506,29 +1497,24 @@ void GeometryCache::renderQuad(gpu::Batch& batch, const glm::vec3& topLeft, cons · 83 unmodified lines
1506 details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer);1497 details.verticesBuffer->append(sizeof(vertexBuffer), (gpu::Byte*) vertexBuffer);
1507 details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors);1498 details.colorBuffer->append(sizeof(colors), (gpu::Byte*) colors);
1508 }1499 }
1509 1500
1510 //glBindTexture(GL_TEXTURE_2D, _currentTextureID); // this is quad specific...1501 batch._glEnable(GL_TEXTURE_2D);
1511 1502
1512 batch.setInputFormat(details.streamFormat);1503 batch.setInputFormat(details.streamFormat);
1513 batch.setInputStream(0, *details.stream);1504 batch.setInputStream(0, *details.stream);
1514 batch.draw(gpu::QUADS, 4, 0);1505 batch.draw(gpu::QUADS, 4, 0);
1515 1506
1516 // TODO: The callers of this method (renderMagnifier and renderReticle) assume that we won't disable an unbind1507 batch._glDisableClientState(GL_VERTEX_ARRAY);
1517 // the texture after rendering. I'm not sure if this is correct in general but it's currently required for the1508 batch._glDisableClientState(GL_TEXTURE_COORD_ARRAY);
1518 // oculus overlay to work.1509 batch._glDisableClientState(GL_COLOR_ARRAY);
1519 //glBindTexture(GL_TEXTURE_2D, 0);1510
1520 //glDisable(GL_TEXTURE_2D);1511 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1521}1512}
1522 1513
1523void GeometryCache::renderDashedLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {1514void GeometryCache::renderDashedLine(const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {
1524 gpu::Batch batch;1515 gpu::Batch batch;
1525 renderDashedLine(batch, start, end, color, id);1516 renderDashedLine(batch, start, end, color, id);
1526 gpu::GLBackend::renderBatch(batch);1517 gpu::GLBackend::renderBatch(batch);
1527
1528 glDisableClientState(GL_VERTEX_ARRAY);
1529 glDisableClientState(GL_COLOR_ARRAY);
1530
1531 glBindBuffer(GL_ARRAY_BUFFER, 0);
1532}1518}
1533 1519
1534void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {1520void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, const glm::vec3& end, const glm::vec4& color, int id) {
@@ -1634,6 +1620,11 @@ void GeometryCache::renderDashedLine(gpu::Batch& batch, const glm::vec3& start, · 99 unmodified lines
1634 batch.setInputFormat(details.streamFormat);1620 batch.setInputFormat(details.streamFormat);
1635 batch.setInputStream(0, *details.stream);1621 batch.setInputStream(0, *details.stream);
1636 batch.draw(gpu::LINES, details.vertices, 0);1622 batch.draw(gpu::LINES, details.vertices, 0);
1623
1624 batch._glDisableClientState(GL_VERTEX_ARRAY);
1625 batch._glDisableClientState(GL_COLOR_ARRAY);
1626
1627 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1637}1628}
1638 1629
1639 1630
@@ -1690,10 +1681,6 @@ void GeometryCache::renderLine(const glm::vec3& p1, const glm::vec3& p2, · 50 unmodified lines
1690 gpu::Batch batch;1681 gpu::Batch batch;
1691 renderLine(batch, p1, p2, color1, color2, id);1682 renderLine(batch, p1, p2, color1, color2, id);
1692 gpu::GLBackend::renderBatch(batch);1683 gpu::GLBackend::renderBatch(batch);
1693
1694 glDisableClientState(GL_VERTEX_ARRAY);
1695 glDisableClientState(GL_COLOR_ARRAY);
1696 glBindBuffer(GL_ARRAY_BUFFER, 0);
1697}1684}
1698 1685
1699void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2, 1686void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2,
@@ -1778,16 +1765,17 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm · 78 unmodified lines
1778 batch.setInputFormat(details.streamFormat);1765 batch.setInputFormat(details.streamFormat);
1779 batch.setInputStream(0, *details.stream);1766 batch.setInputStream(0, *details.stream);
1780 batch.draw(gpu::LINES, 2, 0);1767 batch.draw(gpu::LINES, 2, 0);
1768
1769 batch._glDisableClientState(GL_VERTEX_ARRAY);
1770 batch._glDisableClientState(GL_COLOR_ARRAY);
1771
1772 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1781}1773}
1782 1774
1783void GeometryCache::renderLine(const glm::vec2& p1, const glm::vec2& p2, const glm::vec4& color1, const glm::vec4& color2, int id) {1775void GeometryCache::renderLine(const glm::vec2& p1, const glm::vec2& p2, const glm::vec4& color1, const glm::vec4& color2, int id) {
1784 gpu::Batch batch;1776 gpu::Batch batch;
1785 renderLine(batch, p1, p2, color1, color2, id);1777 renderLine(batch, p1, p2, color1, color2, id);
1786 gpu::GLBackend::renderBatch(batch);1778 gpu::GLBackend::renderBatch(batch);
1787
1788 glDisableClientState(GL_VERTEX_ARRAY);
1789 glDisableClientState(GL_COLOR_ARRAY);
1790 glBindBuffer(GL_ARRAY_BUFFER, 0);
1791}1779}
1792 1780
1793void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm::vec2& p2, 1781void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm::vec2& p2,
@@ -1872,6 +1860,11 @@ void GeometryCache::renderLine(gpu::Batch& batch, const glm::vec2& p1, const glm · 78 unmodified lines
1872 batch.setInputFormat(details.streamFormat);1860 batch.setInputFormat(details.streamFormat);
1873 batch.setInputStream(0, *details.stream);1861 batch.setInputStream(0, *details.stream);
1874 batch.draw(gpu::LINES, 2, 0);1862 batch.draw(gpu::LINES, 2, 0);
1863
1864 batch._glDisableClientState(GL_VERTEX_ARRAY);
1865 batch._glDisableClientState(GL_COLOR_ARRAY);
1866
1867 batch._glBindBuffer(GL_ARRAY_BUFFER, 0);
1875}1868}
1876 1869
1877 1870