[osg-users] [osgCompute] OpenGL sync object and OSG

2013-07-11 Thread Sajjadul Islam
Hi forum,

To Synchronize the data transfer between the GPU(OpenCL) and CPU i need to use 
the OpenGL Sync object. If i have to code in OpenGL , the snippet could be laid 
out as follows:


Code:


cl_event release_event;
cl_int  errNum;

//OpenGL fence object is created. This creates and inserts a fence sync into
//OpenGL command stream
GLSync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE,0);

//The following command creates an OpenCL event linked to the fence. The OpenCL 
//event is then used in the event list for clEnqueueAcquireGLObjects(), 
ensuring that
//the acquire call will proceed only after the fence has completed. 
cl_event gl_event = clCreateEventFromGLsyncKHR(context,sync,NULL);

errNum = clEnqueueAcquireGLObjects(commandQueue,1,&cl_tex_mem,0,&gl_event,NULL);

//Several other OpenCL commands go on here - mainly kernel execution that will 
//be handled by the computation node


//The following command will return an event object and stored in the 
release_event. 
//It can be used to sync upon its completion
errNum = 
clEnqueueReleaseGLObjects(commandQueue,1,&cl_tex_mem,0,NULL,&release_event);

//creates the OpenGL sync object linked to the release_event
GLsync cl_sync = glCreateSyncFromCLeventARB(context, release_event,0);

//a wait is inserted into the OpenGL command stream
//that will wait upon the completion of the release_event associated with the 
clEnqueueReleaseGLObjects(). 
glWaitSync(cl_sync,0, GL_TIMEOUT_IGNORED);



 

Please Avoid the OpenCL references if it does not make any sense to you. I need 
some hint on how the gl commands will be distributed in pre and post draw 
callbacks.

Should i create two separate classes that deals with the pre draw callback and 
post draw callback or just post draw callback will be enough?



Best Regards
Sajjadul

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=55196#55196





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-11 Thread John Moore
Dear Jordi Torres,
thank you for your suggestion. I downloaded the SVN version of OpenSceneGraph 
and built it for Android.
Now I am able to run the Example without crash.
However I get some errors and I can't see any rendered 3d model. 

This is the log of the app.

Code:

07-10 23:02:52.770: W/EGLview(14138): creating OpenGL ES 2.0 context
07-10 23:02:52.790: E/OSGANDROID(14138): Initializing geometry
07-10 23:02:52.790: E/Osg Viewer(14138): Testing
07-10 23:02:52.800: W/Osg Viewer(14138): Warning: detected OpenGL error 
'invalid enumerant' at Before Renderer::compile
07-10 23:02:52.830: E/OSGANDROID(14138): Initializing geometry
07-10 23:02:52.830: E/Osg Viewer(14138): Testing
07-10 23:02:52.840: W/Osg Viewer(14138): Warning: detected OpenGL error 
'invalid enumerant' at Before Renderer::compile
07-10 23:08:08.958: W/SurfaceView(14138): CHECK surface infomation 
creating=false formatChanged=false sizeChanged=false visible=false 
visibleChanged=true surfaceChanged=true realSizeChanged=false 
redrawNeeded=false left=false top=false
07-10 23:08:09.278: W/IInputConnectionWrapper(14138): showStatusIcon on 
inactive InputConnection
07-10 23:08:53.751: D/libEGL(15910): loaded /system/lib/egl/libEGL_mali.so
07-10 23:08:53.761: D/libEGL(15910): loaded /system/lib/egl/libGLESv1_CM_mali.so
07-10 23:08:53.761: D/libEGL(15910): loaded /system/lib/egl/libGLESv2_mali.so
07-10 23:08:53.771: W/EGLview(15910): creating OpenGL ES 2.0 context
07-10 23:08:53.781: D/dalvikvm(15910): Trying to load lib 
/data/data/osg.AndroidExample/lib/libosgNativeLib.so 0x41a44740
07-10 23:08:53.901: D/dalvikvm(15910): Added shared lib 
/data/data/osg.AndroidExample/lib/libosgNativeLib.so 0x41a44740
07-10 23:08:53.901: D/dalvikvm(15910): No JNI_OnLoad found in 
/data/data/osg.AndroidExample/lib/libosgNativeLib.so 0x41a44740, skipping init
07-10 23:08:53.911: E/OSGANDROID(15910): Initializing geometry
07-10 23:08:53.911: E/Osg Viewer(15910): Testing
07-10 23:08:53.921: W/Osg Viewer(15910): Warning: detected OpenGL error 
'invalid enumerant' at Before Renderer::compile





