Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This patch fixes a bug in lepton on 64-bit architectures makes particles go everywhere and appear in all the wrong colours.
Index: lepton/renderermodule.c
===================================================================
--- lepton/renderermodule.c (revision 247)
+++ lepton/renderermodule.c (working copy)
@@ -59,6 +59,9 @@
/* Vertex data functions and structs */
+#pragma pack(push)
+#pragma pack(4)
+
typedef struct {
float x, y, z;
} VertItem;
@@ -74,6 +77,8 @@
};
} ColorItem;
+#pragma pack(pop)
+
typedef struct {
int is_vbo;
Py_ssize_t size; /* Number of verts */
@@ -662,8 +667,8 @@
goto error;
}
- glVertexPointer(3, GL_FLOAT, 0, data.verts);
- glColorPointer(4, GL_UNSIGNED_BYTE, 0, data.colors);
+ glVertexPointer(3, GL_FLOAT, sizeof(VertItem), data.verts);
+ glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ColorItem), data.colors);
glTexCoordPointer(tex_dimension, GL_FLOAT, 0, tex_array->data);
if (!draw_billboards(pcount))
goto error;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment