Hey folks!
I'm trying to write a custom Image class for my OpenGL ES 1.0 framework, to
make it easy cheesy I want to be able to load bitmaps even though they
aren't in the power of two and generate GL friendly bitmaps during the
loading and initializing process. I have written a method that will
generate a mutable bitmap with the right size and are now trying to copy
the pixels from the original to the GL bitmap, the process works if the
original bitmap is GL friendly and no resizing is necisary, but when I try
the process on a unfriendly bitmap sizewise I'm only getting a gray
rectangle. I have tried to debug the process by filling the new bitmap with
a certain Color.*** but the method seems to get all messed up when the
source and destination bitmap have different sizes, and does not take the
pixel values into consideration at all. An example for this is this code
snippet:
for(int y = 0; y < dstHeight; y++) {
for(int x = 0; x < dstWidth; x++) {
if(srcHeight > y && srcWidth > x) {
temp.setPixel(x, y, Color.RED);
} else {
temp.setPixel(x, y, Color.GREEN);
}
}
}
The result I'm getting here is a all green rectangle even though the dst
size is larger than the src size, so it seems to override my logic and live
it's own life. I have tried to work with the getPixels/setPixels functions
as well as seen in this codesnippet:
int pixels[] = new int[temp.getWidth()*temp.getHeight()*4];
bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(),
bitmap.getHeight());
temp.setPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(),
bitmap.getHeight());
but here it's the gray rectangle once again.
I have no idea on how to continue debugging this problem, so I thought this
was a good time to start hanging on the Android dev forums! :)
Anyway, any help or nudge in the right direction is much appreciated!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en