[osg-users] Thoughts on Vulkan

2015-03-15 Thread Preet
Hey all,

Now that the Khronos group has announced Vulkan/SPIR-V, are there any plans
to integrate it into OSG as an alternative back end?


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


Re: [osg-users] osg+osm

2013-09-17 Thread Preet
On Tue, Sep 17, 2013 at 11:09 AM, Айдар Ильдарович e...@inbox.ru wrote:
 Hello!
 I use OpenSceneGraph 3.0.1 in my research.
 Please, help me, how to use and to load files of OpenStreetMap (extension
 o5m, pbf, osm) in osgviewer.

You can't do this directly. The files have to be opened and parsed
using another library and then you need to decide how to set up your
scene graph based on your needs. How would OpenSceneGraph know what
you want to do with an OpenStreetMap node or way and other such
elements?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
I wasn't able to build the static version of OpenSceneGraph using the
provided guide, so I tried building a shared version directly using CMake
and the Android NDK toolchain which seems to have worked.

The problem I have right now is with osgPlugins-x.y.z being prefixed to the
search path by OSG. As an experiment, I put some osgPlugins in the sdcard
folder (external storage) /sdcardpath/osgPlugins-x.y.z/ and if I explicitly
specify this path (/sdcardpath) to the osgDB::Registry, it loads the
plugins just fine. This isn't okay for general app deployment though.

I was able to pack shared object (plugin) files without a 'lib' prefix in
the APK/lib directory. I'm unable to create any more directories in
APK/lib. Unfortunately I can't load these because (I think) OSG is
prefixing the path with osgPlugins-x.y.z.. I want to disable this
behavior so I can package the app properly.


On Tue, Sep 10, 2013 at 3:32 PM, Jorge Izquierdo Ciges jori...@gmail.comwrote:

 Android has a serie of troubles:

 1rst every library has to begin with lib if has to be included in the APK
 2nd every library has to be loaded at the first try or will never be
 loaded until you close your application
 3rd If your library needs a dependence he will not load it even if its on
 the same directory

 So... 1rst - OSG searches plugins without lib at the begin and they are
 compiled with lib if my memory is well enough.
 2nd  - this is confirmed for versions pre 4.2
 3rd   - this is confirmed for versions pre 4.2

 At least on a Nexus 4 the 2/3 don't happen anymore with the last version.
 I have OSG with shared libraries and plugins in Android but it is far from
 submission because we changed a lot of things and we are checking
 everything thrice, so don't expect it soon.

 But... you can make it work, my phone is proof.


 2013/9/10 Preet prismatic.proj...@gmail.com

 m to create an osgPlugins directory where OSG ends up being deployed in
 the application package so I just want OSG to load plugins from the
 directory where the rest of the shared objects live on Android:

 /data/app-lib/org.some.app/--- where all the *.so libraries live,
 including osgdb_xx.so




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


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


[osg-users] Possible bug with OpenSceneGraph for OpenGL ES 2

2013-09-10 Thread Preet
Hi,

I've noticed on two separate platforms (PowerVR SGX 540 Adreno 320) that
OSG will put out a warning when textures are used:

 Warning: detected OpenGL error 'invalid enumerant' after applying GLMode
0xde1

GLMode ox0de1 is GL_TEXTURE_2D.

In include/osg/State, when the applyModeOnTexUnit function is invoked,
glEnabled(GL_TEXTURE_2D) and glDisable(GL_TEXTURE_2D) may be called. On
some OpenGL ES 2 platforms, this will return GL_INVALID_ENUMERANT because
GL_TEXTURE_2D is always enabled for OpenGL ES 2.

A possible fix is to wrap the glEnable and glDisable calls with an #ifndef
OSG_GLES2_AVAILABLE, but there might be a better place to address this.


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


[osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
I'm having issues trying to get OSG to load plugins on Android for a shared
library build... though OSG seems to be working fine on Android as a shared
lib without plugins which is great!

I can't seem to create an osgPlugins directory where OSG ends up being
deployed in the application package so I just want OSG to load plugins from
the directory where the rest of the shared objects live on Android:

/data/app-lib/org.some.app/--- where all the *.so libraries live,
including osgdb_xx.so

So I do this:
osgDB::Registry::instance()-setLibraryFilePathList(/data/app-lib/org.some.app);

But it seems like its prefixing 'osgPlugins-3.3.0' to its search path. This
is the output I get from OSG:

Warning: dynamic library 'osgPlugins-3.3.0/osgdb_png.so' does not exist
(or isn't readable):
Cannot load library: load_library(linker.cpp:745): library
osgPlugins-3.3.0/osgdb_png.so not found
DynamicLibrary::failed loading osgPlugins-3.3.0/osgdb_png.so

Is there something else I need to do to specify the path where it should
search?

Is there a way to avoid creating an osgPlugins folder altogether as a build
option and just have it look for the plugins without prefixing anything to
their path?

I ran across this problem when using OSG for another platform as well and
worked around it using a few tricks but Android is much less tolerant in
this regard.


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


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
On Tue, Sep 10, 2013 at 3:32 PM, Jorge Izquierdo Ciges
jori...@gmail.com wrote:
 So... 1rst - OSG searches plugins without lib at the begin and they are 
 compiled with lib if my memory  is well enough.

You were right. I was able to build an APK with the plugin files
(named osgdb_xx.so) but after deploying to the device itself all the
plugin shared objects were no longer in /data/app-lib/org.some.app/

 I have OSG with shared libraries and plugins in Android but it is far from 
 submission because we
 changed a lot of things and we are checking everything thrice, so don't 
 expect it soon.

Do you have a public repo where you are testing this out? I suspect
you're setting up a build similar to the static one where CMakeLists
will do most of the magic. My build notes are here (still have to add
some stuff, but its mostly complete:
https://github.com/preet/scratch/wiki/OpenSceneGraph-on-Android)


On Tue, Sep 10, 2013 at 6:10 PM, Raphael Grasset
raphael.gras...@gmail.com wrote:

 Hi Preet,

 For the path prefix, not sure if it works, but look at 
 src/osgDB/Registry.cpp, and the function createLibraryNameForExtension, you 
 will see a:
 std::string prepend = 
 std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/);

 so if you create an empty string it may address your path issue.

This set me on the right path to try an alternative once I realized I
couldn't pack the default osgdb_xx.so plugins in with the APK libs. I
used the osgPlugins CMake and set the TARGET_DEFAULT_PREFIX to
libosgdb_ (and modified createLibraryNameForExtension accordingly).
Prefixing them with lib meant they actually showed up on the device
when I deployed the APK... and I just ended up loading the plugins
directly with the linker (ie i just explicitly linked against them
when I built the app).

Doing all that takes a lot of effort though... it's cleaner (from
OSG's stand point) to save the plugins in internal storage and access
them that way. The cost with that method is the plugins have to be
packed and then extracted/installed during the application's first
run.

 Yet, it will be preferable that you build everything in static mode: what was 
 the reasons your static built didn't work?

I was able to configure the build using CMake successfully, but
calling make in the build directory fails with a bunch of 'undefined
reference to' errors:

I explained it briefly here:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2013-September/064587.html


Regards,

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


[osg-users] Android build fails with osg from git

2013-09-05 Thread Preet
Hiya,

I think some of the recent code wrt osgPresentation is causing the Android
build to fail. Here's my cmake config call:

cmake \
-DOSG_BUILD_PLATFORM_ANDROID=ON \
-DANDROID_NDK=/home/preet/Dev/env/sys/android-ndk-r8e \
-DCMAKE_INSTALL_PREFIX=/home/preet/Dev/env/android/osg-git-debug \
-DOSG_GL1_AVAILABLE=OFF \
-DOSG_GL2_AVAILABLE=OFF \
-DOSG_GL3_AVAILABLE=OFF \
-DOSG_GLES1_AVAILABLE=OFF \
-DOSG_GLES2_AVAILABLE=ON \
-DOSG_GL_LIBRARY_STATIC=OFF \
-DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF \
-DOSG_GL_MATRICES_AVAILABLE=OFF \
-DOSG_GL_VERTEX_FUNCS_AVAILABLE=OFF \
-DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=OFF \
-DOSG_GL_FIXED_FUNCTION_AVAILABLE=OFF \
-DANDROID_ABI=armeabi-v7a \
-DANDROID_PLATFORM=8 \
-DANDROID_STL=gnustl_shared \
-DANDROID_DEBUG=ON \
../osg-src

Here's the resulting error:
make[3]: *** No rule to make target
`/home/preet/Downloads/build/osg/src/osgPresentation/Model.cpp', needed by
`obj/local/armeabi-v7a/objs-debug/osgPresentation/Model.o'.  Stop.

Also... I get a bunch of warnings during compile (unrelated to the
presentation error -- this is with older commits as well). The following
line is output 100's of times.

Android NDK: WARNING: Invalid LOCAL_CPP_EXTENSION values: cpp

This doesn't seem normal... Should I be concerned about it?


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


Re: [osg-users] Android build fails with osg from git

2013-09-05 Thread Preet
Hmm. Even with the osgPresentation issue fixed, I'm unable to build the
libs

I get hundreds of errors like:

/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi-v7a/objs-debug/osgDB/SharedStateManager.o: in function
construction vtable for
osg::NodeVisitor-in-osgDB::SharedStateManager:SharedStateManager.cpp(.
data.rel.ro+0x158): error: undefined reference to 'virtual thunk to
osg::NodeVisitor::~NodeVisitor()'
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi-v7a/objs-debug/osgDB/SharedStateManager.o: in function
construction vtable for
osg::NodeVisitor-in-osgDB::SharedStateManager:SharedStateManager.cpp(.
data.rel.ro+0x15c): error: undefined reference to 'virtual thunk to
osg::NodeVisitor::~NodeVisitor()'
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld:
./obj/local/armeabi-v7a/objs-debug/osgDB/Version.o: in function
osgDBGetVersion:/home/preet/Downloads/build/osg-3.2.0/src/osgDB/Version.cpp:20:
error: undefined reference to 'osgGetVersion'
collect2: ld returned 1 exit status
make[3]: *** [obj/local/armeabi-v7a/libosgDB.so] Error 1
make[2]: *** [Android-OpenSceneGraph] Error 2
make[1]: *** [CMakeFiles/ndk.dir/all] Error 2


I thought this might be related to:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2013-July/063911.html

But I'm having issues building the libs -- haven't gotten to the part where
I try out an example yet... in any case, I tried adding a

LOCAL_LDFLAGS :=
/home/preet/Dev/env/sys/android-ndk-r8e/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a
(or shared ... I tried to build both but they both fail at the same point)

to the top level Android.mk file in the cmake build dir but that doesn't
help.

Any advice would be appreciated.


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


Re: [osg-users] Solving forum.openscenegraph.org problems

2013-07-31 Thread Preet
I second the StackExchange suggestion if the mailing list and forums are
going to be replaced by one system. StackExchange sites are much easier to
search through than relying on Google to look up things in the mailing list
or forums. I think it'd cut down on repeat questions a lot (how many users
here have been told by a more experienced OSG user to go back and search
through the lists because the question being asked has been discussed
before? I know I have!)

It's also much easier to integrate code snippets and images to provide
better questions and answers. There are plenty of OSG questions on
StackOverflow so one can get an idea of how that kind of site would look.

Regarding user registration - I never really understood the point of having
your full name being a mandatory thing for the forum sign up. Is it a
courtesy thing? Is it to prevent spam?


Preet


On Wed, Jul 31, 2013 at 1:36 PM, Alexandre Vaillancourt 
alexandre.vaillancourt.l...@gmail.com wrote:

 Another idea could be to use a system like StackExchange.

 This probably does not have an option to offer support by email, though.
 And if there is an aim for 'growing the community', I'm not sure that it's
 the right path. However the 'QA' process is fantastic.


 --
 Alexandre Vaillancourt

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


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


Re: [osg-users] OpenSceneGraph transformation precision

2013-07-31 Thread Preet
It looks like a common precision issue in OpenGL -- you can't directly pass
planetary scale values since you're limited to floats. To get around this,
parent your Geodes with a Transform node as you did in your second example.

See this mailing list thread for more info:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2012-February/056373.html
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Text with transparent background

2013-07-31 Thread Preet
Is blending enabled in the scene graph? ie
rootNode-getOrCreateStateSet()-setMode(GL_BLEND,osg::StateAttribute::ON);


On Fri, Jul 19, 2013 at 3:05 AM, Xiangfei Cui sophist...@gmail.com wrote:

 Hi,

 There are two osg::Drawables. One is a filled red polygon, the other is a
 white Text on the polygon. I wish as to the Text's background is
 transparent  so I can see red background, but the result is wrong. as to
 the figure:


 Thank you!

 Cheers,
 Xiangfei

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




 Attachments:
 http://forum.openscenegraph.org//files/qq20130719120253_166.bmp


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

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


Re: [osg-users] load many and big bmp image into textures

2013-07-31 Thread Preet
1. If you use osg::ref_ptr for your Texture2D objects, they should be
cleaned up when you remove any references to them (ie just remove the
geode(s) the texture is attached to or any other references to the texture)

2. bad_alloc usually means you're running out of memory.


On Fri, Jul 26, 2013 at 2:48 AM, Nat Doublet doub...@cgxaero.com wrote:

 Hi,
 I cut an image in 16*16 bitmap files (12M each). I want to put one by one
 in an osg::texture2d, after use, I want to unload it just after (to avoid
 trouble with memory).

 My code is :
 [code]
 std::pairint, int XY = std::make_pair(ix, iy);
 osg::StateSet* p_stateSet = geode-getOrCreateStateSet();
 osg::Texture2D* texture = new osg::Texture2D();
 texture-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::REPEAT);
 texture-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::REPEAT);
 std::string fileImg = p_mapXYImgFileName.at(XY);

 texture-setImage(osgDB::readImageFile(fileImg, p_option));

 p_stateSet-setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
 geode-setStateSet(p_stateSet);
 p_stateSet-releaseGLObjects();
 [/code]

 2 questions :
 1. because I cannot call texure2d destructor (same for stateset), am I
 right to try to free memory with releaseGLObjects? (my computer don't want
 to manage with 2Gb of data loaded)

 2.After iterations on X, Y (not always the same number), I go a bad
 allocation error on the texture-setimage()...
 [code]
 Exception Microsoft C++ : std::bad_alloc à l'emplacement mémoire
 0x0019c54c.
 bad allocation
 [/code]

 Have you got an idea? some wayround?

 Thank you!

 Cheers,
 Nat

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





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

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


[osg-users] How do I build OpenSceneGraph as a shared lib without sonames?

2013-06-23 Thread Preet
Hi,

I'm building for a platform where I can't use sym links when packaging an
application and soname versioning complicates the deploy process. Is there
a way to tell osg/cmake that I don't want to build versioned libraries with
sonames?


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


Re: [osg-users] How do I build OpenSceneGraph as a shared lib without sonames?

