Hi, thank you very much!! It works now and I am starting to understand the interaction between the different coordinate systems.
I've got another problem though: I'd like to save a snapshot of the framebuffer onto the phone when the user touches the screen but I get a 'called unimplemented OpenGL ES API' error and a black image is saved. I use following code:
if (me.getAction() == MotionEvent.ACTION_DOWN) {
Bitmap image = null;
if (fb != null){
image = Bitmap.createBitmap(fb.getPixels(), fb.getWidth(), fb.getHeight(), Bitmap.Config.ARGB_8888);
//Stuff to store the image
String extr = Environment.getExternalStorageDirectory().toString() + File.separator + "Deco";
String fileName = new SimpleDateFormat("'Snapshot_'yyyy'-'MM'-'dd'_'hh':'mm':'ss'.jpg'").format(new Date());
String filePath = extr + "/" + fileName;
File myPath = new File(extr, fileName);
try {
FileOutputStream fos = new FileOutputStream(myPath);
image.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
//MediaStore.Images.Media.insertImage(getContentResolver(), b, "Screen", "screen");
}catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// end stuff to store image
}
return true;
}
When I use this code in the onDrawFrame(GL10 gl) of the MyRenderer class after following lines, it works.
fb.clear(back);
world.renderScene(fb);
world.draw(fb);
Do you know how to solve this? In the documentation is also written that it is recommended to use getPixels() after update(), but it seems that there is no update method for the jPCT-AE version.