Exception with TangoCameraPreview - google-project-tango

Edit
I implemented the TangoCameraPreview by itself in a test app and it works fine. I think this error is being caused by the specific circumstances of my app. I am using Rajawali to render some graphics in my app so that could be it, but I'm not sure...
Original
I'm using the Java API and trying to use the TangoCameraPreview class instead of building my own SurfaceView and Renderer like they do in the examples. But it looks like something is failing on the JNI level and I can't get it working. Sometimes, I'll see the video for a split second, but inevitably I always get the error:
12-30 17:20:03.544 4005-4515/com.gloppygloop W/tango_client_api: TangoErrorType TangoService_updateTexture(TangoCameraId, double*): TangoService got a negative timestamp -1.000000 from camera with id 2.
12-30 17:20:03.546 4005-4515/com.gloppygloop E/TangoCameraPreview: Error updating texture.
com.google.atap.tangoservice.TangoInvalidException
at com.google.atap.tangoservice.Tango.throwTangoExceptionIfNeeded(Tango.java:826)
at com.google.atap.tangoservice.Tango.updateTexture(Tango.java:333)
at com.google.atap.tangoservice.TangoCameraPreview.updateTexture(TangoCameraPreview.java:267)
at com.google.atap.tangoservice.TangoCameraPreview$MainRenderer.onDrawFrame(TangoCameraPreview.java:117)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
I'm basically just calling the TangoCameraPreview.onFrameAvailable, whenever I have OnFrameAvailable from the OnTangoUpdateListener like they recommend in the docs. As far as I can tell, its just because the JNI method is not able to get a timestamp properly from the camera and that causes an error. I'm trying to use the Fisheye camera, but I've tried the Color camera and the RGBIR camera as well.

Found the solution, so I'll just leave it here in case anyone else gets stuck with this. The problem was that I was using another GLSurfaceView in the same context as my TangoCameraPreview. After some searching around, I found this answer which cleared things up for me. Basically, whenever you have multiple SurfaceViews in the same context you need to be conscious of the Z-order of these views. Otherwise, you'll just get strange behavior like I was experiencing. The Tango error was just misleading because I'm still getting the error even though the TangoCameraPreview is functioning as expected.

Related

Applying Velocity to an object

I am trying to make something similar to map controls that will work in a react native app, I have the basics of it working but I've become stuck when trying to make it "scrollable", What I mean is I want to be able to swipe across the screen and sort of fling an object.
In my mind, the logical way would be to put velocity on the object and gradually make it slow down but I can't find anything like a set velocity in Three Js.
Am I missing something or am I looking at this in the wrong way?

ESRI ArcGIS Runtime: AttributeLabelClass 10.2.7 ==> 100.0

The 10.2.7 runtime has the class 'AttributeLabelClass' that allows you to format the labels for graphics and add it to a GraphicsLayer such that all Graphics with a certain attribute will render the same way.
Does anyone know if anything like this survived into the 100.0+ timeframe? I've been looking all over for this with no luck (which usually means it's right in front of my nose).
I'm fairly sure something like this exists because I've seen prototype demos of their efforts to resolve label confliction rendering issues.
We're hoping to have this feature back in Update 1. The public API might not be fully complete by then, but you'll at least be able to set everything with the json definition, and a more full-blown API for all the properties by Update 2.

Tango / Unity: the TangoApplication resets values upon scene switch

Was chasing my tail endlessly trying to figure out why the new 3D reconstruction was working in some scenes but not others, only to discover that the TangoAplication script on the Tango Manager prefab is resetting to default when I switch scenes.
Is anyone else seeing this behavior, and did you get it to stop? I am assuming that scripting the setup of this is a somewhat easy fix, but there has got to be a less time-consuming fix for this bug?
Have not been able to replicate this behavior since I first experienced it so I'm marking this answered until I am able to replicate or find a cause for it.

KineticJS shape over image

I want to draw some shapes over an image.
After the image is loaded and added to the layer, I use the moveToBottom() function, which works for shapes but doesn't seem to work with images.
I've tried to use moveToTop() on the shapes, but still no luck.
Important note: I have to keep them on the same layer, so the obvious solution to put the image in another layer is not an option.
http://jsfiddle.net/hukNL/
This concept shows that layering functions work, so the error is somewhere else in your code.
First of all, you want to be using the newest KineticJS 4.3.1, then you want to make sure that if you are dragging images that you disable putting them in the dragOnTop layer that is now featured in the newer releases. Lastly, if nothing else works, then you could manually debug your code by checking the z-index of each item by using:
.getZIndex()
Also, if you would like more help, post some code so others can help you debug it.

Problem: Rendering stops with OpenGL on Mac OS X 10.6

I've been having problems and, after spending a week trying out all kinds of solutions and tearing my hair out, I've come here to see whether anybody could help me.
I'm working on a 3D browser plugin for the Mac (I have one that works on Windows). The only fully-hardware accelerated way to do this is to use a CAOpenGLLayer (or something that inherits from that). If a NSWindow is created and you attach the layer to that window's NSView then everything works correctly. But, for some reason, I can only get a specific number of frames (16) to render when passing the layer into the browser.
Cocoa calls my layer's drawInCGLContext for the first 16 frames. Then, for some unknown reason, it stops calling it. 16 seems like a very specific - and programmatic - number of frames and so I wondered whether anybody had any insight into why drawInCGLContext would not be called after 16 frames?
I'm reasonably sure it's not because I pass the layer into the browser - I've created a very minimal example plugin that renders a rotating quad using CAOpenGLLayer and that actually works. But the full plugin is a lot more complicated than that and I just don't know where to look anymore. I just don't know why drawInCGLContext stops being called. I've tried forcing it using CATransaction, it definitely gets sent the setNeedsDisplay message - but drawInCGLContext is never called. OpenGL doesn't report any errors either (I'm currently checking the results of all OpenGL calls). I'm confused! Help?
So, for anybody else who has this problem in future: You're trying to draw using the OpenGL context outside of the drawInCGLContext. There was a bug in the code where nearly all the drawing was happening from the correct place (drawInCGLContext) but one code path led to it rendering outside of there.
No errors are raised nor does glGetError return any problems. It just stops rendering. So if this happens to you - you're almost certainly making the same mistake I made!

Resources