TINYGL: Fixed normal array element

This commit is contained in:
Paweł Kołodziejski 2021-11-09 19:49:42 +01:00
parent 72db707953
commit ff7f542846
No known key found for this signature in database
GPG Key ID: 0BDADC9E74440FF7

View File

@ -101,28 +101,28 @@ void glopArrayElement(GLContext *c, GLParam *param) {
TGLfloat *array = (TGLfloat *)((TGLbyte *)c->normal_array + offset); TGLfloat *array = (TGLfloat *)((TGLbyte *)c->normal_array + offset);
c->current_normal.X = array[0]; c->current_normal.X = array[0];
c->current_normal.Y = array[1]; c->current_normal.Y = array[1];
c->current_normal.Z = array[3]; c->current_normal.Z = array[2];
break; break;
} }
case TGL_DOUBLE: { case TGL_DOUBLE: {
TGLdouble *array = (TGLdouble *)((TGLbyte *)c->normal_array + offset); TGLdouble *array = (TGLdouble *)((TGLbyte *)c->normal_array + offset);
c->current_normal.X = array[0]; c->current_normal.X = array[0];
c->current_normal.Y = array[1]; c->current_normal.Y = array[1];
c->current_normal.Z = array[3]; c->current_normal.Z = array[2];
break; break;
} }
case TGL_INT: { case TGL_INT: {
TGLint *array = (TGLint *)((TGLbyte *)c->normal_array + offset); TGLint *array = (TGLint *)((TGLbyte *)c->normal_array + offset);
c->current_normal.X = array[0]; c->current_normal.X = array[0];
c->current_normal.Y = array[1]; c->current_normal.Y = array[1];
c->current_normal.Z = array[3]; c->current_normal.Z = array[2];
break; break;
} }
case TGL_SHORT: { case TGL_SHORT: {
TGLshort *array = (TGLshort *)((TGLbyte *)c->normal_array + offset); TGLshort *array = (TGLshort *)((TGLbyte *)c->normal_array + offset);
c->current_normal.X = array[0]; c->current_normal.X = array[0];
c->current_normal.Y = array[1]; c->current_normal.Y = array[1];
c->current_normal.Z = array[3]; c->current_normal.Z = array[2];
break; break;
} }
default: default:
@ -290,7 +290,7 @@ void glopColorPointer(GLContext *c, GLParam *p) {
c->color_array_size = p[1].i; c->color_array_size = p[1].i;
c->color_array_type = p[2].i; c->color_array_type = p[2].i;
c->color_array = p[4].p; c->color_array = p[4].p;
switch (p[2].i) { switch (c->color_array_type) {
case TGL_BYTE: case TGL_BYTE:
case TGL_UNSIGNED_BYTE: case TGL_UNSIGNED_BYTE:
c->color_array_stride = p[3].i != 0 ? p[3].i : c->color_array_stride * sizeof(TGLbyte); c->color_array_stride = p[3].i != 0 ? p[3].i : c->color_array_stride * sizeof(TGLbyte);