Skip to content

Instantly share code, notes, and snippets.

@shakesoda
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakesoda/11f13a6ceefa2fa946c9 to your computer and use it in GitHub Desktop.
Save shakesoda/11f13a6ceefa2fa946c9 to your computer and use it in GitHub Desktop.
add line drawing mode (really useful for debugging) and fix crash on non-OS X in love-experiments vertex buffer branch
diff -r 125cff058bd5 src/modules/graphics/opengl/Mesh.cpp
--- a/src/modules/graphics/opengl/Mesh.cpp Mon Jun 02 00:22:41 2014 -0300
+++ b/src/modules/graphics/opengl/Mesh.cpp Sat Oct 25 10:12:35 2014 -0700
@@ -581,6 +581,8 @@
{
case DRAW_MODE_FAN:
return GL_TRIANGLE_FAN;
+ case DRAW_MODE_LINES:
+ return GL_LINES;
case DRAW_MODE_STRIP:
return GL_TRIANGLE_STRIP;
case DRAW_MODE_TRIANGLES:
@@ -694,6 +696,7 @@
StringMap<Mesh::DrawMode, Mesh::DRAW_MODE_MAX_ENUM>::Entry Mesh::drawModeEntries[] =
{
{"fan", Mesh::DRAW_MODE_FAN},
+ {"lines", Mesh::DRAW_MODE_LINES},
{"strip", Mesh::DRAW_MODE_STRIP},
{"triangles", Mesh::DRAW_MODE_TRIANGLES},
{"points", Mesh::DRAW_MODE_POINTS},
diff -r 125cff058bd5 src/modules/graphics/opengl/Mesh.h
--- a/src/modules/graphics/opengl/Mesh.h Mon Jun 02 00:22:41 2014 -0300
+++ b/src/modules/graphics/opengl/Mesh.h Sat Oct 25 10:12:35 2014 -0700
@@ -55,6 +55,7 @@
enum DrawMode
{
DRAW_MODE_FAN,
+ DRAW_MODE_LINES,
DRAW_MODE_STRIP,
DRAW_MODE_TRIANGLES,
DRAW_MODE_POINTS,
diff -r 125cff058bd5 src/modules/graphics/opengl/Shader.cpp
--- a/src/modules/graphics/opengl/Shader.cpp Mon Jun 02 00:22:41 2014 -0300
+++ b/src/modules/graphics/opengl/Shader.cpp Sat Oct 25 10:12:35 2014 -0700
@@ -271,7 +271,9 @@
for (int i = 0; i < numattribs; i++)
{
GLsizei namelength = 0;
- glGetActiveAttrib(program, (GLuint) i, 256, &namelength, nullptr, nullptr, cname);
+ GLint size = 0;
+ GLenum type = GL_INVALID_ENUM;
+ glGetActiveAttrib(program, (GLuint) i, 256, &namelength, &size, &type, cname);
std::string name = std::string(cname, (size_t) namelength);
GLint location = glGetAttribLocation(program, name.c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment