Example #1
0
static void do_import( struct vertex_buffer *VB,
		       struct gl_client_array *to,
		       struct gl_client_array *from )
{
   GLuint count = VB->Count;

   if (!to->Ptr) {
      to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLubyte), 32 );
      to->Type = GL_UNSIGNED_BYTE;
   }

   /* No need to transform the same value 3000 times.
    */
   if (!from->StrideB) {
      to->StrideB = 0;
      count = 1;
   }
   else
      to->StrideB = 4 * sizeof(GLubyte);
   
   _math_trans_4ub( (GLubyte (*)[4]) to->Ptr,
		    from->Ptr,
		    from->StrideB,
		    from->Type,
		    from->Size,
		    0,
		    count);
}
Example #2
0
/**
 * Translate vector of values to GLchan [4].
 */
void _math_trans_4chan( GLchan (*to)[4],
			const void *ptr,
			GLuint stride,
			GLenum type,
			GLuint size,
			GLuint start,
			GLuint n )
{
#if CHAN_TYPE == GL_UNSIGNED_BYTE
   _math_trans_4ub( to, ptr, stride, type, size, start, n );
#elif CHAN_TYPE == GL_UNSIGNED_SHORT
   _math_trans_4us( to, ptr, stride, type, size, start, n );
#elif CHAN_TYPE == GL_FLOAT
   _math_trans_4fn( to, ptr, stride, type, size, start, n );
#endif
}