2013-06-23 Thread Preet
Easy fix;

In the main CMakeLists.txt simply change

# We want to build SONAMES shared librariess
SET(OPENSCENEGRAPH_SONAMES TRUE) -- change to false
SET(OPENTHREADS_SONAMES TRUE) --- change to false

Would be cool to have a cmake option that controls this though
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using osg::Camera without a view

2013-06-15 Thread Preet
Hiya,

This is a bit of a strange question. I want to use an osg::Camera purely as
a shell object to use some of its handy methods (ie. all the setters and
getters for the various view/model/projection matrices). Can I do this
without setting up a viewer or invoking any OpenGL code (assume inactive
context)?

If I do something like:

// note there's no osgViewer here
osg::Camera cam;
cam.setViewport(...);
cam.setViewMatrixAsLookAt(...);
cam.setProjectionMatrixAsPerspective(...);
osg::Matrixd viewMatrix = cam.getViewMatrix();

Will this 'just work'? Or is there internal stuff in osg::Camera that needs
the object to belong to a viewer / have a proper view/context/etc setup?


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


Re: [osg-users] qmlosg (QtQuick + osg integration)

2013-06-01 Thread Preet
Hi Riccardo,

I can't speak to the specific slow down you're encountering with context
switches. I tried to solve a similar problem (osg in qt quick) but I don't
use context switching -- I could never figure out how to get that to work
correctly so I'll have to go through what you did carelfully :)

Have you checked out the following docs:

http://doc-snapshot.qt-project.org/qt5-dev/qtquick/qtquick-visualcanvas-scenegraph.html
http://doc-snapshot.qt-project.org/qt5-dev/qtquick/quick-scenegraph-textureinsgnode.html
http://doc-snapshot.qt-project.org/qt5-dev/qtquick/quick-scenegraph-textureinthread.html

And here's my attempt [copy of the method used in the docs but with an osg
embedded viewer and *no* context switching -- I just reset some specific
state]

https://github.com/preet/scratch/tree/master/qt5/qquickfboviewport
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] How can I check which objects are frustum culled?

2013-03-21 Thread Preet
Is it possible to get a list of nodes that *do* pass the cull test then
(outside of the obvious 'look at whats rendered')?


Preet


On Thu, Mar 21, 2013 at 5:02 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Preet,

 The OSG cull traversal doesn't track the objects that are culled, only
 the ones that pass the cull test.

 Robert.

 On 21 March 2013 02:36, Preet prismatic.proj...@gmail.com wrote:
  Hiya,
 
  In my scene I'd like to check which nodes are being culled before
 rendering
  due to frustum culling. The culling mode I use my main (only) camera is
  osg::CullSettings::VIEW_FRUSTUM_SIDES_CULLING. Is it possible to do this?
  Can I get a list of objects that are culled, or something similar?
 
 
  Preet
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

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


Re: [osg-users] How can I check which objects are frustum culled?

2013-03-21 Thread Preet
Hi Robert,


 Or... just use the Stats feature that
 does just this.  Have a look at the src/osgViewer/StatsHandler.cpp to
 see how the Stats collection can be enabled and used.


Thanks for the quick reply, this worked great. I'm just posting a small
snippet in case anyone else searches the list for something similar since
it took me a little while to narrow down what I was looking for.

// enable stat collection for scene
myViewer-getStats()-collectStats(scene,true);

// enable stat collection for camera (do this after rendering/everything is
setup)
myViewer-getCamera()-getStats()-collectStats(scene,true);

// dump some stats in between frame calls
osg::Stats * sceneStats = m_osg_viewer-getCamera()-getStats();
osg::Stats::AttributeMap attMap =
sceneStats-getAttributeMap(sceneStats-getLatestFrameNumber());

size_t numObjects = 0;
size_t numTris = 0;
size_t numVx = 0;
osg::Stats::AttributeMap::iterator amIt;
for(amIt  = attMap.begin();
amIt != attMap.end(); ++amIt)
{
std::cout  amIt-first  ,  amIt-second  std::endl;
}
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How can I check which objects are frustum culled?

2013-03-20 Thread Preet
Hiya,

In my scene I'd like to check which nodes are being culled before rendering
due to frustum culling. The culling mode I use my main (only) camera is
osg::CullSettings::VIEW_FRUSTUM_SIDES_CULLING. Is it possible to do this?
Can I get a list of objects that are culled, or something similar?


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


Re: [osg-users] problem of rendering overlaped models.

2013-02-16 Thread Preet
When you say weird what do you mean? If you have polygons that are
positioned/aligned very closely to one another you might be seeing
z-fighting (http://www.zeuscmd.com/tutorials/opengl/15-PolygonOffset.php).
In that case you can tell OpenSceneGraph to use polygon offset on one of
the models.

osg::ref_ptrosg::PolygonOffset polyOffset = new osg::PolygonOffset;
polyOffset-setFactor(1.0f);
polyOffset-setUnits(1.0f);
ss = someNode-getOrCreateStateSet();
ss-setAttributeAndModes(polyOffset);


On Sat, Feb 16, 2013 at 1:57 AM, wh_xiexing wh_xiex...@sina.com wrote:

 **
 hi friends:


  i have 2 models to  render, some part of which are overlaped .  so the
 result is some kind of weird.  how can i resolve this probem?

 do i need to split the model and align them?  or set different render
 details for the 2 models?


 --
 Shawl

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


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


[osg-users] Mipmapping a dynamic texture

2013-02-02 Thread Preet
Hi

I have a single osg::Image that I use as an atlas. I update the atlas image
every so often using osg::Image::copySubImage. I'd like to use hardware
mipmapping (ie. glGenerateMipMap) for the corresponding texture. When I
modify the osg::Image, will OSG update the mipmaps as well? Or do I need to
explicitly tell OSG to do this (if so, how?)

Regards,

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


[osg-users] Creating a billboard shader for OpenGL ES 2

2013-01-20 Thread Preet
Hiya,

This is somewhat related to my last thread (maybe I should have just
explained the situation from the beginning).

I'm trying to create a shader that does billboarding for hundreds of
objects at once (where using AutoTransform is too slow). I merge all these
objects together to reduce the number of draw calls, and pass along
specific vertex attribute data (specifically model-space relative vertex
data when I want the billboard center to be the model's center) and
uniforms (camera vectors) to do the required billboard transform in the
shader.

This kind of works, but the result is 'jittery' compared to AutoTransform.
I don't know whether its the way I specify the uniform update callback or
if its related to reduced shader precision (the coordinates I used are all
close to the origin though, so I hope that's not the case) or something
else entirely.

I created a minimal example that reproduces the issue [1]... (just
copy-past-compile). The example shows a square billboarded with
AutoTransform working perfectly, and my not so great example directly
behind it.

[1] https://gist.github.com/4582261

* Does anyone know why my example billboard implementation causes that
jitter/delay?

* Or, has anyone created a better shader that can do billboarding for
batched geometry (and if so, could they maybe share how)?


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


[osg-users] Why am I getting this bleed through effect when moving my camera around?

2013-01-19 Thread Preet
I have two geometries close together -- one is an osgText object and the
other is just a simple set of planar triangles laying flat behind the text.
The two are separated by a small distance. Both objects are parented with
an AutoTransform.

When I move my camera around in a certain way, the object behind the text
bleeds through it. When the camera is not being moved, both objects appear
fine. I made a small video because I had trouble capturing the issue with a
screenshot. In the video, the text is purple. The object in question is the
black rectangle with the purple border behind the text.

http://www.youtube.com/watch?v=htj168dJHGw

When I move the camera relatively fast, you can see the black rectangle's
triangles bleed through the text momentarily.

I tried messing around with the placement of the objects; I even tried to
increase the distance between the text and the geometry behind it a
substantial amount but this didn't seem to have an effect. Both objects are
in the same render bin.

I've never really seen something like this happen before where the effect
is only present *while* the scene is moving around. If I move the camera
around slow enough or keep it still, the effect isn't visible.

Does anyone have any ideas as to what the issue is here?


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


Re: [osg-users] Why am I getting this bleed through effect when moving my camera around?

2013-01-19 Thread Preet
Nevermind -- it turns out my idea of a 'substantial' amount of distance
wasn't enough.


On Sun, Jan 20, 2013 at 12:42 AM, Preet prismatic.proj...@gmail.com wrote:

 I have two geometries close together -- one is an osgText object and the
 other is just a simple set of planar triangles laying flat behind the text.
 The two are separated by a small distance. Both objects are parented with
 an AutoTransform.

 When I move my camera around in a certain way, the object behind the text
 bleeds through it. When the camera is not being moved, both objects appear
 fine. I made a small video because I had trouble capturing the issue with a
 screenshot. In the video, the text is purple. The object in question is the
 black rectangle with the purple border behind the text.

 http://www.youtube.com/watch?v=htj168dJHGw

 When I move the camera relatively fast, you can see the black rectangle's
 triangles bleed through the text momentarily.

 I tried messing around with the placement of the objects; I even tried to
 increase the distance between the text and the geometry behind it a
 substantial amount but this didn't seem to have an effect. Both objects are
 in the same render bin.

 I've never really seen something like this happen before where the effect
 is only present *while* the scene is moving around. If I move the camera
 around slow enough or keep it still, the effect isn't visible.

 Does anyone have any ideas as to what the issue is here?


 Preet

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


Re: [osg-users] Does OSG support ES2.0?

2013-01-09 Thread Preet
Hi Paul,

On Tue, Jan 8, 2013 at 8:20 AM, Paul Heraty heratyp...@eircom.net wrote:

 Hi Preet,

 Do you have a copy of the shaders in that code that you can share please:


 shaders/NoShading_vert.glsl
 shaders/NoShading_frag.glsl


They are in the same repo:
https://github.com/preet/scratch/tree/master/openscenegraph/osg_text_geometry/shaders


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


Re: [osg-users] Does OSG support ES2.0?

2013-01-04 Thread Preet
To follow up on Jorge's reply:

Here's an example of how you can use shaders for osgText:
https://github.com/preet/scratch/blob/master/openscenegraph/osg_text_geometry/main_old.cpp

If you're still having issues, increase the OSG debugging output:
(osg::setDebugNotify(...)) and
osgViewer::getCamera()-getGraphicsContext()-getState()-
setCheckForGLErrors(osg::State::ONCE_PER_ATTRIBUTE)

to try and get a bit more info on the error. Something like APITrace (
https://github.com/apitrace/apitrace) might help too if you can get it
running on the target platform.

To get textures working properly on my platform I had to make a couple of
changes to the source. Unfortunately, for some stupid reason I accidentally
scrubbed the git history so I don't really have diffs of all the changes I
made. One specific thing I remember was having to set _glMaxTextureCoords =
1 in /src/osg/State.cpp to get textures working on my device.

Replace the if clause on line 900 with:

if ( osg::getGLVersionNumber() = 2.0 ||
osg::isGLExtensionSupported(_contextID,GL_ARB_vertex_shader) ||
OSG_GLES2_FEATURES)
{

glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,_glMaxTextureUnits);

#ifdef OSG_GLES2_AVAILABLE
_glMaxTextureCoords = 1;
#else
glGetIntegerv(GL_MAX_TEXTURE_COORDS,_glMaxTextureCoords);
#endif
}


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


[osg-users] How can I call a vector method on a generic array type?

2012-12-27 Thread Preet
Hi,

I'm trying to call std::vector functions on generic array objects. So I'd
like to be able to get an osg::Array and call something like size() or
clear() on it, but I'm not sure how I can do this without casting it to one
of the 'proper' array types. Is this possible?


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


Re: [osg-users] Fitting my world into the viewport

2012-12-24 Thread Preet
Hi,

On Sun, Dec 23, 2012 at 4:14 PM, Daniel Peraza danielper...@gmail.comwrote:

 Hi, I'm very new to OSG and OpenGL programming in general, but right now
 I'm working on my thesis and my application requires to load several models
 on the same scene. Once every model is done loading, I must adjust the
 viewer's settings so that an user is able to see the entire scene. I know
 this can be achieved by fitting the world's bounding sphere into the
 viewport, the problem is that I don't know OSG Classes well enough to do so.


The default OpenSceneGraph viewer does this automatically for you. If you
don't specify an initial camera, the viewer will calculate a view extents
that tries to fit the entire scene. Unless your models are extremely far
apart and beyond the default clipping planes, you should see all your
models right away.



 My application is Qt-based and uses a Track Ball Manipulator. I wonder if
 I must use the manipulator methods, or adjust the camera's projection
 directly.


OSG has its own set of manipulators, including a track ball. To integrate
the two, check out the osgviewerQt example and osgQt libs. Unless there's
something special about your scene, I don't see any need to adjust the
camera's projection directly.


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


Re: [osg-users] Render multiple osgText nodes with the same drawcall

2012-12-22 Thread Preet
 It will probably be more efficient to create a scene graph from
 osg::Geometry/osg::Texture/osg::StateSet rather than using osgText.  You
 could use the osgText::Font and associated Textures to help with the
 texturing side to the rendering.  The osg::Geometry you create you could
 put as many quads in as you need.


I have a couple of questions on using the texture directly rather than
using osgText::Text...

When grabbing the textures with all the glyphs in it
(osgText::Font::getGlyphTextureList), can I safely assume that for one font
resolution there will only be one texture for that font? That is will *all*
characters which are requested with the same font be handled by one texture?

How/when do individual glyphs get added to their collective texture? (I
looked through the source code but got a little lost) -- in a small example
I tried with just osg::Geometry/Texture as you suggested above, I looked up
glyph texture coordinates for a bunch of characters without manually adding
any glyphs and it 'just worked'. Do I never need to do anything to ensure
the glyphs I need are in the texture or is this taken care of implicitly?


Regards,

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


[osg-users] What can I do to improve rendering performance for a bunch of billboarded nodes?

2012-12-20 Thread Preet
I have a scene that contains 100s of small low-complexity flat geometries
(triangles, squares, ngons, etc). Each of them is parented with an
autotransform node so that they constantly face the camera. Color data is
passed through vertex attributes and there's no texture data.

Is there anything I can do to improve rendering performance in this
scenario? This is on a mobile device (OpenGL ES 2) and I get a fair bit of
slow down as the number of objects increases.


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


[osg-users] osg plugin path naming issue?

2012-12-13 Thread Preet
Hiya,

OSG couldn't find a few plugins on an embedded target where I was manually
installing the libraries. I noticed that osgDB was searching for plugins
named with a 'd' at the end (I *am* using debug libs) but my actual plugins
don't have a 'd' appended at the end of their name.

For example, osgDB was looking for osgdb_freetyped.so, when the plugin
itself was built as osgdb_freetype.so

Everything works as expected when I rename the files (append a 'd' to all
plugins) before putting them on the device. I don't move their relative
paths or anything (so they stay in osgPlugins-x.x.x).

Is this a bug or did I do something weird when building OSG?


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


Re: [osg-users] OSG and Qt GLdouble typedef conflicts with OpenGL ES2

2012-12-13 Thread Preet
Hi Robert,

Thanks for the quick reply. Just for anyone else who runs into this,
another way to get aorund this without changing order of includes is just
to add the osg defines before Qt is included in the application:

#define GL_DOUBLE 0x140A
#define GLdouble double

It was a bit of a pain to change up order of includes everywhere in my
application. Since both OSG and Qt have to check whether or not GLdouble is
defined by the GL implementation, I think its safe to do this [and it seems
to be working fine].


Regards,

Preet


On Wed, Dec 12, 2012 at 3:51 AM, Robert Osfield robert.osfi...@gmail.comwrote:

 Hi Preet,

 On 12 December 2012 05:59, Preet prismatic.proj...@gmail.com wrote:

 Hiya

 I'm using OSG with Qt to create an OpenGL ES 2 application. GL ES2 does
 not have GLdoubles.

 When building witHh against ES2, Qt typedefs GLdouble to GLfloat. OSG
 typedefs GLdouble to just 'double'. As a result I get an error when trying
 to compile my application.

 How do I get around this?


 It will be an order of include issue, so just be careful which order you
 include files, or keep the Qt GL code seperate from the OSG Qt code.
 Personally I'm surprised by the Qt downcasting GLdoube to GLfloat, this
 could break codes that rely on doubles.  On the OSG side we generally use
 floats for all key data that gets passed to OpenGL, it tends to be just
 things like glu (which is now part of the OSG) that uses doubles.

 Robert.

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


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


[osg-users] Render multiple osgText nodes with the same drawcall

2012-12-13 Thread Preet
Hiya,

I'm using OSG on a mobile target (OpenGL ES 2) and my scene runs really
really slow. I'm trying to optimize it by reducing the number of draw
calls.

My scene has a bunch of labels that draw text along a path. Each label
consists of several osgText nodes that are single characters in length,
each with their own transform on top. So if a single label is OSG it will
have three osgText nodes.

I want to throw all of the label attributes (which I think is just vertex
and tex coord arrays) into a single VBO, but I'm not really sure how I
would do that (or even if I could). I'd appreciate any advice.


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


[osg-users] OSG and Qt GLdouble typedef conflicts with OpenGL ES2

2012-12-11 Thread Preet
Hiya

I'm using OSG with Qt to create an OpenGL ES 2 application. GL ES2 does not
have GLdoubles.

When building with against ES2, Qt typedefs GLdouble to GLfloat. OSG
typedefs GLdouble to just 'double'. As a result I get an error when trying
to compile my application.

How do I get around this?


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


[osg-users] Rendering sets of objects in layers/passes

2012-12-08 Thread Preet
Hiya,

I have multiple sets of depth sorted geometry that I'd like rendered in a
specific order. So the depth sorted part itself only matters within a
single set, if that makes any sense. For example, I might have three sets,
each containing 100 osg::Geometry objects. I'd like each of the objects to
render correctly with respect to the other objects in their own set, but
I'd like all the objects in the first set to show up over all the objects
in the second set and so on.

I'm not sure how to do this with OpenSceneGraph. I tried giving each set of
objects a separate DepthSorted render bin... but this doesn't do what I
want. I'd appreciate any advice.


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


Re: [osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-06 Thread Preet
Hiya,

A combination of:

* setting the cull mode to
myCam-setCullingMode(osg::CullSettings::VIEW_FRUSTUM_SIDES_CULLING)
* manually specifying the near and far planes
* letting osg compute the right bounding box for the earth geometry by itself

seems to be working. Thanks to all for the help!


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


Re: [osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-05 Thread Preet
Sergey's suggestion (invalidating the geometry's bounds with a custom
compute bounds callback) sort of worked, but led into another issue.
If I zoom out far enough, the Earth surface geometry disappears.
Specifically, if the camera is pointing at the center of the Earth,
the Earth geometry disappears when the camera eye is further than
~5.13E6m from the surface of the Earth. Changing the near and far
planes don't have any effect here.

However, if I disable culling I don't have this problem (but disabling
culling kills the framerate):
myCam-setCullingMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

So right now I'm:

* Setting the near and far plane manually
(myCam-setComputeNearFarMode is set to DO_NOT_COMPUTE) whenever the
camera is updated to ensure my desired view volume is correct
* Setting the Earth surface geometry compute bounds callback to disabled

And that works fine up until I move the camera out far enough as I
described previously. Something happens at that causes the geometry to
disappear unless I disable culling altogether.


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


Re: [osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-05 Thread Preet
On Sat, Oct 6, 2012 at 1:02 AM, Preet prismatic.proj...@gmail.com wrote:
 Sergey's suggestion (invalidating the geometry's bounds with a custom
 compute bounds callback) sort of worked, but led into another issue.
 If I zoom out far enough, the Earth surface geometry disappears.
 Specifically, if the camera is pointing at the center of the Earth,
 the Earth geometry disappears when the camera eye is further than
 ~5.13E6m from the surface of the Earth. Changing the near and far
 planes don't have any effect here.

 However, if I disable culling I don't have this problem (but disabling
 culling kills the framerate):
 myCam-setCullingMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

Sorry, typo above, I meant to write:
myCam-setCullingMode(osg::CullSettings::NO_CULLING);


 So right now I'm:

 * Setting the near and far plane manually
 (myCam-setComputeNearFarMode is set to DO_NOT_COMPUTE) whenever the
 camera is updated to ensure my desired view volume is correct
 * Setting the Earth surface geometry compute bounds callback to disabled

 And that works fine up until I move the camera out far enough as I
 described previously. Something happens at that causes the geometry to
 disappear unless I disable culling altogether.


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


[osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-04 Thread Preet
Hey,

By default some of the parameters of a camera are computed based on
the contents of a scene (like the near and far plane). Camera
manipulators will also behave differently based on the placement of
objects in the scene. I have one node in my scene that I want the
camera and any manipulators to 'ignore' in this respect, but I still
want the node to be rendered. Is there anyway I can do this?

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


Re: [osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-04 Thread Preet
On Thu, Oct 4, 2012 at 3:52 PM, Chris Hanson xe...@alphapixel.com wrote:
 On Thu, Oct 4, 2012 at 12:48 PM, Preet prismatic.proj...@gmail.com wrote:

 By default some of the parameters of a camera are computed based on
 the contents of a scene (like the near and far plane). Camera
 manipulators will also behave differently based on the placement of
 objects in the scene. I have one node in my scene that I want the
 camera and any manipulators to 'ignore' in this respect, but I still
 want the node to be rendered. Is there anyway I can do this?


 Probably not. The nodes have to be Culled in order to be added to the Render
 List, and the scene bounds and such are computed during culling.

 The bigger question is what are you trying to do, and why? That answer will
 probably allow us to suggest something useful, like depth partitioning or
 something.


I'm trying to visualize stuff like buildings and roads on the surface
of the Earth. But for reference, I'd also like to display the surface
of the Earth (just as a set of points). Including geometry for the
Earth's surface makes the other stuff disappear (and reappear at
certain angles). To me it looks like an issue with the near/far planes
of the frustum.

I wanted to avoid specifying the near/far planes manually since the
behaviour without the Earth surface geometry is perfect as is. I don't
care about the overhead of drawing the surface geometry since its so
simple, and I don't want the scene graph to account for the surface
geometry (outside of rendering it); the other objects in the scene
should determine the camera frustum.


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


Re: [osg-users] How can I get the viewer's camera to 'ignore' a node's geometry?

2012-10-04 Thread Preet
On Thu, Oct 4, 2012 at 5:37 PM, Chris Hanson xe...@alphapixel.com wrote:
 I wanted to avoid specifying the near/far planes manually since the

 behaviour without the Earth surface geometry is perfect as is. I don't
 care about the overhead of drawing the surface geometry since its so
 simple, and I don't want the scene graph to account for the surface
 geometry (outside of rendering it); the other objects in the scene
 should determine the camera frustum.



   Due to the way OGL works with near/far, if you want it drawn, you need it
 taken into account when computing the near/far planes.

   Are you just worried about the far plane being set too far?

Including geometry for the
 Earth's surface makes the other stuff disappear (and reappear at
 certain angles).

   It sounds to me like you're not trying to solve the right problem. You
 should first determine WHY these other items aren't displayed at times.


Sorry if it wasn't clear; the items aren't being displayed because the
near and far planes that osg sets creates a frustum that doesn't
include them. I need to manually set the near and far planes to see
everything.

The near and far planes that osg sets without the earth surface
geometry is fine. Once you add the surface geometry though, the near
and far planes are set such that the items are no long in the view
frustum.

I was looking for a flag or something that basically tells osg hey,
don't include this node when you do your view frustum calculations
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Manually updating a camera instead of using a manipulator

2012-10-01 Thread Preet
Figured this out; I was unprojecting coordinates but not updating them
in the right order. So that this thread isn't completely useless, here's my
correct code for converting screen coordinates to world coordinates.

void calcNormDeviceCoords(int xScreen, int yScreen, double xNorm,
double yNorm)
{
xNorm = 2*double(xScreen)/double(MY_SCREEN_WIDTH) - 1;
yNorm = 1 - 2*double(yScreen)/double(MY_SCREEN_HEIGHT);
}

// dNorm = 0.0 for near plane on view frustum, dNorm = 1.0 for far plane
void convCoordScreenToWorld(double xNorm,double yNorm,
   double dNorm,osg::Vec3d worldPt)
{
osg::Camera * viewCam = MY_VIEWER-getCamera();
osg::Matrixd xfMVP(viewCam-getViewMatrix()*
   viewCam-getProjectionMatrix());

osg::Matrixd xfInvMVP = osg::Matrixd::inverse(xfMVP);
worldPt = osg::Vec3d(xNorm,yNorm,dNorm) * xfInvMVP;
}


Sorry for the spam

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


[osg-users] Window Event Queue not being fully processed?

2012-09-10 Thread Preet
Hi,

I'm using GraphicsWindowEmbedded to draw a 3d viewport in a QtQuick
application (osgQt is not applicable here). I pass mouse events from
Qt over to OSG by adding them directly to the window's event queue
(myGWE-getEventQueue()-mouseButton...). This seems to work as
expected for the most part, but it seems like the last couple of mouse
events aren't processed. So now, when I again use the mouse to
interact with the viewport, the view will jump to a slightly different
position before again tracking further mouse events.

I'm using a TrackballManipulator, and I've disabled throwing. I also
tried setting the viewer's runFrameScheme to ON_DEMAND, but this
didn't make a difference. To be clear, I manually call the viewer's
frame() method after each mouse event. I'd appreciate any advice.


Regards,

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


Re: [osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems

2012-07-09 Thread Preet
Hi Robert,

On Mon, Jul 9, 2012 at 9:01 AM, Robert Osfield robert.osfi...@gmail.com wrote:
 HI Preet,

 You'll need to rest OpenGL into consistent state when moving between
 Qt and the OSG.  I don't know anything about QGLFrameBufferObject so
 can't comment on what state it'll be managing.

This was indeed the case. For anyone else that runs into issues
integrating the two libs, I've found some OpenGL states that should be
reset after drawing an OSG frame, before control is given back to Qt.
More state settings might need to be changed depending on what exactly
OpenSceneGraph is being used for, but the following seems to work with
some basic textured geometry.

// qpainter uses vertex attribs 3,4,5 so we need to explicitly disable them:
glDisableVertexAttribArray(3);
glDisableVertexAttribArray(4);
glDisableVertexAttribArray(5);

// qpainter requires depth testing to be off
glDisable(GL_DEPTH_TEST)

// not sure if this is required; osg changes this when using textures
so I reset it to default
glPixelStorei(GL_UNPACK_ALIGNMENT,4);


 What I can say is that the OSG has it's own native FBO support that
 will work just fine all by itself and normally there wouldn't be any
 need to get QT involved.  Personally I'd try to keep Qt out for doing
 too much OpenGL work itself.

 Robert.

 On 5 July 2012 01:30, Preet prismatic.proj...@gmail.com wrote:
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Bug in revision 13092

2012-07-09 Thread Preet
Did you call realize() on your viewer?

ie... myViewer-realize();

On Fri, Jul 6, 2012 at 7:40 AM, Łukasz Lucek lukasz.lu...@gmail.com wrote:
 Hi,

 I think that I have found a bug in revision 13092.
 I'm using osg as part of qt application, so i create an 
 osgViewer::GraphicsWindowEmbedded like this:


 Code:

 _gw = new osgViewer::GraphicsWindowEmbedded(x,y,width,height);




 then later, i forward qt events to osg. Especially i forward the resize event 
 and mouse move events like this:


 Code:

 void QGraphicsEventAdapter::resizeEvent( QResizeEvent* event ){
  _gw-getEventQueue()-windowResize(0, 0, event-size().width(), 
 event-size().height());
  _gw-resized(0, 0, event-size().width(), event-size().height());
 }

 void QGraphicsEventAdapter::mouseMoveEvent( QGraphicsSceneMouseEvent* event ){
  QGraphicsScene::mouseMoveEvent(event);
  if( event-isAccepted() ) return;
  QPoint widgetPos(0,0);
  widgetPos = parentView-mapToGlobal(widgetPos);
  _gw-getEventQueue()-mouseMotion(event-screenPos().x()-widgetPos.x(), 
 event-screenPos().y()-widgetPos.y());
 }




 And now, i have an osg camera maniupulator derived from 
 osgGA::StandardManipulator, with a method


 Code:

 virtual bool performMovementLeftMouseButton( const double eventTimeDelta, 
 const double dx, const double dy );




 my manipulator expects, that the dx and dy values are normalized. It used to 
 work this way before revision 13092, but after this revision the values are 
 not normalized anymore.

 I think it has something to do with the change made to the Viewer.cpp file, 
 however it is to complicated for me to dig into osg event handling.

 ...

 Thank you!

 Cheers,
 Łukasz

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





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


Re: [osg-users] [vpb] Texture parameters for Android?

2012-07-07 Thread Preet
On Sat, Jul 7, 2012 at 10:54 AM, Massimo Tarantini subbi...@yahoo.it wrote:
 Hello,

 i have compiled OSG and VPB for Android, and i'm using Necessitas on an 
 Archos 80G9. All the stuff works (well, the touch events are lost...) but i 
 can't see the texture.

 I have tryied some combinations for the options --image-ext and 
 [--compressed, --RGBA-compressed, --RGB-16, --RGB-24], but unsuccesfully.

 I suppose that OpenGL compression can't work on Android. But if i use for 
 example --image-ext jpeg  --RGB-16, why it does not work?

 In the debug output i read:
 [...]
 07-07 16:39:42.039: D/Qt(1611): uncompressed ive stream
 [...]
 07-07 16:39:42.343: D/Qt(1611): TreatBoundariesToValidDataAsDefaultValue=0
 07-07 16:39:42.343: D/Qt(1611):  4
 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
 _numOfTextureObjects 5
 07-07 16:39:42.343: D/Qt(1611):  4
 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
 _numOfTextureObjects 6
 07-07 16:39:42.343: D/Qt(1611):  4
 07-07 16:39:42.343: D/Qt(1611): Created new 0xde6e60 TextureObject, 
 _numOfTextureObjects 7
 07-07 16:39:42.343: D/Qt(1611):  4
 07-07 16:39:42.351: D/Qt(1611): Warning: detected OpenGL error 'invalid 
 enumerant' at after RenderBin::draw(..)

I ran into something like this with GL ES 2. You didn't specify what
version you compiled against, so this may or may not help you.

Note the error generated. I found a couple of fixes by searching
through the list and after some trial and error this is what worked on
my platform:

In the State header file (/include/osg/State i think) there's a
function called State::applyModeOnTexUnit() that calls
glEnable(GL_TEXTURE_2D). This isn't valid for GLES 2 so comment it
out... I did something like:

  #ifndef OSG_GLES2_AVAILABLE
// with opengl es 2, GL_TEXTURE_2D is always enabled
// so trying to enable it explicitly causes errors
if (enabled) glEnable(mode);
else glDisable(mode);
  #endif

Also in State.cpp (/src/osg/State.cpp) there's a function called
initializeExtensionProcs(). Line 900 [i pulled osg from git] has an
if() clause that checks for the max number of texture units available.
I replaced it with:

if ( osg::getGLVersionNumber() = 2.0 ||
osg::isGLExtensionSupported(_contextID,GL_ARB_vertex_shader) ||
OSG_GLES2_FEATURES)
{
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,_glMaxTextureUnits);

 #ifdef OSG_GLES2_AVAILABLE
_glMaxTextureCoords = 1;
 #else
glGetIntegerv(GL_MAX_TEXTURE_COORDS,_glMaxTextureCoords);
 #endif
}

After those changes, textures started working for me.

However, I noticed you're using Qt/Necessitas... not sure exactly what
you're using Qt for, but just as a heads up, I ran into more problems
using textures with QML that as of now I've been unable to solve (ie
it makes QML unusable with OSG).

 07-07 16:39:42.351: D/Qt(1611):  2
 07-07 16:39:42.351: D/Qt(1611): end cull_draw() 0xdbf838
 07-07 16:39:42.351: D/Qt(1611):  5


 Some advice?

 Thank you!

 Cheers,
 Massimo

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





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


Re: [osg-users] Saving and restoring GL state with OpenSceneGraph

2012-07-06 Thread Preet
Hi Frank,

Thanks for the reply! I'll try setting up something similar in my application.

On Fri, Jul 6, 2012 at 3:52 PM, Frank Kane fk...@sundog-soft.com wrote:
 From what I've read, captureCurrentState just returns the current state 
 attributes in OSG - it's not actually capturing the current GL state.

 But, you could flip the problem on its head and capture the actual OpenGL 
 state just prior to calling your library, and then restoring it when your 
 library is done with its drawing. Here is some code to start from that 
 catches most of the stuff that's likely to change; for completeness, you'd 
 want to capture all of the state documented at 
 http://www.khronos.org/opengles/sdk/1.1/docs/man/glGet.xml as well.


 Code:

 typedef struct glState_S {
 GLboolean depthTest, blend, cullFace;
 GLboolean dither, colorLogicOp, polygonOffsetLine, polygonOffsetFill;
 GLboolean polygonOffsetPoint, polygonSmooth, scissorTest, stencilTest;
 } glState;

 static std::stackglState stateStack;

 SILVERLININGDLL_API bool PushAllState(void)
 {
 glState state;

 state.blend = glIsEnabled(GL_BLEND);
 state.depthTest = glIsEnabled(GL_DEPTH_TEST);
 state.cullFace = glIsEnabled(GL_CULL_FACE);
 state.dither = glIsEnabled(GL_DITHER);
 state.polygonOffsetFill = glIsEnabled(GL_POLYGON_OFFSET_FILL);
 state.scissorTest = glIsEnabled(GL_SCISSOR_TEST);
 state.stencilTest = glIsEnabled(GL_STENCIL_TEST);

 stateStack.push(state);

 CheckError(__LINE__);

 return true;
 }

 SILVERLININGDLL_API bool PopAllState(void)
 {
 if (!stateStack.empty()) {
 glState state = stateStack.top();

 if (state.blend) glEnable(GL_BLEND); else glDisable(GL_BLEND);
 if (state.depthTest) glEnable(GL_DEPTH_TEST); else 
 glDisable(GL_DEPTH_TEST);
 if (state.cullFace) glEnable(GL_CULL_FACE); else 
 glDisable(GL_CULL_FACE);
 if (state.dither) glEnable(GL_DITHER); else glDisable(GL_DITHER);
 if (state.polygonOffsetFill) glEnable(GL_POLYGON_OFFSET_FILL); else 
 glDisable(GL_POLYGON_OFFSET_FILL);
 if (state.scissorTest) glEnable(GL_SCISSOR_TEST); else 
 glDisable(GL_SCISSOR_TEST);
 if (state.stencilTest) glEnable(GL_STENCIL_TEST); else 
 glDisable(GL_STENCIL_TEST);

 stateStack.pop();
 }

 CheckError(__LINE__);

 return true;
 }




 Best regards,
 Frank Kane
 Founder, Sundog Software LLC

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





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


[osg-users] Saving and restoring GL state with OpenSceneGraph

2012-07-05 Thread Preet
Hi,

I'm trying to find out a bit more about how to get OpenSceneGraph to
share an OpenGL context with another library... and to do that
properly i'd like to isolate both by saving and restoring state as
appropriate. I know this isn't the 'right' way to use OSG, and I know
that this kills performance, especially since OSG is designed to use
lazy state updating... but sometimes its a necessary evil. I'm
targeting OpenGL ES2.

Looking through some other posts, I've gathered:

You can get/save the current stateset by calling something like:
myViewer-getCamera()-getGraphicsContext()-getState()-captureCurrentState(myStateSet);

You can reset the current state by calling reset:
myViewer-getCamera()-getGraphicsContext()-getState()-reset();

You can apply a saved state by calling apply:
myViewer-getCamera()-getGraphicsContext()-getState()-apply(myStateSet);

But I'm not sure about a few things:

When should the osg::State be first saved? So basically, when is the
scene graph first traversed and the osg::State built up so that it's
appropriate for OSG to go ahead and render something? Does the initial
OpenGL state when OSG first builds up osg::State matter (I'm guessing
no)?

After saving this valid state, i'd do something like this to restore
it and render my scene...
// draw call
myViewer-getCamera()-getGraphicsContext()-getState()-reset();   //
is this line necessary?
myViewer-getCamera()-getGraphicsContext()-getState()-apply(myStateSet);
myViewer-frame();
// save state again if I modified the scene

Does that seem reasonable? Any advice/input would be appreciated.


Thanks

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


[osg-users] osgText not working with programmable pipeline?

2012-07-04 Thread Preet
I compiled OSG against OpenGL 3 and disabled all the fixed function
stuff, and I can do basic things like build up geometry, apply shaders
and so on. Trying to draw text using osgText doesn't work out so well
though. I'm not sure what's going on... but basically the output looks
like font character quads, just not textured correctly (wild guess).
Here's a screenshot from the results of running osgtext in the example
folder: http://i.imgur.com/NX6dv.png?1

Do I need to specify my own shader for the text geode I create? If so,
are there any examples on how to do this?

Also here's the debug output for a minimal osg text example (just
create some text, attach it to a geode, and render the scene):
http://pastie.org/4200461

I see ShaderComposer is called but I don't know if it's doing
anything. Also this line doesn't seem right: Glyph::subload():
texture sub-image width and/or height of 0, ignoring operation. I'd
appreciate any advice.


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


Re: [osg-users] osgText not working with programmable pipeline?

2012-07-04 Thread Preet
After some trial and error, osgText renders fine when explicitly
setting up shaders. Here's a bare minimum working example in case
anyone else runs into this.

Scene Graph:

// text geometry
std::string textStr(Hello World);
osg::ref_ptrosgText::Text myText = new osgText::Text;
myText-setFont(DroidSans-Bold.ttf);
myText-setCharacterSize(20.0f);
myText-setText(textStr);

// text node
osg::ref_ptrosg::Geode textGeode = new osg::Geode;
textGeode-addDrawable(myText);

// text shaders
osg::ref_ptrosg::Program shProgram = new osg::Program;
shProgram-setName(TextShader);

std::string vShader = std::string(#version 120\n) +
readFileAsString(vertexshader.glsl);
shProgram-addShader(new osg::Shader(osg::Shader::VERTEX,vShader));

std::string fShader = std::string(#version 120\n) +
readFileAsString(fragmentshader.glsl);
shProgram-addShader(new osg::Shader(osg::Shader::FRAGMENT,fShader));

osg::ref_ptrosg::Uniform textColor = new
osg::Uniform(MaterialColor,osg::Vec4(0,1,1,1));
osg::ref_ptrosg::Uniform textTexture = new osg::Uniform(GlyphTexture,0);

osg::StateSet *ss = textGeode-getOrCreateStateSet();
ss-addUniform(textColor);
ss-addUniform(textTexture);
ss-setAttributeAndModes(shProgram,osg::StateAttribute::ON);

osg::ref_ptrosg::Group nodeRoot = new osg::Group;
nodeRoot-addChild(textGeode);


Vertex Shader:
#version 120

varying mediump vec4 VertexColor;
varying mediump vec2 TexCoord0;

uniform vec4 MaterialColor;

void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
VertexColor = MaterialColor;
TexCoord0 = gl_MultiTexCoord0.xy;
}


Fragment Shader:

varying vec4 VertexColor;
varying vec2 TexCoord0;

// set to zero by default
uniform sampler2D GlyphTexture;

void main()
{
gl_FragColor = VertexColor * texture2D(GlyphTexture,TexCoord0).;
}


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


Re: [osg-users] Issue adding transparency to a simple model

2012-07-04 Thread Preet
Thanks Paul and Sergey

I'll try both methods.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Using osgText with GraphicsWindowEmbedded and Qt causes problems

2012-07-04 Thread Preet
Hi.

I have a scene consisting of just an osgText object and its shaders.
The scene works fine in a default application where OpenSceneGraph is
the only library being used, but won't render correctly when I try to
draw to a QGLFrameBufferObject. Drawing to the FBO works fine if I
don't use osgText (other than text, I've just tried simple models so
far).

Using osgText 'messes' the Qt UI up, by changing the order of what (Qt
items) are painted or changing their size or stretching them...
nothing from OSG seems to be painted at all.

I'm guessing there's a conflict with OpenGL calls between Qt and OSG.
OSG is set up using GraphicsWindowEmbedded, and in Qt, I bind my
framebuffer before calling osgViewer's frame(), and release it after.
I'm lost as to why using osgText of all things would cause this issue.
Just the inclusion of osgText in my scene tree causes the problem.
Does anyone have any suggestions as to how I can force Qt and OSG to
play nice?


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


[osg-users] Issue adding transparency to a simple model

2012-07-03 Thread Preet
Hi.

I have a simple model I wanted to apply transparency to. I load the
model data into a geometry node, and set my scene up. To get a
transparent effect, I apply an alpha value to gl_FragColor in my
fragment shader.

The shaders are trivial:
Vertex:
void main()
{
   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Fragment:
void main()
{
   gl_FragColor = vec4(1,0,0,0.5);
}

I get a strange output that sort of works, but renders a different
result based on the camera position. It's hard to describe so I
attached a short youtube clip. It seems like certain triangles are
only rendered at certain camera angles.

http://youtu.be/fQUFSff-uuU

I played around with some of the settings I thought might be relevant
but I still get the effect that the video shows.

osg::StateSet *ss = geodeMesh-getOrCreateStateSet();
ss-setAttributeAndModes(shProgram,osg::StateAttribute::ON);
ss-setMode(GL_BLEND,osg::StateAttribute::ON);

  // options i tried changing around
//ss-setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);
//ss-setMode(GL_DEPTH_WRITEMASK,osg::StateAttribute::OFF);
//ss-setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
//ss-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

Any advice would be appreciated.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Issue adding transparency to a simple model

2012-07-03 Thread Preet
On Tue, Jul 3, 2012 at 4:45 PM, Paul Martz pma...@skew-matrix.com wrote:
 What are you doing to ensure that the triangles are rendered in
 back-to-front order?
-Paul

Nothing! How can I preprocess the data to achieve that?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Issue using TrackballManipulator with GraphicsWindowEmbedded

2012-07-01 Thread Preet
Hey all.

I'm having some trouble using TrackballManipulator with
GraphicsWindowEmbedded. The two main problems are:

* I have to pass normalized x,y coordinates (ie, x/width(),
y/height()) to the graphics window's event queue. Looking at other
examples, this doesn't seem right.

* Zoom and Pan seem to be working, but Rotation just rotates around
the plane that the window itself represents (so it rotates the view in
2D on the plane that has a normal in the camera's lookAt direction)

I've set up the graphics window and viewer as follows:

// setup viewer and window
m_osg_viewer = new osgViewer::Viewer;
m_osg_window =
m_osg_viewer-setUpViewerAsEmbeddedInWindow(0,0,this-width(),this-height());
m_osg_window-getState()-setUseModelViewAndProjectionUniforms(true);
m_osg_window-getState()-setUseVertexAttributeAliasing(true);
m_osg_viewer-setCameraManipulator(new osgGA::TrackballManipulator);
m_osg_viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);
m_osg_viewer-setSceneData(groupRoot);

In addition I've tried:
 * Setting an initial position and perspective matrix for the camera
 * Calling setMouseInputRange and setUseFixedMouseInputRange on the
graphic window's event queue

But they didn't have any effect. Am I just missing something obvious?


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


Re: [osg-users] Issue using TrackballManipulator with GraphicsWindowEmbedded

2012-07-01 Thread Preet
Ah, forgot to call viewer-realize()
Sorry for the spam :)


Preet

On Sun, Jul 1, 2012 at 4:42 PM, Preet prismatic.proj...@gmail.com wrote:
 Hey all.

 I'm having some trouble using TrackballManipulator with
 GraphicsWindowEmbedded. The two main problems are:

 * I have to pass normalized x,y coordinates (ie, x/width(),
 y/height()) to the graphics window's event queue. Looking at other
 examples, this doesn't seem right.

 * Zoom and Pan seem to be working, but Rotation just rotates around
 the plane that the window itself represents (so it rotates the view in
 2D on the plane that has a normal in the camera's lookAt direction)

 I've set up the graphics window and viewer as follows:

 // setup viewer and window
 m_osg_viewer = new osgViewer::Viewer;
 m_osg_window =
 m_osg_viewer-setUpViewerAsEmbeddedInWindow(0,0,this-width(),this-height());
 m_osg_window-getState()-setUseModelViewAndProjectionUniforms(true);
 m_osg_window-getState()-setUseVertexAttributeAliasing(true);
 m_osg_viewer-setCameraManipulator(new osgGA::TrackballManipulator);
 m_osg_viewer-setThreadingModel(osgViewer::Viewer::SingleThreaded);
 m_osg_viewer-setSceneData(groupRoot);

 In addition I've tried:
  * Setting an initial position and perspective matrix for the camera
  * Calling setMouseInputRange and setUseFixedMouseInputRange on the
 graphic window's event queue

 But they didn't have any effect. Am I just missing something obvious?


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


Re: [osg-users] Problems using shader attributes

2012-06-30 Thread Preet
- small edit: the correctly rendered scene with straight opengl:
http://i.imgur.com/gLLdM.png
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Building a slimmed down static version of OSG

2012-06-22 Thread Preet
Hi,

I got a basic scene graph running (manually created a simple mesh and
was able to view it). I ran into problems trying to run the osg file
loader plugins and didn't troubleshoot that part any further. Also, I
was building from git.

Do you run into the same crash with 32 and 64 bit builds? What does
the stack trace from the crash say? Also the reimplementation of
GraphicsWindowEmbedded::requestRedraw should be calling
GraphicsWindow::requestRedraw():

void requestRedraw()
{
GraphicsWindow::requestRedraw();
}

... but that doesn't seem to be your issue here.


Preet


On Thu, Jun 21, 2012 at 11:13 PM, David Smith mo...@mokon.net wrote:
 Hi Preet,

 Did you make any progress on this? I'm getting a similar error and I am 
 stumped. I have a fedora 16 32bit machine with osg 3.0.1 where my code 
 compiles fine and then I have a fedora 17 64bit machine also with osg 3.0.1 
 where I get this undefined reference.

 I added a virtual void requestRedraw(){} ; to the GraphicsWindowEmbedded 
 header file just to see what would happen and it compiles but I get a crash 
 right away on an addChild in Qt land.

 Thanks,
 David

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





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


Re: [osg-users] 139.com Spam

2012-06-07 Thread Preet
me three... gmail does a decent job of filtering it out once you mark
it as spam though

On Thu, Jun 7, 2012 at 4:49 PM, Jordi Torres jtorresfa...@gmail.com wrote:
 Me too.

 El 07/06/2012 21:43, rocco martino martinoro...@gmail.com escribió:

 Idem

 2012/6/7 Kim Bale kcb...@googlemail.com

 Is anyone else getting these Chinese emails quoting the subject of a post
 made to osg-users?

 I've had a few now and I have no idea where they're coming from.

 K.

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



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


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

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


Re: [osg-users] OpenSceneGraph on the Playbook

2012-06-06 Thread Preet
On Wed, Jun 6, 2012 at 5:30 AM, Sergey Polischuk pol...@yandex.ru wrote:
 Hi

 gles 2 dont support fixed pipeline lighting stuff like GL_LIGHT# and such, 
 which osg uses to manage lighting. To calculate proper lighting you should 
 supply shaders with light source parameters(position\direction, color etc) 
 through uniforms and use those.

 Cheers,
 Sergey.

In my previous email I noted that I'm using the shader provided with
the Android OpenGL ES2 example. I started to see lighting after I
stopped using Qt as a window manager -- I'll deal with that why using
Qt changes the output later. I switched to using EGL directly through
blackberry's utils. The result is much better, but still flawed.

Right now, I'm seeing this weird effect where it seems like faces are
either being culled incorrectly or showing the wrong front/back face
at certain angles. I don't know how to describe this further so I
uploaded a short video:

http://youtu.be/_yxLrGJD8HM

I'd appreciate it someone could take a look. I also tried explicitly
setting cull face front and back state attributes to off, but it
doesn't make any difference. The shaders from that example are here:

http://pastie.org/4040310:


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


Re: [osg-users] OpenSceneGraph on the Playbook

2012-06-06 Thread Preet
On Wed, Jun 6, 2012 at 5:48 PM, Chris Hanson xe...@alphapixel.com wrote:
   It looks like backface culling is off (GLES2 does have back face culling).
 Turn this on.

   It also behaves as if you ended up with a context that perhaps has no Z
 buffer. This can happen if you choose your context poorly via EGL. On some
 Adreno GLES2 devices I've used, I had to drop down to a 5,6,5 RGB channel
 depth in order to get a Z buffer.


The Z buffer wasn't explicitly set in the blackberry utils... I played
around with the screen modes and EGL attributes (used RGBA and had
to specify a 24bit depth buffer with 8 bit stencil) and now it works!
It's a bit slow on the device with higher poly models (dont know if
the screen mode has anything to do with that) but it works! Woo
playbook! Thank you so much to all for the help :)

Here's a sample project (you'll need to adjust the paths to point to
your own osg libs):
https://github.com/canurabus/scratch-blackberry/tree/master/template_osg


Regards,

Preet
 --
 Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
 http://www.alphapixel.com/
 Training • Consulting • Contracting
 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
 GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
 Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
 LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android


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

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


Re: [osg-users] OpenSceneGraph on the Playbook

2012-06-05 Thread Preet
On Tue, Jun 5, 2012 at 12:17 PM, Chris Hanson xe...@alphapixel.com wrote:
   You either need to write your own GLES2 shader (that's GL2 you have above)
 or use a shader gen tool that will generate one for you on the fly.

   Where did the shader, above, come from?

It was automatically genereated by osg... I didn't explicitly add a
shader. Following your (and Sergey's) advice, I tried using the vertex
and fragment shaders from the Android OpenGL ES2 example. I don't get
any errors from OSG, but I still don't get any output except for an
empty viewport. I've made sure my object is in front of the camera,
etc.

osg output:
http://pastie.org/4034304

source (same as above, just using shaders now)
http://pastie.org/4034318


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


[osg-users] OpenSceneGraph on the Playbook

2012-06-04 Thread Preet
Hiya,

I managed to compile and deploy a small OSG test application on the
Playbook, but have run into some trouble getting it to work correctly.
I'm not creating my own context or windowing system; instead I'm using
osg's GraphicsWindowEmbedded with Qt. As a test, I set up a scene with
a rotating cube. The application seems to display the viewport
(there's the telltale purple-blue background in OSG), but fails to
render the cube.

The output seems to indicate that creating a shader for the cube
fails, but I can't discern any more than that. It feels like this has
something to do with OpenGL ES2... I compiled OSG for ES2 based on the
instructions I found on the mailing list and the OSG website. I've
pasted the output I think is relevant below, with the full output
here: (http://pastie.org/4027605), and the OSG scene set up here:
(http://pastie.org/4027631). The application works fine and renders as
expected using OpenGL on my desktop. Could anyone suggest something to
get this working?


Preet



glVersion=2, isGlslSupported=YES, glslLanguageVersion=1.016
State::convertShaderSourceToOsgBuiltIns()
++Before Converted source

void main()
{
  gl_Position = ftransform();
  gl_FrontColor = gl_Color;
}


 Converted source
uniform mat4 osg_ModelViewProjectionMatrix;
attribute vec4 osg_Color;
attribute vec4 osg_Vertex;

void main()
{
  gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
  gl_FrontColor = osg_Color;
}



Compiling VERTEX source:
1: uniform mat4 osg_ModelViewProjectionMatrix;
2: attribute vec4 osg_Color;
3: attribute vec4 osg_Vertex;
4:
5: void main()
6: {
7:   gl_Position = osg_ModelViewProjectionMatrix * oVERTEX
glCompileShader  FAILED
VERTEX Shader  infolog:
0:8(16): error: `gl_FrontColor' undeclared
0:8(16): error: type mismatch

FRAGMENT glCompileShader  FAILED
FRAGMENT Shader  infolog:
0:6(19): error: `gl_Color' undeclared
0:6(19): error: Operands to arithmetic operators must be numeric
0:6(19): error: type mismatch

glLinkProgram  FAILED
Program  infolog:
linking with uncompiled shaderlinking with uncompiled shader
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Enabling notifications from within program?

2012-06-01 Thread Preet
Thanks to all for the replies... I wasn't getting any output because
of some unrelated linking errors. After fixing them, debugging is
working as expected :)

On Fri, Jun 1, 2012 at 2:46 AM, Sergey Polischuk pol...@yandex.ru wrote:
 Hi

 You can set your own notify handler like this to check if you ever get 
 messages from osg:

 class NH : public osg::NotifyHandler
 {
 public:
        NH()
                : m_out(osg_log.txt)
        {
        }
        ~NH()
        {
                m_out.close();
        }
        void notify (osg::NotifySeverity severity, const char *message)
        {
                m_out  message;
        }
 private:
        std::ofstream m_out;
 };

 osg::setNotifyHandler(new NH);

 Cheers,
 Sergey.

 31.05.2012, 22:25, Preet prismatic.proj...@gmail.com:
 Hi Robert,

 That's what I'm currently doing (ie using stack traces to try and
 figure stuff out), but I was wondering why osg doesn't give me *any*
 output at all. For instance, I'm apparently able to do a bunch of
 stuff: Load an *.osg model, setup an animation path, create nodes,
 etc, pretty much all of the scene setup goes fine up until I try to
 create the viewer. Doesn't doing any of those things before the viewer
 provide output when I've set the notify level to debug? I made sure I
 compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for
 that flag was) to allow notifications.

 On Thu, May 31, 2012 at 4:57 AM, Robert Osfield
 robert.osfi...@gmail.com wrote:

  Hi Preet,

  The osg::notify system isn't related to handling of std exceptions
  except where some specific code might catch an exception and report
  the output to osg::notify.  This means that upping the notify level
  won't effect how exceptions are handled.

  The best thing to do is run a debugger and the look at the stack trace
  where the application crashes.

  Robert.

  On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote:
  Hiya,

  I'm trying to debug a std::bad_alloc() exception from osg that doesn't
  product any other output. I can't set environment variables, so I
  tried:
  osg::setNotifyLevel(osg::DEBUG_INFO);

  This still doesn't give me any output. The system I'm on dumps stdout
  and stderr to a log file in a specific directory and since Notify.cpp
  dumps to both of those it seems like I should be seeing something, but
  I'm not. However, I do get statements like std::cout  Hello 
  std::endl outputted as expected when used in my application (just not
  from osg). Am I missing something obvious?

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

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


[osg-users] Enabling notifications from within program?

2012-05-31 Thread Preet
Hiya,

I'm trying to debug a std::bad_alloc() exception from osg that doesn't
product any other output. I can't set environment variables, so I
tried:
osg::setNotifyLevel(osg::DEBUG_INFO);

This still doesn't give me any output. The system I'm on dumps stdout
and stderr to a log file in a specific directory and since Notify.cpp
dumps to both of those it seems like I should be seeing something, but
I'm not. However, I do get statements like std::cout  Hello 
std::endl outputted as expected when used in my application (just not
from osg). Am I missing something obvious?

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


[osg-users] Explanation of macros in staticviewer example?

2012-05-31 Thread Preet
Hiya,

In the osgstaticviewer.cpp example, there are three sets of macros:

USE_OSGPLUGIN()...
USE_DOTOSGWRAPPER_LIBRARY()...
USE_SERIALIZER_WRAPPER_LIBRARY()...

When compiling a static application, how do we know which ones we need
to include? It seems like they're all related to osgDB with
USE_OSGPLUGIN corresponding to plugins. I'm not sure what the other
two are for.


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


Re: [osg-users] Building a slimmed down static version of OSG

2012-05-31 Thread Preet
Quick follow up:

The error seems to occur when linking using GCC 4.4.2, which is part
of the tool chain I use. When I use my distro's GCC 4.7 to do a static
build with the same CMake settings, I don't get the error. To get
around it in 4.4.2, I explicitly defined requestRedraw() in
GraphicsWindowEmbedded and had it call
GraphicsWindow::requestRedraw(). I don't know if this creates any new
problems since I still haven't gotten osg working, but it looks like
it shouldn't do anything evil and may be worth changing in source if
someone else can confirm its a bug with older compilers.

Status so far: I can deploy an app with osg to the PlayBook but it
instantly crashes. Right now I'm basically sifting through core dumps
and seeing what else I can do to try and get it to work.


Preet

On Thu, May 31, 2012 at 12:07 PM, Thomas Hogarth
thomas.hoga...@gmail.com wrote:
 Hi Preet

 Not too sure what exactly your issue is but the error

 (.rodata._ZTVN9osgViewer22GraphicsWindowEmbeddedE[_ZTVN9osgViewer22GraphicsWindowEmbeddedE]+0xcc):-1:
 error: undefined reference to `non-virtual thunk to
 osgViewer::GraphicsWindow::requestRedraw()'

 Suggests that your osgViewer lib isn't linked or GraphicsWindow.cpp wasn't 
 compiled into your lib.

 Setting the windowing system to None is correct but it may be that it needs 
 to be set before you run cmake. Look at osgViewers CMakeLists.txt and see how 
 it's done on Android.

 Cheers
 Tom

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





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


Re: [osg-users] Enabling notifications from within program?

2012-05-31 Thread Preet
Hi Robert,

That's what I'm currently doing (ie using stack traces to try and
figure stuff out), but I was wondering why osg doesn't give me *any*
output at all. For instance, I'm apparently able to do a bunch of
stuff: Load an *.osg model, setup an animation path, create nodes,
etc, pretty much all of the scene setup goes fine up until I try to
create the viewer. Doesn't doing any of those things before the viewer
provide output when I've set the notify level to debug? I made sure I
compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for
that flag was) to allow notifications.

On Thu, May 31, 2012 at 4:57 AM, Robert Osfield
robert.osfi...@gmail.com wrote:
 Hi Preet,

 The osg::notify system isn't related to handling of std exceptions
 except where some specific code might catch an exception and report
 the output to osg::notify.  This means that upping the notify level
 won't effect how exceptions are handled.

 The best thing to do is run a debugger and the look at the stack trace
 where the application crashes.

 Robert.

 On 31 May 2012 07:57, Preet prismatic.proj...@gmail.com wrote:
 Hiya,

 I'm trying to debug a std::bad_alloc() exception from osg that doesn't
 product any other output. I can't set environment variables, so I
 tried:
 osg::setNotifyLevel(osg::DEBUG_INFO);

 This still doesn't give me any output. The system I'm on dumps stdout
 and stderr to a log file in a specific directory and since Notify.cpp
 dumps to both of those it seems like I should be seeing something, but
 I'm not. However, I do get statements like std::cout  Hello 
 std::endl outputted as expected when used in my application (just not
 from osg). Am I missing something obvious?

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


Re: [osg-users] Building a slimmed down static version of OSG

2012-05-30 Thread Preet
After a bit more playing around I'm able to get the linking down to
one error (the previous errors were because of linking in the wrong
order):

(.rodata._ZTVN9osgViewer22GraphicsWindowEmbeddedE[_ZTVN9osgViewer22GraphicsWindowEmbeddedE]+0xcc):-1:
error: undefined reference to `non-virtual thunk to
osgViewer::GraphicsWindow::requestRedraw()'

I wanted to make sure I wasn't screwing up static compilation, so I
tried shared libs as well and got the same error message. I have no
idea what this error message means and google wasn't much help (at
least it feels like I'm getting closer!)

* I'm using the latest source from git since 3.0.1 and 3.1.2 failed to
compile against OpenGL ES 2 (for me anyway)
* I set the windowing system to None in CMake before compiling (is
that what's causing this issue?)
* Qt is available on the device and I was planning to use
GraphicsWindowEmbedded with Qt's OpenGL context


I'd appreciate some help in figuring out where to go from here.

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


Re: [osg-users] Building a slimmed down static version of OSG

2012-05-29 Thread Preet
Quick follow up,

After playing around with the CMake gui for awhile, I managed to get
it to compile a set of static libs. Unfortunately it seems that
OpenThreads is missing from the built libs, and trying to compile a
project that links with osg results in a bunch of errors regarding
missing OpenThreads symbols.

The Playbook runs QNX, which has pthreads. The CMake Configure still
seems to fail the OpenThreads tests (is there anything I can point
CMakeLists to so it'll pass the tests?). I'd appreciate any advice.

Regards,

Preet


On Mon, May 28, 2012 at 6:00 PM, Preet prismatic.proj...@gmail.com wrote:
 Hi,

 I'm trying to build OSG for another platform (the BlackBerry
 Playbook). The NDK for the Playbook includes the tool chains required
 to compile libs/apps for the device. It also has OpenGL ES 1.1/2.0
 libs, EGL, freetype, etc. I feel like it should be possible to compile
 OSG for the Playbook but I'm a little lost dealing with the included
 CMakeLists.

 I tried looking at this for reference:
 http://www.openscenegraph.com/index.php/documentation/platform-specifics/ios/23-configuring-cmake-for-ios,
 but I don't understand how to enable/disable certain plugins for OSG
 when configuring with CMake or how to know what's really required in a
 minimal build.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Building a slimmed down static version of OSG

2012-05-29 Thread Preet
Thanks for the reply.

After messing with the CMakeLists in OpenThreads (forced pthreads), I
got it to compile and build me a static lib archive... unfortutely I
have pretty much the same problem, about a bajillion of these errors
originating from various osg sources.

Program.cpp:(.text+0x5158): undefined reference to
`OpenThreads::Mutex::Mutex(OpenThreads::Mutex::MutexType)'
Program.cpp:(.text+0x5160): undefined reference to
`OpenThreads::Mutex::~Mutex()'



On Tue, May 29, 2012 at 5:02 PM, Thomas Hogarth
thomas.hoga...@gmail.com wrote:
 Hi Preet

 Good to hear you're working on a Blackberry port.

 In regard to the libs you need your main aim is to get osgViewer compiling.
 If that compiles then you can setup a viewer a render your scenegraph.

 You'll have two options for this, you can either create your own 
 implementation of osgViewer::GraphicsWindow to handle setting up an OpenGL 
 context, window etc. Or you can just use the OpenGL example you have and 
 setup the viewer using the setupViewerAsEmbeded function which will allow you 
 to draw the osg scenegraph into your example OpenGL view.

 Probably easiest to try setupViewerAsEmbeded first to test osg itself is 
 working, then you can try and create your own viewer.

 With regard to OpenThreads it's probably related to the actual operating 
 system you are using to build the libs. For example if you are on windows 
 then CMake is probably selecting the windows threading stuff because it's not 
 aware your trying to build for blackberry.

 If you take a look at src/OpenThreads/CMakeLists.txt near the bottom you'll 
 find this


 Code:
 IF(NOT ANDROID)
 # Use our modified version of FindThreads.cmake which has Sproc hacks.
    FIND_PACKAGE(Threads)
 ENDIF()
 # Do we have sproc?
 IF(CMAKE_SYSTEM MATCHES IRIX)
    IF(CMAKE_USE_SPROC_INIT)
        # In this case, only Sproc exists, so no option.
        SET(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS 1)
    ELSE()
        IF(CMAKE_HAVE_SPROC_H)
            OPTION(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS Set to ON to 
 build OpenThreads against sproc instead of pthreads OFF)
        ENDIF()
    ENDIF()
 ENDIF(CMAKE_SYSTEM MATCHES IRIX)

 # Add support for using Qt threads
 IF(QT4_FOUND)
    OPTION(BUILD_OPENTHREADS_WITH_QT Build OpenThreads with Qt threading 
 support. OFF)
 ENDIF()

 # Maybe we should be using the FindThreads.cmake module?
 IF(ANDROID)
    SUBDIRS(pthreads)
 ELSEIF(QT4_FOUND AND BUILD_OPENTHREADS_WITH_QT)
    SUBDIRS(qt)
 ELSEIF(WIN32)
    # So I think Cygwin wants to use pthreads
    IF(CYGWIN)
        SUBDIRS(pthreads)
    ELSE()
        # Everybody else including Msys should probably go here
        SUBDIRS(win32)
        # examples)
    ENDIF()
 ELSE()
    IF(UNIX)
        IF(OPENTHREADS_USE_SPROC_INSTEAD_OF_PTHREADS)
            SUBDIRS(sproc)
        ELSE()
            SUBDIRS(pthreads)
        ENDIF()
    ELSE()
        MESSAGE(Sorry, OpenThreads may not support your platform)
    ENDIF()
 ENDIF()




 In there it is selecting the correct  threading module for the platform. For 
 a temporary fix you can just force the use of pthreads.

 Regarding plugins, cmake will only generate build targets for pulgins for 
 which it has found the dependancies. Be careful though that it doesn't find 
 your operating system versions. For good asset support you'll need at least
 libpng for loading of png images, and freetypes for fonts.

 The osg format plugins themselves have no external dependancies so should 
 build as long as osg does.

 Cheers
 Tom

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





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


[osg-users] Building a slimmed down static version of OSG

2012-05-28 Thread Preet
Hi,

I'm trying to build OSG for another platform (the BlackBerry
Playbook). The NDK for the Playbook includes the tool chains required
to compile libs/apps for the device. It also has OpenGL ES 1.1/2.0
libs, EGL, freetype, etc. I feel like it should be possible to compile
OSG for the Playbook but I'm a little lost dealing with the included
CMakeLists.

I tried looking at this for reference:
http://www.openscenegraph.com/index.php/documentation/platform-specifics/ios/23-configuring-cmake-for-ios,
but I don't understand how to enable/disable certain plugins for OSG
when configuring with CMake or how to know what's really required in a
minimal build.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Current state of GLES2

2012-04-25 Thread Preet
On Tue, Apr 24, 2012 at 4:44 AM, Robert Osfield
robert.osfi...@gmail.com wrote:

 However, you can use the OSG with OpenGL 2.0 with a purely shader
 based state and if you do this the actual shaders you use for OpenGL
 or OpenGL ES 2.0 will be very similar.  This similarity means you can
 prototype an OpenGL ES application in OpenGL just be using the shaders
 and avoiding all built in state.

I'm fuzzy on the shader stuff. For all my 3d dev, I just jumped into
using osg, and whatever I've built has been derived from
tutorials/examples given online. With the level of abstraction osg
provides, I haven't had to make any OpenGL calls directly, so when you
say using the shaders and avoiding all built in state... I don't
understand what avoiding all built in state is in an osg context.
Does it mean I shouldn't be using osg::StateSet?

 You can also build the OSG so that
 it doesn't compile in the fixed function state, something that you do
 when you want to compile against the core profile of OpenGL 3.x.

I'm using http://www.openscenegraph.org/projects/osg/wiki/Community/OpenGL-ES
to set the environment up... and since I'd like to develop for OpenGL
ES 2, I'll be using Cmake settings for Emulating OpenGL ES 2.0 when
you only have standard OpenGL available to build osg to create my
app. When it comes time to actually deploy, I'm guessing I'd rebuild
osg against Cmake settings for OpenGL ES 2.0?

I also downloaded an emulator/sdk for OpenGL ES 2 from PowerVR, and
ran a bunch of default examples they provided. Does that factor in at
all? They provide libEGL.so and libGLESv2.so libs for linking as well.

On Mon, Apr 23, 2012 at 6:19 PM, Chris Hanson xe...@alphapixel.com wrote:
 Yes, with ShaderGen.
What exactly is involved in using ShaderGen? From the osgshadergen
example, it looks like all that's done it is attaching it as a node
visitor to your scene graph. Does it just automagically go through
your scene and convert fixed function pipeline stuff to shader
pipeline stuff?

 Which OS? OSG really only has ES2/EGL windowing interfaces for Xwindows -- 
 Win32 is not implemented.
I'm on Linux

Sorry for all the questions and thanks for the valuable feedback/support


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


Re: [osg-users] Current state of GLES2

2012-04-25 Thread Preet
Hiya,

Thanks Robert and Chris for your insight and advice. I think I'll try
deploying using OpenGL ES 1.1 with what I have for now, and rebuild
the OSG stuff using shaders to eventually build with ES 2.0. As Robert
mentioned, this way I'll get a decent amount of exposure to GLSL and
the new pipeline before getting in way over my head.

   Well, if you got the PowerVR emulator working, you're ahead of me.
I was surprised that it 'just worked'... that usually never happens
with Linux. Downloaded it, unzipped it and all the examples ran
flawlessly. It's even more surprising considering I have a really old
machine with spotty driver support (integrated ATi chipset). If it
helps, I'm running Arch Linux with all the latest updates. The SDK I
got was the ES 2.0 Emulation for PC (Linux) off this page:
http://www.imgtec.com/powervr/insider/sdkdownloads/.


Regards,

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


Re: [osg-users] Current state of GLES2

2012-04-23 Thread Preet
Hiya,

Not to hijack this thread, but I'm also interested in porting my osg
application to an OpenGL ES2 device. I'm new to OSG and OpenGL but I
understand that ES2 has some pretty significant changes in how things
are drawn. What sort of steps should I be taking to accomplish this?
I'm not sure what level of 'continuity' OSG offers between the
different OpenGL versions, and I didn't design the original
application with OpenGLES in mind (no shaders, just simple geometry,
transforms and materials). Based on this thread I get the feeling I
shouldn't expect my application to 'just work'... so what's the right
way to proceed? Does 'most' of OSG's basic functionality still work
with ES2? Will I need to rewrite much of my code?

I downloaded an OpenGLES2 emulator from PowerVR... I'll try to compile
OSG for ES2 and see if I can get any examples working, but beyond that
I really don't know how to approach this and would appreciate any
advice.


Regards,

Preet

On Mon, Apr 23, 2012 at 4:51 PM, Eduardo Poyart poy...@gmail.com wrote:
 Very clarifying, thank you.

 I did experiment with ShaderGen and I even patched it to generate
 GLES2 code. However I'm going in a different direction.

 My models are simple. I wrote my own shader and added it to the root
 node. My shader currently has a fixed light position for testing
 purposes. Now I want to render it with textures.

 If OSG would detect GLES2 and appropriately write standard-named
 uniforms for textures, I could just use those names in the shader.
 Maybe that needs to be done in State::applyModeOnTexUnit, since there
 is code there for fixed-function Opengl (glEnable(GL_TEXTURE_2D)).

 If that seems like a good direction, I'll try to do it for textures.
 The same thing can be done for light positions later. This way I leave
 ShaderGen out of the way, and it can be improved later.

 Eduardo

 On Mon, Apr 23, 2012 at 7:51 AM, Robert Osfield
 robert.osfi...@gmail.com wrote:
 Hi Thomas et. al,

 I won't have a chance to complete the shader composition functionality
 in the near term so an improved ShaderGen would be welcome.

 Handling items like lights, texgen and clipplanes will require some
 handling elsewhere other than with just the standard functionality -
 we'll need to have the osg::Light, osg::TexGen  and osg::ClipPlane all
 be written as appropriate osg_* uniforms with the values being passed
 to OpenGL using the current modelview matrix as is done by OpenGL with
 the fixed function pipeline.  This might require amendments to
 osg::State/osgUtil::RenderStage and the osg::Light, osg::TexGen and
 osg::ClipPlane, but it might also be possible with just amendments to
 state attributes if they do a little compute work prior to passing
 their values to OpenGL as uniforms. I would suggest finding a workable
 solution for lights then when this works roll it out for the other
 positional state.

 Thoughts?
 Robert.

 On 23 April 2012 15:16, Thomas Hogarth thomas.hoga...@gmail.com wrote:
 Yes I have a GLES2 version of shader gen. At the moment it only supports a 
 fixed hardcoded light position, which isn't great but it does support, 
 texturing, lighting etc.

 I've attached it and we can look at including into core osg, but I think 
 support for at least the initial position of one light source would be 
 good. Also we need to either test for backward compatibility with GL2 or 
 have two versions of ShaderGen in the core.

 I know Roberts long term goal is to introduce a Shader Composer system 
 (bits and pieces already exist), but this can work as an aid to new 
 developers until then.

 Let me know how you get on with it.
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How do I fill the framebuffer with an alpha channel?

2012-04-17 Thread Preet
Hey,

I have some geometry which has a single primitive set that's a
tri-strip. Some of the triangles in the primitive overlap, so when I
add a material to the geometry with an alpha value I see the overlap
as shown here:

http://i.stack.imgur.com/s5yqV.png

I don't want the object's opacity to be affected by self
interferences. I read that one way to solve this in generic OpenGL is
to fill the framebuffer with your desired alpha channel, switch the
blending mode to glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA) and
draw the geometry. I can use osg::BlendFunc properly, but...

* I don't know how to preemptively fill the framebuffer with your
desired alpha channel with osg. Can anyone provide any pointers as to
how that can be done?


Regards,

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


Re: [osg-users] [build] How can I obtain the osgQt library?

2012-04-17 Thread Preet
Hiya,

Same thing happened to me. You didn't mention which OS you were on,
but if you can't find osgQt separately for your distro, you can always
grab from source and compile it.

Preet

On Tue, Apr 17, 2012 at 3:31 AM, Mark Green hlgamead...@hotmail.com wrote:
 Hi,

 This is probably a stupid question, but how do I obtain the osgQt lib file? 
 Unlike the other libraries I needed, It did not seem to come with my original 
 install, and I have been unable to locate the lib file in any of the 
 downloads on this site or anywhere else on the net.


 Thank you!

 Cheers,
 Mark

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





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


Re: [osg-users] [build] How can I obtain the osgQt library?

2012-04-17 Thread Preet
Hiya,

I'm not too sure how to use CMake with Windows. There was an older
message on this list you might find helpful:
http://comments.gmane.org/gmane.comp.graphics.openscenegraph.user/67825

Its a bit overkill because it compiles all of osg if you follow it
step for step. When you run CMake on the top level directory of
OpenSceneGraph, it'll generate the files necessary to build all the
OpenSceneGraph components. Depending on your IDE/build setup once you
run CMake, you can probably figure out how to compile just osgQt.
Again, I'm not too familiar with building on Windows, so maybe someone
else from the list can chime in.


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


[osg-users] Rendering osgText::Text using osg::Material?

2012-04-13 Thread Preet
Hey all,

I'd like to render osgText using a material instead of the default
osgText::setColor() method. This is because I instance the same text
geometry, but would like to paint it different colors without
duplicating anything. To do this, I add a material as an attribute to
the text node. The material has colorMode set to OFF. Setting the
diffuse color to my target color doesn't really work (alpha value
works, but colors dont), but setting the emission color works fine.
Why is this? Lighting is on.

osg::Material myMat = new osg::Material;
myMaterial-setColorMode(osg::Material::OFF);
myMaterial-setDiffuse(osg::Material::FRONT,osg::Vec4(1,0,0,1));
...
osgText::Text textChar = new osgText::Text;
textChar-getOrCreateStateSet()-setAttribute(myMaterial.get());   //
black text, but alpha value works

myMaterial-setEmission(osg::Material::FRONT,osg::Vec4(1,0,0,1));   //
red text, alpha works


Regards,

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


[osg-users] Quick questions about assigning render bins

2012-04-12 Thread Preet
I need to render a bunch of different objects using layer data and I'm
doing it by disabling depth test and specifying a render bin to
control render order... something like

myObject-getOrCreateStateSet()-setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
myObject-getOrCreateStateSet()-setRenderBinDetails(11,RenderBin);

* Should I be doing this on a per-object basis, or would I see better
performance if I created group nodes with the right renderbin setup
and then added the objects to the group nodes (assume hundreds of
objects, but 10-20 layers)? (I don't know how OSG sorts/orders the
scene graph nodes before rendering)

* Some of my objects have transparency, but again, I'm specifying
render order. So is it okay to put those objects in the RenderBin
renderbin as opposed to the DepthSortedBin? If Objects A and B are
both transparent, both in RenderBin (10) and RenderBin (11)
respectively, and A is behind B, I should see object A through B
correct? This is what some preliminary test code seems to indicate
(and in that code switching from DepthSortedBin to RenderBin
doesn't result in any changes).


Regards,

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


[osg-users] Unexpected osgText::TextBase::computeBound() behaviour

2012-04-09 Thread Preet
Hi all

Calling computeBound() on an osg::Text object seems to return height
values as if the text were aligned using the baseline of the first
line of text only. So if I had a text object with a total height of
50, using an alignment of osgText::TextBase::CENTER_CENTER positioned
at (0,0,0), I'd expect yMin and yMax from the bounding box to be at
-25 and 25. Instead it'll be according to what I specified previously.
This happens with or without multiple lines in the text.

I've linked a minimal example and a screenshot illustrating the issue.
The screenshot shows the bounding box with respect to the text. Ignore
the glitchy character glyphs -- that's an issue with the drivers on my
system.

screenshot: http://imgur.com/YJasY
code: http://pastie.org/3754296

Regards,

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


[osg-users] Can I have instances (vs. clones) with different colors?

2012-04-06 Thread Preet
Hey all,

My scene makes use of a *lot* of repeating geometry. The geometry is
either simple primitives (sphere, pyramids, etc) or osgText::Text.
These objects are duplicated many times and are
scaled/rotated/translated all over the scene. The objects need to have
differing colors and transforms, but other than that they have
identical geometry.

Is there any way I can use instances of the same geometry instead of
cloning them over and over again? I can parent the geometry nodes with
their corresponding transforms using the same instance, but I can't
set a different color. Just to try it out, I used instancing (with the
same color for everything) as opposed to cloning, and the time to
render the scene was cut by half (which is important in my application
since I'm targeting mobile). I'd appreciate any advice!


Regards,

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


[osg-users] osgUtil::Tessellator not working with double precision

2012-04-03 Thread Preet
Hiya,

I need Vec3d precision for my geometry. I spent a long time trying to
figure out why tessellator wouldn't work at all on my data, until I
changed all of my Vec3d's to 'Vec3' on a whim. Now it works fine...
but the issue still remains. How can I use double precision with
tessellator?


Regards

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


[osg-users] Efficient usage of Tessellator

2012-03-29 Thread Preet
Hiya,

I have a bunch of shapes that can be kind of complex that I want to
draw in osg, and I only have their border points available. I can draw
them fine if I use the tessellator util. What I'd like to know is what
underlying primitives are sent to OpenGL when I do tessellation. For
example, here's some code:

osg::ref_ptrosg::Geometry geom = new osg::Geometry;
geom-setVertexArray(vertices.get());
geom-addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,0,numOuterPolyPoints));
geom-addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,numOuterPolyPoints,
  numInnerPolyPoints));

osgUtil::Tessellator geomTess;
geomTess.setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
geomTess.retessellatePolygons(*geom);

osg::ref_ptrosg::Geode nodeGeom = new osg::Geode;
nodeArea-addDrawable(geom);
myRootNode-addChild(nodeGeom);

I've read that GL_POLYGON is slow, unavailable with OpenGL ES and even
deprecated after 3.x. Does the Tessellator change the initial
primitive type? Should I be doing the above code differently to
maximize compatibility and/or performance (ie use a triangle
primitive)? If so, how?


Regards,

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


[osg-users] Creating an 'outline' effect in osgText?

2012-03-22 Thread Preet
Hey all,

I'm trying to create an outline effect with osgText. Here's an example
of what I'm trying to accomplish:
http://gimpology.com/uploads/3_8_8.png

How can I get a similar effect?


Regards,

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


Re: [osg-users] Creating an 'outline' effect in osgText?

2012-03-22 Thread Preet
Hey,

On Thu, Mar 22, 2012 at 7:03 PM, Hamm, Brandon
brandon.h...@qinetiq-na.com wrote:
 Preet,

 Take a look at the osgtext example.  There's a setBackdropType() member
 function of osgText::Text that you can call to set a backdrop type of
 osgText::Text::OUTLINE.  You can specify the color of the outline using
 the member function setBackdropColor.

Thanks. This seems to be exactly what I'm looking for.


 Brandon Hamm


I have a general follow up question about osgText. I'd like to draw
the text along a path. I thought a good way to do this would have been
to rotate the text character by character. So I'd create an osgText
object for each character of text, and position/align them along the
path... but this doesn't seem to preserve spacing between characters
(this is expected, but I don't really know how to get around it), and
the space character itself ( ) as an individual osgText object seems
to have a width of zero (calculated with osg::Drawable::getBound()).

* Is the approach I'm taking a 'good' one? If not, what would be a
better methodology?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Maintaining a reference to an osg node outside of osg

2012-03-16 Thread Preet
Hiya,

Typically I use osg::ref_ptr to let osg handle reference counting.
Right now I'm trying to create a 'rendering engine' for another
library with osg. The idea for the other library is to maintain an API
that allows different rendering engines -- osg, ogre, vtk, etc. The
other library has virtual methods that are called when objects need to
be added and removed from the scene, ie:

void RemoveObjectFromScene(SomeStruct myStruct)

The objects can be thought of as having a 1:1 relation with osg nodes.
I'd like to maintain a reference to the osg node corresponding to the
object so I don't have to traverse the scene graph to find a given
node (there are a lot of objects and this would get way too expensive
I think). I can modify SomeStruct as long as its library-agnostic --
so no osg specific stuff goes in there. Could I use a void * or
something similar to store a reference?

SomeStruct
{
   void * mysteryPtr;
}

{
osg::ref_ptrosg::Node myNode = new osg::node;   // 1 ref to myNode
m_persistant_root_node-addChild(myNode);   // 2 refs to myNode

mysteryPtr = myNode.get();   // 2 refs to myNode (no change!)
}
// 1 refs to myNode since ref_ptr has gone out of scope as long as
m_persistent_root_node is alive
// mysteryPtr has NO bearing to any ref counting, except for the
fact that's its a valid pointer to osg::node as
// long as we have  0 refs to it

I'd be very grateful if someone could verify the above logic. If I'm
in the wrong here, I'd appreciate any advice pointing me in the right
direction.


Regards,

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


Re: [osg-users] Maintaining a reference to an osg node outside of osg

2012-03-16 Thread Preet
Hi,

On Fri, Mar 16, 2012 at 4:43 PM, John Kaniarz john.kani...@us.army.mil wrote:
 What you're trying to do is the PIMPL design pattern.  I'll leave the details 
 to Google :)

 You may also want to brush up on the Factory design pattern for generating 
 your opaque handles.

 In a direct answer to your question, no you can't use a void* to store a 
 ref_ptr (without some trickery). You can, however, store a pointer to a 
 ref_ptr as a void* . Then when you need to use it, convert it like this to 
 avoid having to double dereference it every time you use it.


If I do this, then I need to maintain the underlying ref_ptr object
no? This isn't particularly convenient. What was wrong with assigning
the osg::Node's pointer to mysteryPtr instead? Basically with ...

osg::ref_ptrosg::Node someNode;
mysteryPtr = someNode.Get();

As long as the pointer returned by the Get() method is valid for the
lifetime of the object I'm safe right? Then if I want to do anything
with object:

osg::ref_ptrosg::Node someNode = some_cast_callosg::Node*(mysteryPtr);
someNode-partyAllDay();


 Code:
 ref_ptr Node node = *reinterpret_cast ref_ptr Node *(mysteryPtr);



 And don't forget to delete the pointer to the ref_ptr when you're done. if 
 you leak the ref_ptr the node will never get collected.

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





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


Re: [osg-users] Stitching together sphere geometry in OpenSceneGraph

2012-03-02 Thread Preet
Thanks, setting the texture's wrap mode to CLAMP_TO_EDGE worked perfectly!


Regards,

Preet

On Thu, Mar 1, 2012 at 10:45 PM, Jean-Sébastien Guay
jean_...@videotron.ca wrote:
 Hello Preet,


 * The issue I've run into involves where my 2D texture wraps around
 and meets itself on the sphere:
 http://i.imgur.com/ftVH2.png


 I don't think there's anything wrong with your geometry and texcoords. Good
 work!

 The problem looks like you may be using the default texture wrap mode, which
 is CLAMP. This mode can also be called clamp to border, which when texture
 coordinates run outside the range of 0-1 will give a border color, which
 defaults to black. The problem is that when the texture coordinates are
 exactly 0 or 1, when you have linear interpolation enabled as filter mode
 (again the default), then the border color will still get sampled (since
 it's trying to filter using that texel and the one next to it, which is
 outside the 0-1 range). So you get those black lines around your textures.

 Try to specify the CLAMP_TO_EDGE wrap mode instead. This will simply sample
 the same texel at the border and should eliminate the black line.

 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guay              jean_...@videotron.ca
                    http://whitestar02.dyndns-web.com/
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Objects with (very) high mesh resolution not showing up in viewer?

2012-03-01 Thread Preet
Hiya,

I used OpenSceneGraph to generate some straightforward geometry; an
ellipsoid representing the Earth. I wrote a function which calculated
vertices, normals, texture coords and indices for the geometry. The
function takes the number of 'sectors' and 'rings' as arguments to
generate spherical geometry. It works fine until I hit some limit as I
increase the resolution of the mesh (by passing a larger number of
sectors and rings to the function), after which point osgviewer
doesn't display the data. There aren't any errors; the geometry just
doesn't show up in the viewer. If I go back beyond some threshold the
geometry shows up again. What's going on?


Regards,

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


Re: [osg-users] Objects with (very) high mesh resolution not showing up in viewer?

2012-03-01 Thread Preet
I think it might be a scale issue wrt to the camera. I just found out
about the OSG_NOTIFY_LEVEL env var, and I get a bunch of messages
about the viewer's drawing traversal:

cull_draw() 0x988f788
_clampProjectionMatrix not applied, invalid depth range, znear =
3.40282e+38  zfar = -3.40282e+38
end cull_draw() 0x988f788

I'm using large scaled units (ie, millions) in the scene. Maybe the
geometry isn't within the camera's frustum, or something like that? I
don't get why change the number of vertices that make up the geometry
would cause a change like that though.

I construct a spheroid using arguments for parameters that correspond
to latitude / longitude style divisions. The latitude argument defines
how many 'rings' go down one axis of the sphere, and the longitude
argument defines how many 'sectors' each 'ring' is divided into. So if
I specify 36 rings and 72 sectors for each ring, I expect my sphere to
have (36*72) vertices. This works fine. If I up the ante to 48 rings
and 72 sectors, osgViewer won't show the geometry.

The function I call isn't doing anything special... and seems to
complete fine before being sent to the viewer.

http://pastie.org/3497231 - line 184 is where I defined the function.
I'm going to


Preet


On Thu, Mar 1, 2012 at 7:00 AM, Sebastian Messerschmidt
sebastian.messerschm...@gmx.de wrote:
 Hi Preet,

 can you give us some more details on the limit you are hitting here?
 Also I don't see any hints how your geometry is organized? As a single
 drawable?
 If the latter is the case, I guess you are simply hitting some OpenGL/Driver
 limits regarding the maximum size of a draw array.

 cheers
 Sebastian

 Hiya,

 I used OpenSceneGraph to generate some straightforward geometry; an
 ellipsoid representing the Earth. I wrote a function which calculated
 vertices, normals, texture coords and indices for the geometry. The
 function takes the number of 'sectors' and 'rings' as arguments to
 generate spherical geometry. It works fine until I hit some limit as I
 increase the resolution of the mesh (by passing a larger number of
 sectors and rings to the function), after which point osgviewer
 doesn't display the data. There aren't any errors; the geometry just
 doesn't show up in the viewer. If I go back beyond some threshold the
 geometry shows up again. What's going on?


 Regards,

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


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


[osg-users] Stitching together sphere geometry in OpenSceneGraph

2012-03-01 Thread Preet
Hey all,

I'm trying to draw a simple sphere (yes, I know there's a drawable
type available) to learn how to build up simple geometry, by
specifying vertices, normals, texture coordinates and indices. I
eventually want to create a function that will give me vertices for
spheroids that aren't perfect spheres, but follow the same principles.

I've been doing okay so far, and used a spherical coordinate transform
to get cartesian coordinates. I have vertices, normals, texture
coordinates and indices.

* The issue I've run into involves where my 2D texture wraps around
and meets itself on the sphere:
http://i.imgur.com/ftVH2.png

Like shown in the picture, there's a visible seam there. There are
also shadows where multiple identical vertices are present at the
poles. I'd like to know how to get rid of the seam and shadows!

I am manually mapping the texture using the simplest 2d
texture-sphere, shown here:
http://paulbourke.net/texture_colour/texturemap/texture.gif

If I use the bare minimum vertices (no duplicates) to define the
sphere then the seaming and shadows disappear but I'm unable have the
2D texture wrap all the way around, and see extreme warping at the
poles (which makes sense):
http://i.stack.imgur.com/l9baA.png


Regards,

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


[osg-users] A few questions on GraphicsWindowEmbedded

2012-02-28 Thread Preet
Hiya,

