My eyes (much) prefer the 40-char version to that last code at the end, though I might do it like so:
int w, h;
w = desired_width;
w *= scale_factor;
w += padding;
h = desired_height;
h *= scale_factor;
h += padding;
glBindTexture(
GL_TEXTURE_2D, someTexture
);
glTexImage2D(
GL_TEXTURE_2D, level, format,
w, h, border, format, type, data
);
glTexParameter(
GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT
);
That's assuming C, for C++ I might start it off like so:
int w = desired_width;
w *= scale_factor;
w += padding;
int h = desired_height;
h *= scale_factor;
h += padding;
I might be tempted to use a macro but likely pass and just use shorter names all around.