if(vbuf && own_vbuf)
return;
- vbuf=new Buffer(ARRAY_BUFFER);
- own_vbuf=true;
+ vbuf = new Buffer(ARRAY_BUFFER);
+ own_vbuf = true;
update_data();
}
{
if(own_vbuf)
delete vbuf;
- vbuf=b;
- own_vbuf=false;
+ vbuf = b;
+ own_vbuf = false;
update_data();
}
void VertexArray::reset(const VertexFormat &f)
{
clear();
- format=f;
- stride=get_stride(format);
+ format = f;
+ stride = get_stride(format);
- bool has_gen_attrs=false;
+ bool has_gen_attrs = false;
for(const unsigned char *c=format.begin(); (!has_gen_attrs && c!=format.end()); ++c)
- has_gen_attrs=(*c>=ATTRIB1);
+ has_gen_attrs = (*c>=ATTRIB1);
if(has_gen_attrs)
static RequireExtension _ext("GL_ARB_vertex_program");
}
if(vbuf)
vbuf->bind();
- const float *base=vbuf?0:&data[0];
- uint offset=0;
- uint found=0;
- uint bpv=stride*sizeof(float);
+ const float *base = vbuf?0:&data[0];
+ unsigned offset = 0;
+ unsigned found = 0;
+ unsigned bpv = stride*sizeof(float);
for(const unsigned char *c=format.begin(); c!=format.end(); ++c)
{
- uint sz=(*c&3)+1;
- uint t=*c>>2;
+ unsigned sz = (*c&3)+1;
+ unsigned t = *c>>2;
switch(t)
{
case 0:
glVertexAttribPointerARB(t-4, sz, GL_FLOAT, false, bpv, base+offset);
break;
}
- found|=1<<t;
- offset+=sz;
+ found |= 1<<t;
+ offset += sz;
}
set_array(GL_VERTEX_ARRAY, found&1, 1);
glDisableClientState(array);
else
glDisableVertexAttribArrayARB(array);
- enabled_arrays&=~mask;
+ enabled_arrays &= ~mask;
}
else if(!(enabled_arrays&mask) && en)
{
glEnableClientState(array);
else
glEnableVertexAttribArrayARB(array);
- enabled_arrays|=mask;
+ enabled_arrays |= mask;
}
}
-unsigned VertexArray::enabled_arrays=0;
+unsigned VertexArray::enabled_arrays = 0;
VertexArray::Loader::Loader(VertexArray &a):
glArrayElement(i);
}
-void draw_arrays(PrimitiveType mode, int first, sizei count)
+void draw_arrays(PrimitiveType mode, int first, unsigned count)
{
glDrawArrays(mode, first, count);
}
-void draw_elements(PrimitiveType mode, sizei count, DataType type, const void *indices)
+void draw_elements(PrimitiveType mode, unsigned count, DataType type, const void *indices)
{
glDrawElements(mode, count, type, indices);
}
-void draw_range_elements(PrimitiveType mode, uint low, uint high, sizei count, DataType type, const void *indices)
+void draw_range_elements(PrimitiveType mode, unsigned low, unsigned high, unsigned count, DataType type, const void *indices)
{
static RequireVersion _ver(1, 2);
glDrawRangeElements(mode, low, high, count, type, indices);