I was able to display osg content on Qt's Declarative interface
(QtQuick, QML, etc) using the osg::GraphicsWindowEmbedded class. I
followed the examples for the FLTK and GLUT toolkits to get this (sort
of) working. There are a few of things I don't understand, and would
appreciate some clarification on.

* What do the parameters passed to the
osgViewer::GraphicsWindowEmbedded constructor (x,y,w,h) actually do? I
played around with the values and it had no visible effect on my
displayed result

* What does GraphicsWindowEmbedded do behind the scenes? Since you
don't explicitly specify a GraphicsContext for it, does that mean it
uses the OpenGL context of the framework you're embedding it into?

* I noticed that the viewport is rendered onto the window in absolute
coordinates. With QtQuick, when you create an item to display on the
screen, it has a child/parent relationship and coordinates are
relative to the parent. Moving the parent will also move the child as
you'd expect. This doesn't happen with GraphicsWindowEmbedded though,
probably because with QtQuick, all the elements are painted onto one
'canvas' (I think), and GraphicsWindowEmbedded just paints straight
onto that.

* If, instead of having GraphicsWindowEmbedded draw on my screen
whenever I call the viewer's frame() method, is it possible to render
the viewer camera's output to a texture that I could manually draw
onto a quad or something? This way I don't have to specify absolute
coordinates for the viewport like I mentioned above. I already tried
this by rendering to an osg::Image, then painting it on the screen
with Qt, but I have a relatively old computer and
osg::Image-readPixels() takes too much time. My results with the
osgscreencapture example were also pretty terrible (15-16 fps @
640x480).

For anyone else who needs to do something similar, here's some scrap
code you can use to define a QDeclarativeItem that'll show an osg
view.

http://pastie.org/3478592  (header)
http://pastie.org/3478602  (source)


Regards,

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


Re: [osg-users] A few questions on GraphicsWindowEmbedded

2012-02-28 Thread Preet
Hi Robert,

Thanks for the thorough response. Simply put, QtQuick is a different
way to build up GUIs. It uses a hybrid CSS/JS language called QML to
design a UI instead of the widget / forms approach that GUI toolkits
usually employ. It is geared specially towards mobile and tablet
devices.

I'm working on a couple of projects for systems which have a small
touch display where typical UI design isn't appropriate. A very
specific example is an in car infotainment system. I'd like to use OSG
to render map data and display it in on my interface which I've built
through QtQuick. Here's an example of what my interface looks like:

http://prismaticproject.weebly.com/uploads/8/1/9/7/8197704/1660451_orig.png

Unlike normal QGLWidgets, which the GraphicsWindowQt class uses,
creating an item in QtQuick to display stuff is slightly different;
there are no 'widgets'. You instead create an item, where you get
access to a single paint() method where the only OpenGL functionality
you have is making direct calls. All QtQuick items are rendered onto a
single QGLWidget canvas. For example, I can do stuff like:

//glBegin(GL_QUADS);
//glColor3ub(0,0,255);
//glVertex2d(boundingRect().left(), boundingRect().top());
//...

And the item would render in its own assigned space on the screen,
maintaining all of its positional parent child relationships.


Regards,

Preet



On Tue, Feb 28, 2012 at 4:54 AM, Robert Osfield
robert.osfi...@gmail.com wrote:
 Hi Preet,

 On 28 February 2012 09:16, Preet prismatic.proj...@gmail.com wrote:
 * What do the parameters passed to the
 osgViewer::GraphicsWindowEmbedded constructor (x,y,w,h) actually do? I
 played around with the values and it had no visible effect on my
 displayed result

 They tell the GraphicsWidnowEmedded object where about the window it's
 representing is in desktop coordinates.

 * What does GraphicsWindowEmbedded do behind the scenes? Since you
 don't explicitly specify a GraphicsContext for it, does that mean it
 uses the OpenGL context of the framework you're embedding it into?

 GraphicsWindowEmbedded actually does nothing behind the scenes at all
 - it's a non op class designed to make it possible to reuse the
 osgViewer::Viewer and CompositeViewer classes in places that already
 provide the graphics context and are strictly single threaded and have
 a single window.  It's really tricking these classes that a designed
 to work with multi-threading and multi-context capable systems where
 makeCurrent() and swapBuffers() implementations are accessible to work
 without doing this operations so when calls to makeCurrent() and
 swapBuffers() are made by the viewer classes nothing happens.  Since
 nothing happens it's entirely up to the calling app to do it for the
 viewer because it can't do itself.

 Since GraphicsWindowEmbedded is design to avoid properly implementing
 the key context management functions on the OSG or a subclass side it
 does restrict how you can use the viewer classes.  It's very much a
 crude approach to provide viewer functionality, easy to get working
 yes, fully capable no.  You can't add the full capabilities back in
 when using GraphicsWindowEmbedded, if you don't need multi-threading
 or multi-context this will be fine, but if you do look elsewhere.

 Actually implementing a GraphicsWindow properly is the most powerful
 way to adapt 3rd party graphics contexts with the osgViewer, and this
 is done by the osgQt::GraphicsWindowQt class, as was as the
 GraphicsWindowX11, Win32, Cocoa and Carbon implementations found
 natively in osgViewer.


 * I noticed that the viewport is rendered onto the window in absolute
 coordinates. With QtQuick, when you create an item to display on the
 screen, it has a child/parent relationship and coordinates are
 relative to the parent. Moving the parent will also move the child as
 you'd expect. This doesn't happen with GraphicsWindowEmbedded though,
 probably because with QtQuick, all the elements are painted onto one
 'canvas' (I think), and GraphicsWindowEmbedded just paints straight
 onto that.

 I know absolutely nothing about QtQuick or how you've implemented the
 integration with GraphicsWindowEmbedded so I can't say anything about
 this.

 * If, instead of having GraphicsWindowEmbedded draw on my screen
 whenever I call the viewer's frame() method, is it possible to render
 the viewer camera's output to a texture that I could manually draw
 onto a quad or something? This way I don't have to specify absolute
 coordinates for the viewport like I mentioned above. I already tried
 this by rendering to an osg::Image, then painting it on the screen
 with Qt, but I have a relatively old computer and
 osg::Image-readPixels() takes too much time. My results with the
 osgscreencapture example were also pretty terrible (15-16 fps @
 640x480).

 If you want to do off screen rendering then this is very different
 thing, GraphicsWindowEmedded is not the best thing to do this, what
 you'll want is a pbuffer

Re: [osg-users] Displaying World Coordinate Frame in Relation to Local Coordinate Frame

2012-02-18 Thread Preet
Hi Scott,

It wasn't quite clear to me what you wanted represent with your
rocket's second set of axes. Your WCS origin is at the center of the
earth (ie, ECEF coordinates). Your rocket also has its own local
geometrical axes as your screenshots show. As your rocket orbits the
Earth, its ECEF coordinates (XYZ relative to Earth's center) will
change. I have no idea if this ASCII art will make any sense, but here
goes:

timepoint 1
ECEFlocal
z z
|__x  |__x

o -- earth   ||    rocket


timepoint 2
ECEF
z
|__x

o -- earth
   local
   z
  /__x

 //    rocket at some new position/orientation

If you translate the rocket to the center of the earth at any point
(so now the COG of the rocket is at (0,0,0)) only the orientation of
the rocket can change. Are you looking for the 'difference' between
the ECEF's X,Y and Z axes and your rocket's local X,Y,Z axes at any
given point in time? If so... then I think you can use linear algebra
to solve for the transform that gets you from ECEF to your local axes.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Rendering an OpenSceneGraph scene in Qt QuickRendering an OpenSceneGraph scene in QML Rendering an OpenSceneGraph scene in QML

2012-02-18 Thread Preet
Hiya,

I looked at the osgQt/GraphicsWindowQt class implementation. I think
what it does is render to Qt's QGLWidget's OpenGL context using
swapBuffers(). Again... being new to OpenGL, a lot of this stuff
doesn't really make too much sense to me, but the swapBuffers() call
is QGLWidget specific. There's no equivalent in the QDeclarative API,
so I couldn't find a way of exposing QGLWidget to QtQuick directly as
a QDeclarative item.

From what I've read online, I think that the best that can be done is
creating a custom QDeclarativeItem, and overriding its paint() method,
where direct OpenGL calls can be made. I tested this out and it
works... I can, for instance, paint geometry using glBegin() and
glEnd() exactly as you'd expect, and it'll show up in a QML object.

So I think I need to use OSG to render my scene as a texture to an
FBO, then draw that using straight OpenGL calls. This is where I'm
totally lost though.

So if I had to rephrase the problem: Assuming I had a viewport I could
only paint to using native OpenGL calls, how could I render an
OpenSceneGraph scene in it?

Regards,

Preet


On Fri, Feb 17, 2012 at 4:27 AM, Philipp Moeller
philipp.moel...@geometryfactory.com wrote:
 Preet prismatic.proj...@gmail.com writes:

 Hey all.

 I have an OpenSceneGraph tree I'd like to have displayed in QtQuick.
 I'd like the user to be able to interact with the scene where the
 mouse can zoom/pan/rotate the camera, just like osgViewer allows. I
 saw that there were a couple of examples (osgQtWidgets and
 osgQtBrowser), but they're a little over my head.

 I think the right way to start trying this is by starting with the
 QtDeclarative model
 (http://doc.qt.nokia.com/4.7-snapshot/qtdeclarative.html)... but I'm
 not too sure where to go from here. Does anyone have any suggestions?

 Regards,

 Pris

 Hi Preet,

 I've looked into integrating OpenSceneGraph into QML. You might want to
 start with the osgviewerQt to get started with a viewer integrated into
 Qt. Then you should have a look at [1] to see how you can expose your
 osg widget to QML. If I ever get something reusable up and running, I'll
 let the list know. If you go down the route of exposing scene graph
 functionality in your Qt application you will need to roll some
 implementation of QAbstractItemModel, which is a real pain. It get's
 easier if you restrain yourself to graphs where each element only has a
 single parent. If you can throw something together I would be really
 interested in it, so let me know.

 [1] : 
 http://developer.qt.nokia.com/doc/qt-4.8/gettingstartedqml.html#exposing-c-classes-to-qml

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


[osg-users] Rendering an OpenSceneGraph scene in Qt QuickRendering an OpenSceneGraph scene in QML Rendering an OpenSceneGraph scene in QML

2012-02-16 Thread Preet
Hey all.

I have an OpenSceneGraph tree I'd like to have displayed in QtQuick.
I'd like the user to be able to interact with the scene where the
mouse can zoom/pan/rotate the camera, just like osgViewer allows. I
saw that there were a couple of examples (osgQtWidgets and
osgQtBrowser), but they're a little over my head.

I think the right way to start trying this is by starting with the
QtDeclarative model
(http://doc.qt.nokia.com/4.7-snapshot/qtdeclarative.html)... but I'm
not too sure where to go from here. Does anyone have any suggestions?

Regards,

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


[osg-users] Unable to get osgViewerQt to work

2012-02-16 Thread Preet
Hiya,

I've been trying to run the osgViewerQt example. I have osg (including
osgQt) built from git. I'm able to use osgviewer without any issues.
When I try to run osgViewerQt, here's the output:

[preet@icarus osgviewerQt]$ ./osgViewerQt cessna.osg
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has
not been called
[xcb] Aborting, sorry about that.
osgViewerQt: xcb_io.c:178: dequeue_pending_request: Assertion
`!xcb_xlib_unknown_req_in_deq' failed.
Aborted

I'm using libxcb-1.8-2 with Qt 4.8 on Arch Linux (kernel v 3.2.5). The
Qt install should be fine as I can run other Qt applications without
any issues. I'd appreciate any advice...

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


Re: [osg-users] Drawing poly line, jitter/vibration issue when moving camera

2012-02-14 Thread Preet
Hey Robert,

Thanks for the detailed response. I had a few follow up questions.

On Tue, Feb 14, 2012 at 7:39 AM, Robert Osfield
robert.osfi...@gmail.com wrote:
 Hi Preet,

 Rui was a little cryptic is his explanation so I'll expand on it
 further.  What you are seeing is numerical precisions issues down on
 the graphics card as internally the graphics card uses floats for
 vertices and floats for the modelview matrix.

 The solution to this problem is make sure all geometry data has a
 local origin and use a transform node (such as an
 osg::MatrixTransform) that decorates your geometry and places it in
 world coordinates.

I didn't understand what was meant by local origin here. Let's say I
have a model of the Sphinx I want to show on the surface of the Earth
(coincidentally I'm trying to display geospatial data).

Are you suggesting that I draw the model with coordinates relative to
the origin of of the scene first ('local'), then parent the
corresponding geode with a matrix transform that scales/moves/rotates
it out to the correct position on the Earth's surface ('world
coordinates')?

I found a few references online to a somewhat similar solution that
suggested transforming the entire scene so it's centered at the origin
before passing it to OpenGL. Is this a worse or better approach than
the suggested fix?

 The OSG by default uses double's for the Camera's
 View matrix and double's for the transform nodes and when accumulating
 all the matrices during the cull traversal uses doubles as well so
 that by the time the OSG maintains precision all the way till it
 passes the modelview matrix to OpenGL.  Typically when you are close
 to your geometry the translation component of Camera's View matrix
 will cancel out with the translation component of your scene graph
 transform node, so that you end up with a final modelview passed to
 OpenGL with modest translation component that doesn't present any
 numerical precision issues, solving the precision.

I understand that numerical precision decreases when rendering a scene
further from the origin, because there are a finite set of numbers you
can represent in floating point. Using doubles for the transform and
carrying doubles throughout the scene graph traversals increases
precision right up until the data is passed to OpenGL. I didn't quite
follow your explanation about the camera and geometry translations
cancelling out though... could you expand on this a bit?

 This approach is commonly used when tackling whole earth geospatial
 data, and you'll see it in action in the paged databases that
 VirtualPlanetBuilder creates, 3rd party NodeKit's like osgEarth use
 this approach as well.

I'll take a look at the source for both of these projects, thanks :)

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


[osg-users] Drawing poly line, jitter/vibration issue when moving camera

2012-02-13 Thread Preet
Hiya,

I'm trying to draw a simple poly line from a vertex array with the
GL_LINE_STRIP primitive. When I view the object using osgviewer, it
looks like everything is alright. Once I move the camera around with
the mouse however, the lines begin to jitter, like the polyline was
made of jello (honestly can't find better description). The effect is
especially visible at higher zooms.

I'm using large (values in the hundred-millions), high precision
numbers (doubles) for the vertices of the line strip, and I think
that's what's causing the problem (I couldn't recreate the issue using
smaller, more sane numbers from 1-500 for example, even though the
same double datatype is used to store both numbers).

I've posted my code here: http://pastie.org/3377862
The code only relies on STL and osg, so it should 'just compile' if
you have an osg environment setup. The relevant calls to osg are on
lines 121-141. I'm using OSG 3.0.1 on Arch Linux, kernel 3.2.x if it's
relevant. Does anyone have any ideas as to what's going on?


Regards,

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


  1   2   >