Skip to content

Instantly share code, notes, and snippets.

@ToadKing
Created July 15, 2014 19:32
Show Gist options
  • Select an option

  • Save ToadKing/f5ba350bc1f6f01a55c3 to your computer and use it in GitHub Desktop.

Select an option

Save ToadKing/f5ba350bc1f6f01a55c3 to your computer and use it in GitHub Desktop.
diff --git a/glide2gl/src/Glitch64/geometry.c b/glide2gl/src/Glitch64/geometry.c
index 73eea75..754e7af 100644
--- a/glide2gl/src/Glitch64/geometry.c
+++ b/glide2gl/src/Glitch64/geometry.c
@@ -28,7 +28,7 @@
#include "main.h"
#include "../Glide64/rdp.h"
-struct draw_buffer {
+/*struct draw_buffer {
float x, y, z, q;
uint8_t b; // These values are arranged like this so that *(uint32_t*)(VERTEX+?) is
@@ -39,10 +39,10 @@ struct draw_buffer {
float coord[4];
float f; //fog
-};
+};*/
-static struct draw_buffer *gli_vbo;
-static unsigned gli_vbo_size;
+//static VERTEX *gli_vbo;
+//static unsigned gli_vbo_size;
FX_ENTRY void FX_CALL
grCullMode( GrCullMode_t mode )
@@ -147,7 +147,7 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 count, void *pointers)
if(need_to_compile)
compile_shader();
- if (count > gli_vbo_size)
+ /*if (count > gli_vbo_size)
{
gli_vbo_size = count;
gli_vbo = realloc(gli_vbo, sizeof(struct draw_buffer) * gli_vbo_size);
@@ -156,24 +156,24 @@ grDrawVertexArrayContiguous(FxU32 mode, FxU32 count, void *pointers)
for (i = 0; i < count; i++)
{
memcpy(&gli_vbo[i], &v[i], sizeof(struct draw_buffer));
- }
+ }*/
glBindBuffer(GL_ARRAY_BUFFER, glitch_vbo);
- glBufferData(GL_ARRAY_BUFFER, sizeof(struct draw_buffer) * count, gli_vbo, GL_DYNAMIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, sizeof(VERTEX) * count, v, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(POSITION_ATTR);
- glVertexAttribPointer(POSITION_ATTR, 4, GL_FLOAT, false, sizeof(struct draw_buffer), offsetof(struct draw_buffer, x)); //Position
+ glVertexAttribPointer(POSITION_ATTR, 4, GL_FLOAT, false, sizeof(VERTEX), offsetof(VERTEX, x)); //Position
glEnableVertexAttribArray(COLOUR_ATTR);
- glVertexAttribPointer(COLOUR_ATTR, 4, GL_UNSIGNED_BYTE, true, sizeof(struct draw_buffer), offsetof(struct draw_buffer, b)); //Colour
+ glVertexAttribPointer(COLOUR_ATTR, 4, GL_UNSIGNED_BYTE, true, sizeof(VERTEX), offsetof(VERTEX, b)); //Colour
glEnableVertexAttribArray(TEXCOORD_0_ATTR);
- glVertexAttribPointer(TEXCOORD_0_ATTR, 2, GL_FLOAT, false, sizeof(struct draw_buffer), offsetof(struct draw_buffer, coord[2])); //Tex0
+ glVertexAttribPointer(TEXCOORD_0_ATTR, 2, GL_FLOAT, false, sizeof(VERTEX), offsetof(VERTEX, coord[2])); //Tex0
glEnableVertexAttribArray(TEXCOORD_1_ATTR);
- glVertexAttribPointer(TEXCOORD_1_ATTR, 2, GL_FLOAT, false, sizeof(struct draw_buffer), offsetof(struct draw_buffer, coord[0])); //Tex1
+ glVertexAttribPointer(TEXCOORD_1_ATTR, 2, GL_FLOAT, false, sizeof(VERTEX), offsetof(VERTEX, coord[0])); //Tex1
glEnableVertexAttribArray(FOG_ATTR);
- glVertexAttribPointer(FOG_ATTR, 1, GL_FLOAT, false, sizeof(struct draw_buffer), offsetof(struct draw_buffer, f)); //Fog
+ glVertexAttribPointer(FOG_ATTR, 1, GL_FLOAT, false, sizeof(VERTEX), offsetof(VERTEX, f)); //Fog
glDrawArrays(mode, 0, count);
glBindBuffer(GL_ARRAY_BUFFER, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment