android - Landscape Background with OpenGL1.0 -
im bit confused power of 2 restriction opengles1.0/1.1
what image size should using decent quality landscape background tablet or mobile device?
i have tried 512 x 512 , 1024 x 1024, scaling wrong , image looks terrible.
android: 1.6,1.7
for such purposes create texture larger image, use texture sub image load data, create texture coordinates fit image.
try doing this:
float texturewidth = 1; float textureheight = 1; while(texturewidth < imagesize.width) texturewidth <<= 1; while(textureheight < imagesize.height) textureheight <<= 1; //create texture dimensions of texturewidth x textureheight (glteximage2d) //fill data imagesize parameters , raw data image (gltexsubimage) float texturecoordinatewidthratio = imagesize.width/(float)texturewidth; float texturecoordinateheightratio = imagesize.height/(float)textureheight; float texturecoordinates[] = { .0, .0, texturecoordinatewidthratio, .0, .0, texturecoordinateheightratio, texturecoordinatewidthratio, texturecoordinateheightratio };
now use data did before.
though did scaling wrong. if scaling mean ratio width/height wrong problem in ether vertex array (wrong coordinates) and/or "ortho" or "viewport". in case above solution have no effect. if result unclear background (or blurry), might solution looking might solved texture parameters.
Comments
Post a Comment