[osg-users] Update camera and context after resize view in iOS

2012-09-29 Thread John Moore
Hi, I am developing an application in iOS using openscenegraph. I'd like to resize a viewer. Simply resizing the container view (which contains my osgViewController) resizes the viewer, but the model appears centered incorrectly and it is blurred and scaled up. Furthermore camera manipulator is

[osg-users] bumpmapping and tangentspacegenerator, generating tangents

2012-10-03 Thread John Moore
Dear OSG users, I am trying to develop bump mapping using opengl es 2.0 and openscenegraph. I can't use osgFX because of opengl es 2.0. I have to apply a bump map to an obj that has the map embedded in the MTL. The mtl is like this: newmtl Nuovo Kd 0.80 0.80 0.80 illum 2 Ns

Re: [osg-users] bumpmapping and tangentspacegenerator, generating tangents

2012-10-04 Thread John Moore
Ok, Let's say that I want to read an OBJ file and assign the BUMP texture to 0 and the DIFFUSE texture to 1 Am I doing right with these lines of code for the options? osg::ref_ptrosgDB::ReaderWriter::Options options = new osgDB::ReaderWriter::Options; options-setOptionString(DIFFUSE=1

[osg-users] how to get number of vertices and faces

2012-10-07 Thread John Moore
Hi guys, I have a scene graph with only a node containing an OBJ file. Do you know hot can I get the number of vertices and faces of the OBJ model? Actually I am using osg::Stats osg::Stats* stats = _viewer-getCamera()-getStats(); I get the attribute map... const osg::Stats::AttributeMap

Re: [osg-users] how to get number of vertices and faces

2012-10-08 Thread John Moore
Dear Robert, Actually I can't use the S key because my application is running on iOS. Is there any way to compute these value using a node visitor? actually for knowing the vertices I tried using this line of code inside my nodevisitor totalNumOfVertices +=

[osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-07 Thread John Moore
Hello, I am trying to compile the OSG sample application for Android, the one that works with OpenGL ES 2.0. I followed this guide doing some minor modification for OpenGL ES 2.0: http://forum.openscenegraph.org/viewtopic.php?t=10076 I built openscenegraph with no errors with 3rd party

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-08 Thread John Moore
Hi Adun (), I have done as you said. There was no libgnustl_static.a in the $(OSG_ANDROID_DIR)/obj/local/armeabi-v7a folder, so I copied it from ANDROID_NDK folder. Specifically I copied it from $ANDROID_NDK/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a folder The build-ndk now seems ok,

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-09 Thread John Moore
Osg in Android is not emulator-friendly... and the EGL libraries seem from emulator instead of a proper device. Ok, I tried with a Samsung Galaxy S3 Mini (which has the same gpu of Samsung Galaxy S3) but the app is still crashing. :( This is the log: Code: 07-08 18:12:30.278:

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-09 Thread John Moore
Jorge Izquierdo Ciges wrote: The message its pretty clear: couldn't load osgNativeLib: findLibrary returned null Probably the library has not been copied. This usually happens when compiling armeabi-v7 and the device doesn't support it.It is also possible that the apk was generated

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-10 Thread John Moore
Jordi Torres wrote: Hi, This bug is fixed in recent versions. So try the svn trunk. Cheers El 09/07/2013 18:16, John Moore () escribió: Jorge Izquierdo Ciges wrote: The message its pretty clear: couldn't load osgNativeLib: findLibrary returned null Probably

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-11 Thread John Moore
opinion? Thank you again, John Jorge Izquierdo Ciges wrote: Osg in Android is not emulator-friendly... and the EGL libraries seem from emulator instead of a proper device. 2013/7/8 John Moore () Hi Adun (), I have done as you said. There was no libgnustl_static.a

Re: [osg-users] Android osgAndroidExampleGLES2 compiler errors

2013-07-12 Thread John Moore
Thank you Raphael, it's working! :) I didn't think about pressing the menu button. LOL Thank you again. Have a nice day :) John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55204#55204 ___

[osg-users] Drawing lines using OpenGL ES 2.0

2013-11-03 Thread John Moore
Hi, I am using OpenSceneGraph on iOS, using OpenGL ES 2.0. I am having hard time to figure out how to draw polygon lines using shaders. I'd like to draw a simple box with lines. However I can't find a way because osg::PolygonMode::LINE does not work. In fact

Re: [osg-users] Drawing lines using OpenGL ES 2.0

2013-11-04 Thread John Moore
I found a solution which involves computing the barycentric coordinates. However it seems that is not working properly. To compute the barycentric coordinates I need to associate to the vertices of the triangles a coordinate among (1,0,0) (0,1,0) (0,0,1) for doing that I use the following

Re: [osg-users] Drawing lines using OpenGL ES 2.0

2013-11-07 Thread John Moore
Actually I solved it... one of the problems was that the number I was using for the attribute was too big (or reserved). I am forced to use OpenGL ES 2.0 because I develop on iOS platform! Thank you anyway for your advice. Cheers, John This is the working code Code: #define

Re: [osg-users] Drawing lines using OpenGL ES 2.0

2013-11-07 Thread John Moore
I want to add that this is the fragment shader I used for drawing the wireframe model Code: precision highp float; varying vec3 vBC; #extension GL_OES_standard_derivatives : enable float edgeFactor(){ vec3 d = fwidth(vBC); vec3 a3 = smoothstep(vec3(0.0), d*1.0, vBC); return

[osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
Hi, In my app I am using 2 textures of size 4096x2048. I have a serious problem of memory usage. Code: osg::ref_ptrosg::Texture2D texture = new osg::Texture2D; texture-setDataVariance(osg::Object::STATIC); texture-setFilter(osg::Texture::MIN_FILTER,

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
memory once the texture gets to the GPU:    texture-setUnRefImageDataAfterApply(true); Glenn Waldron / @glennwaldron On Tue, Nov 19, 2013 at 8:11 AM, John Moore () wrote: Hi, In my app I am using 2 textures of size 4096x2048. I have a serious problem of memory usage

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
? Quick math: 2 * 4096 * 2048 * 4 * 1.3 = 87MB. (4 = RGBA, 1.3 = mipmaps) Glenn Waldron / @glennwaldron On Tue, Nov 19, 2013 at 9:18 AM, John Moore () wrote: Thank you Gwaldron, that line of code saved me 40MB. Better than nothing. Now the memory usage is around 110

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
(http://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_Format_Comparison) Glenn Waldron / @glennwaldron On Tue, Nov 19, 2013 at 9:51 AM, John Moore () wrote: Memory usage is for the entire app. However memory usage of the same scene if I don’t load the texture is 20 MB

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
), so you get 4:1 compression in the app, not just on disk. No experience with PVR; is it Apple only? Glenn Waldron / @glennwaldron On Tue, Nov 19, 2013 at 10:25 AM, John Moore () wrote: I am not very concerned about disk usage. I am more concerned about RAM. Will be there any

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2013-11-19 Thread John Moore
, not just on disk. No experience with PVR; is it Apple only? Glenn Waldron / @glennwaldron On Tue, Nov 19, 2013 at 10:25 AM, John Moore () wrote: I am not very concerned about disk usage. I am more concerned about RAM. Will be there any advantages using this kind of compression

[osg-users] Multisample makes app crash for memory pressure after 5/6 consecutive changes of orientation in iOS devices

2014-03-25 Thread John Moore
Hi, I am experiencing a strange problem in my iOS app using OpenSceneGraph. I use this code to create a graphics context Code: - (osg::ref_ptrosg::GraphicsContext)createGraphicContext { //create our graphics context directly so we can pass our own window

Re: [osg-users] Set Viewport background color as transparent

2014-03-28 Thread John Moore
Hi Vishwa, today when I was updating my OSG I just realized that I was using a modified version of GraphicsWindowIOS... that's why transparency was working with that code. You can achieve the same result with the original GraphicsWindowIOS by calling this code before setting the traits:

Re: [osg-users] Optimizing memory usage by Texture of size 4096x2048

2014-04-01 Thread John Moore
Sorry I missed the answers because of my email settings. However they are still useful. Thank you very much. John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58768#58768 ___ osg-users mailing

[osg-users] OpenGL ES 2.0 and LIGHTING

2012-06-12 Thread John Moore
Hi, I am developing an application for iPhone and iPod touch using OpenSceneGraph. In origin I written my own shaders and I used to control light using a uniform. It was working. Now I wanted to switch to use osg::Light and osg::LightSource because I think it is more object-oriented, but when

[osg-users] Improving performance of OBJ rendering by back face culling

2012-06-12 Thread John Moore
Hello, I am developing an application for iphone and ipod touch using openscenegraph. It is an augmented reality application and I have to load a very complex model. The original 3d model has 5 million vertices. Since I am using a mobile platform which is limited in computational power I

[osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
Hi, I am trying to write a shader to do bump mapping using OSG and OpenGL ES 2.0 in a mobile platform (iOS). My 3d models are saved as OBJs. The bump map is embedded in the .MTL and declared in lines of the type: Code: newmtl brick2 Kd 0.80 0.80 0.80 illum 2 Ns 50.781250 map_Kd

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
I just realized that I didn't linked the attributes tangent and binormals. How can I compute them. I have stored in my OBJ only the information about normals. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49189#49189

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
Hi Sergey, I am looking to TangentSpaceGenerator and I need to pass a Geometry to the generate method. However I have a osg::Node data structure because I load data using obj reader. Code: _oggettoObj = osgDB::readNodeFile(provaBump/objconbump.obj); then I create a tangent space with

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
In this way it's using another shader that I did not write by myself and this shader is giving errors. Code: State::convertShaderSourceToOsgBuiltIns() ++Before Converted source void main() { gl_Position = ftransform(); gl_TexCoord[0] = gl_MultiTexCoord0; gl_FrontColor = gl_Color; }

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
ok, I understand... but is there anyway to have a Geometry object from a osg::Node? I am trying with this lines of code but I have no success because no geode is found is printed. Code: osg::Geode *geode = dynamic_castosg::Geode*(_oggettoObj.get()); if (geode) {

Re: [osg-users] Bump mapping with embedded maps in OBJs and OpenGL ES 2.0 programmable pipeline

2012-08-07 Thread John Moore
in osg::Program). Cheers. 07.08.2012, 19:20, John Moore : In this way it's using another shader that I did not write by myself and this shader is giving errors. Code: State::convertShaderSourceToOsgBuiltIns() ++Before Converted source void main() {   gl_Position