In attachment you can see a screenshot of the app running on my Galaxy S III 
mini. As you can see from the screenshot there's nothing rendered on the 
screen. The buttons seem to work correctly because when I press them a label on 
the screen appears indicating the status of the button.

What is the problem in your opinion?

Thank you again,

John


Jorge Izquierdo Ciges wrote:
> Osg in Android is not emulator-friendly... and the EGL libraries seem from 
> emulator instead of a proper device.
> 
> 
> 2013/7/8 John Moore < ()>
> 
> > Hi Adun (),
> > I have done as you said. There was no libgnustl_static.a in the 
> > $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a folder, so I copied it from 
> > ANDROID_NDK folder. Specifically I copied it from
> > $ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a folder
> > 
> > 
> > The build-ndk now seems ok, except some warnings that were treated as 
> > errors because of the -Werror flag in the LOCAL_CFLAGS.
> > These are the warnings:
> > 
> > Code:
> > 
> > jni/osgNativeLib.cpp: In function 'void 
> > Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv*, jobject, jstring)':
> > jni/osgNativeLib.cpp:78:70: error: converting 'false' to pointer type for 
> > argument 2 of 'char const* _JNIEnv::GetStringUTFChars(jstring, jboolean*)' 
> > [-Werror=conversion-null]
> > jni/osgNativeLib.cpp: In function 'void 
> > Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv*, jobject, jstring, 
> > jstring)':
> > jni/osgNativeLib.cpp:87:70: error: converting 'false' to pointer type for 
> > argument 2 of 'char const* _JNIEnv::GetStringUTFChars(jstring, jboolean*)' 
> > [-Werror=conversion-null]
> > jni/osgNativeLib.cpp:88:64: error: converting 'false' to pointer type for 
> > argument 2 of 'char const* _JNIEnv::GetStringUTFChars(jstring, jboolean*)' 
> > [-Werror=conversion-null]
> > cc1plus: all warnings being treated as errors
> > 
> > 
> > 
> > 
> > I removed the -Werror flag and I was able to successfully complete 
> > ndk-build.
> > 
> > However when I run the app on ADT, it crashes with this output:
> > 
> > Code:
> > 
> > 07-08 17:32:14.799: D/(633): HostConnection::get() New Host Connection 
> > established 0x2a117488, tid 633
> > 07-08 17:32:14.809: D/libEGL(633): loaded 
> > /system/lib/egl/libEGL_emulation.so
> > 07-08 17:32:14.809: D/(633): HostConnection::get() New Host Connection 
> > established 0x2a117530, tid 647
> > 07-08 17:32:14.829: D/libEGL(633): loaded 
> > /system/lib/egl/libGLESv1_CM_emulation.so
> > 07-08 17:32:14.861: D/libEGL(633): loaded 
> > /system/lib/egl/libGLESv2_emulation.so
> > 07-08 17:32:14.899: W/EGLview(633): creating OpenGL ES 2.0 context
> > 07-08 17:32:14.899: W/dalvikvm(633): threadid=11: thread exiting with 
> > uncaught exception (group=0x40a13300)
> > 07-08 17:32:14.909: E/AndroidRuntime(633): FATAL EXCEPTION: GLThread 75
> > 07-08 17:32:14.909: E/AndroidRuntime(633): 
> > java.lang.Illeg

Re: [osg-users] Crash in LightSpacePerspectiveShadowMap

2013-07-11 Thread Jan Ciger
Hi Wojciech,

On Thu, Jul 11, 2013 at 1:04 AM, Wojciech Lewandowski
 wrote:
> Hi Jan,
>
> This looks like interesting problem to debug ;-P but unfortunately I am
> really swamped. At least for month if not more.

No problem, I am not using this shadow technique atm, so it is not a
blocker for me.

>
> There is one thing you may try to improve that precision. Especially if you
> use geocentric earth model. Try setting up modelling frame. osgshadow
> example shows how to do that. If this not helps ... I  will not be able to
> help otherwise too soon. Sorry.

I was using a simple scene with a skybox/dome fixed relative to the
eye, a 100x100 plane at the origin and a simple golem and the OSG cow
at the origin, nothing like the Earth model. I don't have a
CoordinateSystemNode in the scene.

However, yes, it could be a precision error, because the crash
typically happens when I move the camera away from the object.
Probably setting a lower limit on the size of the polyhedron beyond
which the shadow isn't going to be rendered would work around the
issue.

Regards,

Jan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org