[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29447] branches/soc-2010-nicolasbishop/ source/blender/gpu/intern/gpu_buffers.c: Small hack just for my branch to get mesh VBOs working right with my drivers , which don't like glNormalPointer to use GL_SHORT for some reason.
Nicholas Bishop
nicholasbishop at gmail.com
Mon Jun 14 13:19:12 CEST 2010
Revision: 29447
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29447
Author: nicholasbishop
Date: 2010-06-14 13:19:10 +0200 (Mon, 14 Jun 2010)
Log Message:
-----------
Small hack just for my branch to get mesh VBOs working right with my drivers, which don't like glNormalPointer to use GL_SHORT for some reason.
Modified Paths:
--------------
branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c
Modified: branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c 2010-06-14 10:33:26 UTC (rev 29446)
+++ branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c 2010-06-14 11:19:10 UTC (rev 29447)
@@ -381,10 +381,23 @@
dm->drawObject = 0;
}
+/* XXX: don't merge this to trunk
+
+ I'm having graphics problems with GL_SHORT normals;
+ this is on experimental drivers that I'm sure not
+ very many other people are using, so not worth really
+ fixing.
+*/
+#define VBO_FLOATS 1
+
/* Convenience struct for building the VBO. */
typedef struct {
float co[3];
+#ifdef VBO_FLOATS
+ float no[3];
+#else
short no[3];
+#endif
} VertexBufferFormat;
typedef struct {
@@ -489,7 +502,11 @@
VertexBufferFormat *out = vert_data + i;
copy_v3_v3(out->co, v->co);
+#ifdef VBO_FLOATS
+ normal_short_to_float_v3(out->no, v->no);
+#else
memcpy(out->no, v->no, sizeof(short) * 3);
+#endif
}
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
@@ -789,7 +806,11 @@
}
else {
glVertexPointer(3, GL_FLOAT, sizeof(VertexBufferFormat), (void*)offsetof(VertexBufferFormat, co));
+#ifdef VBO_FLOATS
+ glNormalPointer(GL_FLOAT, sizeof(VertexBufferFormat), (void*)offsetof(VertexBufferFormat, no));
+#else
glNormalPointer(GL_SHORT, sizeof(VertexBufferFormat), (void*)offsetof(VertexBufferFormat, no));
+#endif
if(buffers->color_buf) {
glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->color_buf);
glColorPointer(3, GL_UNSIGNED_BYTE, 0, (void*)0);
More information about the Bf-blender-cvs
mailing list