- Sort Posts
- 58 replies
- Last post
Rendering engine to use with QCAR.
Rendering engine to use with QCAR.
Sorry, All
I am interested in Qcar sdk with min3d,
please,Can anyone send me the imagetarget-example code with min3d? ,too.
My email is t8590338@gmail.com
Thank you very much
Re: Rendering engine to use with QCAR.
Try using the Eclipse debugger to track down the null pointer. Take a look at line 85 of ImageTargetsRenderer.java, as the error suggests.
We don't have any tutorials for merging QCAR with 3rd party rendering engines at this time. I suggest looking into Unity and our Unity extension if you want a quick and easy way to get started with 3D content.
- Kim
Re: Rendering engine to use with QCAR.
min3D only supports OpenGL ES 1.1. The QCAR samples use OpenGL ES 2.0 by default. You can change this by opening up the jni/Android.mk file and setting the USE_OPENGL_ES_1_1 flag to true.
- Kim
thanks for reply kim,
i had already done that,now after all rendering in ImageTarget.cpp i commented this glDrawElements(GL_TRIANGLES, NUM_TEAPOT_OBJECT_INDEX, GL_UNSIGNED_SHORT,(const GLvoid*) &teapotIndices[0]);
so that i can draw with min3d drawScene method.
but now i got this
04-21 11:11:48.135: E/AndroidRuntime(21338): FATAL EXCEPTION: GLThread 11 04-21 11:11:48.135: E/AndroidRuntime(21338): java.lang.NullPointerException 04-21 11:11:48.135: E/AndroidRuntime(21338): at com.qualcomm.QCARSamples.ImageTargets.ImageTargetsRenderer.onDrawFrame(ImageTargetsRenderer.java:85) 04-21 11:11:48.135: E/AndroidRuntime(21338): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1388) 04-21 11:11:48.135: E/AndroidRuntime(21338): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1138)
my question is that how can can simply draw with min3d drawScene on top of qcar drawVideobackground... then on next step i like to pass pose matrix info to min3d so that model can be drawn relative to marker....
is it possible what i am trying ?
thanks in advance..
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
See this thread for help with passing the matrix from the native code to Java:
http://ar.qualcomm.at/node/2001930
- Kim
hi Kim,
thanks for replying.
is it possible to let qcar do all rendering and draw functionality is done by another renderer engine?
i am trying this but there is gl conflict between qcar and minb3d. as far as i understand .
how can i do this ?
Re: Rendering engine to use with QCAR.
Make sure you are using both the modelview (pose) and projection matrices provided by QCAR. Have you gotten that far?
- Kim
hi kim,
i had no luck i getting these values and passing them to another render engine(currently min3d),can you guide me to where i have to take these values and how to pass them to java code as min3d is in java....
thanks in advance
Re: Rendering engine to use with QCAR.
You can certainly use a rendering engine with the SDK. You will need to find one that works with OpenGL ES 1.1 or 2.0, and that can be compiled for the Android platform.
I believe Android OS 2.2 has Java bindings for much (but not all) of the OpenGL ES 2.0 spec, and perhaps better support for OpenGL ES 1.1. So it might be possible to find a Java rendering library that uses these calls, but it would probably need to be tailored against the Android SDK.
You will probably find a better selection of C++ OpenGL ES rendering libraries. Try finding one that already has an Android target, or one that you can easily cross-compile with the Android ndk-build system.
- Kim
hi kshiva;
it is good to see some people here trying to integrate min3d with qcar,i am also on my way but i am stuck with getting md2 model position with respect to tracking image..plz help me
thanks in advance.
Re: Rendering engine to use with QCAR.
Finally, with Kim's help I make it to work :D. So, it is possible to use min3d framework with AR SDK.
Thus, the files exported from Blender (.obj, .md2 (with animations) and .3DS) are directly loaded in the Java code instead of C, so no script is needed.Note: With previous version of AR SDK my sample app gives some problems, but with the new version (v0.10) it works perfect in my HTC Desire.
With ImageTargets as starting point, I import the min3d framework to my Android project and then I merge some Java classes that were in both framewoks/SDKs.
- QCARSampleActivity (from AR SDK) and RendererActivity (from min3d) are now a single class for me.
- Then some changes in Renderer.java and Scene.java.Finally I replace the code from ImageTargets.cpp that calls the OpenGL methods to draw geometry with some matrix update operations and ImageTargets.java inherits from the new class (the result of QCARSampleActivity and RendererActivity) and implements the code to import my md2 file.
Result: When the "chips" trackable is recognized my company logo is shown in motion over the trackable.:)
Therefore, my limitation right now is my poor knowledge of Blender.
hi martarodriguez ,
for my project i am doing an app with qcar...it is very interesting to see that what you are doing with min3d...can i get some code?
thanks in advance
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Amazing.
A four page thread about "Rendering engine to use with QCAR" and nobody mentions the Unity3d game engine. QCAR officially supports this, and it is very easy to use. Any newbie to OpenGL shouldn't even bother not to use Unity3d. It is a waste of time and effort trying to re-invent the wheel.
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
I've been trying to use Min3d with QCAR, but I'm stuck when trying to display the camera background and a 3D object ( the 3d car from the min3d example).
To accomplish this task, I've created a new Android project based on the sources of ImageTargets, I then removed all opengl code from the .cpp files and replaced some code in Render.java from the Ming3D source. The relevant lines I changed are the following :
// Render.java /** Called to draw the current frame. */ @Override public void onDrawFrame(GL10 gl) { // Update 'model' _scene.update(); // Update 'view' drawSetup(); HomeActivity.renderInstanceBeginHelper(); drawScene(); HomeActivity.renderInstanceEndHelper(); if (_logFps) doFps(); } // HomeActivity.java ( instead of ImageTargets.java ) /** The native render function. */ private static native void renderInstanceBegin(); private static native void renderInstanceEnd(); public static void renderInstanceBeginHelper() { renderInstanceBegin(); // this calls currentState = QCAR::Renderer::getInstance().begin(); } public static void renderInstanceEndHelper() { renderInstanceEnd(); // this calls QCAR::Renderer::getInstance().end(); }
The problem is that the render image gets corrupted after the camera tries to draw on screen, and so the 3d object I want to display is not properly shown. The first time onDrawFrame is called, the whole car is correctly seen. the second time it is called, it seems the camera wants to display something in the background and the car is seen from a wrong perspective and the next calls, there is no more camera background and the car is still and seen like in 2D.
If I comment the line drawScene(); the backgound gets what the camera sees. If I comment the lines renderInstanceBeginHelper() and renderInstanceEndHelper() We can see the camaro turn in 3D as in the Min3d example, but without the camera background.
I'm wondering if the opengl state gets corrupted when calling renderInstanceBeginHelper() and so Ming3D won't properly work after that. Has anyone faced this problem ? Or do you have a hint on how to save the opengl state between calls of qcar and min3d ?
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Finally, with Kim's help I make it to work :D. So, it is possible to use min3d framework with AR SDK.
Thus, the files exported from Blender (.obj, .md2 (with animations) and .3DS) are directly loaded in the Java code instead of C, so no script is needed.Note: With previous version of AR SDK my sample app gives some problems, but with the new version (v0.10) it works perfect in my HTC Desire.
With ImageTargets as starting point, I import the min3d framework to my Android project and then I merge some Java classes that were in both framewoks/SDKs.
- QCARSampleActivity (from AR SDK) and RendererActivity (from min3d) are now a single class for me.
- Then some changes in Renderer.java and Scene.java.Finally I replace the code from ImageTargets.cpp that calls the OpenGL methods to draw geometry with some matrix update operations and ImageTargets.java inherits from the new class (the result of QCARSampleActivity and RendererActivity) and implements the code to import my md2 file.
Result: When the "chips" trackable is recognized my company logo is shown in motion over the trackable.:)
Therefore, my limitation right now is my poor knowledge of Blender.
Do you want to share your source code with us?
Re: Rendering engine to use with QCAR.
Hi Marta, i'm really happy to now about another 3d engine/framework compatible with QCAR. Few months ago I tested JPCT-AE (http://www.jpct.net/jpct-ae/) java 3D engine with QCAR and I positioned complex 3D scene on top of "chips" imagemarker. The problem was the low frame rate, I had to create 2 glsurfaces, the original glsurface on imagetarget sample (to render the camera), and another one to render my scene with jpct-ae. At the end of the day i had a poor frame rate handled by 2 rendering threads trying to have priority on the processor.
Could you please tell me about the performance of your implementation? and if you found a way to merge qcar with min3D, not using various glsurfaces, could you explain in more detail how you did it?
definately min3d could be my solution... :-D
Thank you!
Paula.
PD: mi email es
, por si te interesa que pongamos nuestra experiencia en común con los motores 3d y qcar! ;)
Re: Rendering engine to use with QCAR.
Hi Marta, i'm really happy to now about another 3d engine/framework compatible with QCAR. Few months ago I tested JPCT-AE (http://www.jpct.net/jpct-ae/) java 3D engine with QCAR and I positioned complex 3D scene on top of "chips" imagemarker. The problem was the low frame rate, I had to create 2 glsurfaces, the original glsurface on imagetarget sample (to render the camera), and another one to render my scene with jpct-ae. At the end of the day i had a poor frame rate handled by 2 rendering threads trying to have priority on the processor.
Could you please tell me about the performance of your implementation? and if you found a way to merge qcar with min3D, not using various glsurfaces, could you explain in more detail how you did it?
definately min3d could be my solution... :-D
Thank you!
Paula.
Re: Rendering engine to use with QCAR.
Finally, with Kim's help I make it to work :D. So, it is possible to use min3d framework with AR SDK.
Thus, the files exported from Blender (.obj, .md2 (with animations) and .3DS) are directly loaded in the Java code instead of C, so no script is needed.
Note: With previous version of AR SDK my sample app gives some problems, but with the new version (v0.10) it works perfect in my HTC Desire.
With ImageTargets as starting point, I import the min3d framework to my Android project and then I merge some Java classes that were in both framewoks/SDKs.
- QCARSampleActivity (from AR SDK) and RendererActivity (from min3d) are now a single class for me.
- Then some changes in Renderer.java and Scene.java.
Finally I replace the code from ImageTargets.cpp that calls the OpenGL methods to draw geometry with some matrix update operations and ImageTargets.java inherits from the new class (the result of QCARSampleActivity and RendererActivity) and implements the code to import my md2 file.
Result: When the "chips" trackable is recognized my company logo is shown in motion over the trackable.:)
Therefore, my limitation right now is my poor knowledge of Blender.
Re: Rendering engine to use with QCAR.
This is exciting, I'd love to see this work. It sounds like there is an issue with the merging of the two Activities. QCAR wants to be responsible for creating the OpenGL context, perhaps there is a conflict there. Or it might also be a problem with initialization. QCAR's initialization procedure is asynchronous, so perhaps it isn't matching up well with min3d's initialization process.
Would it be possible to send your work-in-progess to me at
? I can take a look, and we can report back here with our findings :)
Thanks!
- Kim
Re: Rendering engine to use with QCAR.
I'm back. Now with a new target.
I have found googling a Android library "min3d" to load .obj files directly, without parsing. It only uses Java.
I have done some tests and it works great, further you can load animations with md2 files.
So, is it possible to use QCAR with this library? I mean, use QCAR to detect the trackable and then send a message to Java and Java will draw the geometry with min3d.
I have created a new project with Image Targets and Shared (both in one project) and included the library min3d. My problem is that both libraries (QCAR and min3d) have a class that inherits from Activity, but only I need one, so I did that QCARSampleActivity inherits from RendererActivity class from min3d.
I execute the project and I see the geometry drawn by min3d but not the camera view.
Any help will be aprecciated (I know that it's a bit difficult to understand the problem).
Thanks in advanced,
Re: Rendering engine to use with QCAR.
Finally, with Kims help I get it to work. It works great in HTC Desire.
[B" />Initial target[/B" />: Replace teapot in ImagetTargets project with my own geometry for "chips" target.
Starting from ImageTargets changes I did:
[=1" />
[*" />Design geometry in blender (without textures)
[*" />Convert blender geometry to OPENGL arrays with this script
[*" />Set USE_OPENGL_ES_1_1 to true in the Android.mk file (in the jni folder). I only use OPENGL ES 1.1 version.
[*" />Change the size of the target in the config.xml file (in the assets folder).
[*" />Change the near/far values of the projection matrix to work with the new target size.
[*" />Disable GL_TEXTURE_2D
[*" />Added a light to test out the normals.
[/LIST" />
Regards[/list]
Re: Rendering engine to use with QCAR.
When you draw an object in OpenGL, you start with a list of vertices (points in 3D space). You may also have a list of normals, used for lighting, and a list of texture coordinates, used for mapping a texture on the object. These three lists can then be used to render the object in two basic ways:
1) Using glDrawArrays. This will draw primitives (typically triangles) in the order they appear in the lists.
2) Using glDrawElements. This takes an additional array of indices, which points into your other lists to draw the primitives.
Your model format will either contain indices or not, which should tell you which method to use. Read up on glDrawArrays and glDrawElements for more info.
- Kim
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
You are correct that if you don't have indices you need to use glDrawArrays instead of glDrawElements. The problem is that you are working with the OpenGL ES 2.0 code, which depends on shaders, and those shaders are expecting texture coordinates right now. Have you changed the shaders in samples/Shared/jni/CubeShaders.h to render with a solid color rather than looking up a texture color?
It might be easier to start with the OpenGL ES 1.1 code, which doesn't depend on shaders. In the ImageTargets project, you would work with the code surrounded by #ifdef USE_OPENGL_ES_1_1. You will need to open the ImageTargets/jni/Android.mk file and set the USE_OPENGL_ES_1_1 flag to true. Now you can safely comment out the texture lines, and you could apply a color using glColor4f instead.
If you are still having trouble, feel free to send me your model file and I will try it on my end.
- Kim
Re: Rendering engine to use with QCAR.
Sorry, I've not worked with 3D objects for a while now.
I'm sure you could calculate the indices yourself and manually type them out?
When I was doing 3D graphics we did everything manually. It took forever but you got the exact results you were wanting.
Thanks for the link.
Rob.
Re: Rendering engine to use with QCAR.
Hi,
Finally, I have exported a .obj file from blender (where I designed my 3D object) and I have found in Internet a script that parses the obj file.
Now I have a header file with two arrays: vertex and normals.
However, it doesn't work. :confused:
I started with ImageTargets and after some changes here is my code.
... glVertexAttribPointer(vertexHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &akting2Verts[0]); glVertexAttribPointer(normalHandle, 3, GL_FLOAT, GL_FALSE, 0, (const GLvoid*) &akting2Normals[0]); glEnableVertexAttribArray(vertexHandle); glEnableVertexAttribArray(normalHandle); glDrawArrays(GL_TRIANGLES, 0, akting2NumVerts); ...
I can't use "glDrawElements" because I haven't got indices. How can I get it works?
Thanks in advanced,
Marta
Re: Rendering engine to use with QCAR.
Re: Rendering engine to use with QCAR.
Hi all,
I have exported a .x file with Deep Exploration, but now I don't now how to get the coordinates. I need vertices, normals, texCoords and indices as is in teapot.h file.
Can someone explain me how to get the information from the .x file?
Thanks in advanced,
Marta
Hi. Would somebody please send me a copy of the min3d-QCAR code?
sudhir6yadav@gmail.com
I really appreciate it. Thanks a lot