for (i = 0; i < newheight; i++) {
for (j = 0; j < newwidth; j++) {
for (k = 0; k < components; k++) {
- GLuint b;
- b = __GLU_SWAP_4_BYTES(t);
- s[0] = *(GLfloat*)&b;
- b = __GLU_SWAP_4_BYTES(t+group_size);
- s[0] += *(GLfloat*)&b;
- b = __GLU_SWAP_4_BYTES(t+ysize);
- s[0] += *(GLfloat*)&b;
- b = __GLU_SWAP_4_BYTES(t+ysize+group_size);
- s[0] += *(GLfloat*)&b;
+ union { GLuint b; GLfloat f; } swapbuf;
+ swapbuf.b = __GLU_SWAP_4_BYTES(t);
+ s[0] = swapbuf.f;
+ swapbuf.b = __GLU_SWAP_4_BYTES(t+group_size);
+ s[0] += swapbuf.f;
+ swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize);
+ s[0] += swapbuf.f;
+ swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize+group_size);
+ s[0] += swapbuf.f;
s[0] /= 4;
s++; t += element_size;
}
int l, m;
const char *left, *right;
- GLuint swapbuf; /* unsigned buffer */
+ union { GLuint b; GLfloat f; } swapbuf;
if (widthin == widthout*2 && heightin == heightout*2) {
halveImage_float(components, widthin, heightin,
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * y_percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * y_percent;
} else {
totals[k] += *(const GLfloat*)temp_index * y_percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * y_percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * y_percent;
} else {
totals[k] += *(const GLfloat*)temp_index * y_percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0; k < components;
k++, left += element_size, right += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(left);
- totals[k] += *(const GLfloat*)&swapbuf * (1-lowx_float);
- swapbuf = __GLU_SWAP_4_BYTES(right);
- totals[k] += *(const GLfloat*)&swapbuf * highx_float;
+ swapbuf.b = __GLU_SWAP_4_BYTES(left);
+ totals[k] += swapbuf.f * (1-lowx_float);
+ swapbuf.b = __GLU_SWAP_4_BYTES(right);
+ totals[k] += swapbuf.f * highx_float;
} else {
totals[k] += *(const GLfloat*)left * (1-lowx_float)
+ *(const GLfloat*)right * highx_float;
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * x_percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * x_percent;
} else {
totals[k] += *(const GLfloat*)temp_index * x_percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * y_percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * y_percent;
} else {
totals[k] += *(const GLfloat*)temp_index * y_percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf * percent;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f * percent;
} else {
totals[k] += *(const GLfloat*)temp_index * percent;
}
for (k = 0, temp_index = temp; k < components;
k++, temp_index += element_size) {
if (myswap_bytes) {
- swapbuf = __GLU_SWAP_4_BYTES(temp_index);
- totals[k] += *(const GLfloat*)&swapbuf;
+ swapbuf.b = __GLU_SWAP_4_BYTES(temp_index);
+ totals[k] += swapbuf.f;
} else {
totals[k] += *(const GLfloat*)temp_index;
}
GLint depthAtLevelOne= (depthPowerOf2 > 1) ?
depthPowerOf2 >> 1 :
depthPowerOf2;
- GLenum proxyTarget;
+ GLenum proxyTarget = GL_PROXY_TEXTURE_3D;
assert(widthAtLevelOne > 0);
assert(heightAtLevelOne > 0);
assert(depthAtLevelOne > 0);
/* does width x height x depth at level 1 & all their mipmaps fit? */
- if (target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D) {
- proxyTarget = GL_PROXY_TEXTURE_3D;
- gluTexImage3D(proxyTarget, 1, /* must be non-zero */
- internalFormat,
- widthAtLevelOne,heightAtLevelOne,depthAtLevelOne,
- 0,format,type,NULL);
- }
+ assert(target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D);
+ gluTexImage3D(proxyTarget, 1, /* must be non-zero */
+ internalFormat,
+ widthAtLevelOne,heightAtLevelOne,depthAtLevelOne,
+ 0,format,type,NULL);
glGetTexLevelParameteriv(proxyTarget, 1,GL_TEXTURE_WIDTH,&proxyWidth);
/* does it fit??? */
if (proxyWidth == 0) { /* nope, so try again with these sizes */