OpenGL and Ketai Camera issues
in
Android Processing
•
9 months ago
Hi guys I'm attempting to create some Augmented Reality applications to run in Android, I'm new to developing for Android with Processing...
Now, i need to render in OpenGL mode to draw 3d objects in the sketch, but when i try to use P2d, P3D or OPENGL as sketch renderer, i receive this error:
the sketch is the camera example from ketai examples...
Can someone help me?
Thanks a lot to everyone :)
Now, i need to render in OpenGL mode to draw 3d objects in the sketch, but when i try to use P2d, P3D or OPENGL as sketch renderer, i receive this error:
With JAVA2D or no renderer at all it works...java.lang.NullPointerException
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:461)
at processing.core.PImage.resize(Unknown Source)
at ketai.camera.KetaiCamera.determineCameraParameters(KetaiCamera.java:892)
at ketai.camera.KetaiCamera.start(KetaiCamera.java:423)
at processing.test.cameragettingstarted_new.CameraGettingStarted_new.mousePressed(CameraGettingStarted_new.java:67)
at processing.core.PApplet.handleMouseEvent(Unknown Source)
at processing.core.PApplet.dequeueEvents(Unknown Source)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.opengl.PGL$AndroidRenderer.onDrawFrame(Unknown Source)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1516)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Exception caught while trying to connect to camera service. Please check your sketch permissions or that another application is not using the camera.
the sketch is the camera example from ketai examples...
- import ketai.camera.*;
- KetaiCamera cam;
- void setup() {
- size(displayWidth, displayHeight, P3D);
- orientation(LANDSCAPE);
- imageMode(CENTER);
- cam = new KetaiCamera(this, 320, 240, 24);
- }
- void draw() {
- image(cam, width/2, height/2);
- }
- void onPause()
- {
- super.onPause();
- //Make sure to releae the camera when we go
- // to sleep otherwise it stays locked
- if (cam != null && cam.isStarted())
- cam.stop();
- }
- void onCameraPreviewEvent()
- {
- cam.read();
- }
- void exit() {
- cam.stop();
- }
- // start/stop camera preview by tapping the screen
- void mousePressed()
- {
- if (cam.isStarted())
- {
- cam.stop();
- }
- else
- cam.start();
- }
- void keyPressed() {
- if (key == CODED) {
- if (keyCode == MENU) {
- if (cam.isFlashEnabled())
- cam.disableFlash();
- else
- cam.enableFlash();
- }
- }
- }
Can someone help me?
Thanks a lot to everyone :)
1