Re: [osg-users] VPB: creating flat earth DB with specified projection
Perhaps not the best solution, but you could reproject your terrain data with gdaltranslate, before using osgdem. Regards. -- A. On Tue, Oct 13, 2009 at 8:26 AM, John Vidar Larring larr...@weatherone.tv wrote: Hi all, I'd like to create a flat VPB terrain with a specified projection and I a having some trouble. I'm hoping someone else have already done this and can share some insight. osgdem -t bm_east.tif -l 3 -o qwe.ive ... creates a flat earth in latlong projection. But when I try to specify a coordinate system for the destination database like the following: osgdem -t bm_east.tif -l 3 --cs +proj=stere +lat_ts=60 +lat_0=90 +lon_0=10 -o qwe.ive ...osgdem output the following a creates a database that does not show in osgviewer: % osgdem -t bm_east.tif -l 3 --cs +proj=stere +lat_ts=60 +lat_0=90 +lon_0=10 -o qwe.ive -t bm_east.tif --cs +proj=stere converted to PROJCS[unnamed,GEOGCS[WGS 84,DATUM[unknown,SPHEROID[WGS84,6378137,298.257223563]],PRIMEM[Greenwich,0],UNIT[degree,0.0174532925199433]],PROJECTION[Stereographic],PARAMETER[latitude_of_origin,0],PARAMETER[central_meridian,0],PARAMETER[scale_factor,1],PARAMETER[false_easting,0],PARAMETER[false_northing,0]] -o qwe.ive Adding terrainTile DataSet::_run() 0 0 started DataSet::createDestination(3) AR=2.013294 C1=1 R1=2 createNewDestinationGraph Time for _destinationGraph-computeMaximumSourceResolution() = 0.58 Time for createDestinationGraph 0.000616 Time for after_computeNeighbours 0.43 Time for consolodateRequiredResolutions 0.00 reprojecting to file temporaryfile_bm_east.tif ERROR 1: CPLCreateThread() failed in ChunkAndWarpMulti() Note !! Time for after_reproject 48.371744 Time for after_sort 0.18 completed DataSet::createDestination(3) There are 1 contributing source files: bm_east.tif ... ...[snip]... ... vpb::access(qwe_root_L0_X0_Y0/qwe_L1_X0_Y1_subtile.ive, W_OK)=0 completed DataSet::writeDestination(qwe.ive) Elapsed time = 49.149146 Is this a usage issue, a bug or not-implemented-yet issue? My initial attempts of creating a flat projected database were based on this documentation from osgdem --help: --cs coordinates system string Set the coordinates system of source imagery, DEM or destination database. The string may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPS Best regards, John -- This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.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] osg::AnimationPathCallback Volocity
Hi, Is there any way to use Velocity while moving object by ControlPoint and time? Thank you! Cheers, Danny -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18363#18363 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] how to improve frame rate of my scene with lots of cubes and cylinders?
Hi, Thanks Peter for your very helpful reply. I have sorted that issue thank to your pointers. Now I have only one more question then I promise I won't bother you anymore. It seems that when I generate my model using the simple geometries I created and using VertexShader, the resulting cube, for example, has a very flat uniform colour, where it is impossible to distinguish the various faces. This does not happen when using the shapeDrawable cube or cylinder and so on. Would any of you mind pointing me in the right direction of how to resolve this? Thank you! Cheers, Maurizio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18364#18364 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Can't assign more than 7 texture matrices
Hi, i have a small problem. I want to access gl_TextureMatrix[8] within my Shader. As you can see i used a loop to setup 10 texture matrices: Code: for (int i = 0; i 10; i++) { stateSet-setTextureAttributeAndModes(i, texMat, osg::StateAttribute::ON); } But when i try to access gl_TextureMatrix[8] not the matrix i was hoping. I checked some build in limits for example: GL_MAX_TEXTURE_UNITS is 34018. Just change the used gl_TextureMatrix[n] to n=8 to see that no texture matrix is returned. Code: #include osg/Group #include osg/Geode #include osgViewer/Viewer #include osgGA/TrackballManipulator #include osgViewer/CompositeViewer #include osg/ShapeDrawable #include osg/Node #include osg/MatrixTransform #include osg/TexMat #include osgViewer/Viewer #include osg/Texture2DArray #include osgDB/ReadFile #include string #include stdio.h #include iostream using namespace osg; osg::TexMat* texMat = new osg::TexMat; osgViewer::View* viewB = new osgViewer::View; void applyShader(Geode* geode) { ref_ptrProgram program = new Program; program-setName(TexturesTest); ref_ptrShader vertObj = new Shader(Shader::VERTEX); ref_ptrShader fragObj = new Shader(Shader::FRAGMENT); program-addShader(vertObj.get()); program-addShader(fragObj.get()); ref_ptrStateSet stateSet = new osg::StateSet; ref_ptrUniform texturesUniform = new Uniform(Uniform::SAMPLER_2D_ARRAY, textures, 1); stateSet-addUniform(texturesUniform.get()); stateSet-setAttributeAndModes(program.get(), StateAttribute::ON); ref_ptrTexture2DArray textureArray = new Texture2DArray; //textureArray-setInternalFormat(GL_RGBA16F_ARB); //textureArray-setSourceFormat(GL_RGBA); //textureArray-setSourceType(GL_FLOAT); textureArray-setFilter(osg::Texture2DArray::MIN_FILTER, osg::Texture2DArray::NEAREST); textureArray-setFilter(osg::Texture2DArray::MAG_FILTER, osg::Texture2DArray::NEAREST); textureArray-setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_BORDER); textureArray-setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_BORDER); textureArray-setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_BORDER); textureArray-setTextureDepth(2); textureArray-setImage(0, osgDB::readImageFile(src/foo2.jpg)); textureArray-setImage(1, osgDB::readImageFile(src/foo2.jpg)); stateSet-setTextureAttribute(0, textureArray.get(), osg::StateAttribute::ON); for (int i = 0; i 10; i++) { stateSet-setTextureAttributeAndModes(i, texMat, osg::StateAttribute::ON); } std::string vertSource = varying vec4 vPos; void main() { vPos = gl_Vertex; gl_Position = ftransform(); }; vertObj-setShaderSource(vertSource); std::string fragSource = #version 120\n #extension GL_EXT_gpu_shader4 : enable\n #extension GL_EXT_texture_array : enable\n varying vec4 vPos; uniform sampler2DArray textures; void main() { vec4 coords = gl_TextureMatrix[7] * vPos; gl_FragColor = texture2DArray(textures, vec3(coords.st, 0)); }; fragObj-setShaderSource(fragSource); geode-setStateSet(stateSet.get()); } int main(int argc, char** argv) { // setNotifyLevel(osg::DEBUG_INFO); // Create a cube ref_ptrGroup rootNode = new Group; Box* cube = new Box(Vec3(0, 0, 0), 1.0f); ShapeDrawable* drawable = new ShapeDrawable(cube); Geode* geode = new Geode(); geode-addDrawable(drawable); rootNode-addChild(geode); // Apply our shader to this cube applyShader(geode); osg::ArgumentParser arguments(argc, argv); osgViewer::CompositeViewer viewer(arguments); viewer.addView(viewB); viewB-setUpViewInWindow(10, 650, 640, 480); viewB-setSceneData(rootNode.get()); viewB-setCameraManipulator(new osgGA::TrackballManipulator); while (!viewer.done()) { osg::Matrix mat = viewB-getCamera()-getViewMatrix() * viewB-getCamera()-getProjectionMatrix(); mat = mat * osg::Matrix::scale(0.5, 0.5, 1) * osg::Matrix::translate( 0.5, 0.5, 0); texMat-setMatrix(mat); viewer.frame(); } return 0; } Is there a buildin limit for texture matrices? Or am i doing something wrong about the setup of texture matrices? When iam using the 1-7 matrices everything works as expected but i need
Re: [osg-users] Can't assign more than 7 texture matrices
Seems to be another ati related issue. I was able to reproduce this issue with pure opengl. :-\ Any suggestions on how i can handover multiple texture matrices to my shader? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18366#18366 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Can't assign more than 7 texture matrices
Hi Johannes, It don't think this is an an error. There are only 8 texture coords and 8 tex matrices in fixed pipeline. If you want more simply use uniforms. Matrix array uniforms are available in OpenGL and OSG. Use setElement to sent n-th array. Cheers, Wojtek Lewandowski -- From: Johannes Schüth acco...@jotschi.de Sent: Sunday, October 18, 2009 11:12 PM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Can't assign more than 7 texture matrices Seems to be another ati related issue. I was able to reproduce this issue with pure opengl. :-\ Any suggestions on how i can handover multiple texture matrices to my shader? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18366#18366 ___ 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] Can't assign more than 7 texture matrices
I don't see the problem. Quoting from the GLSL 1.20 spec below, it looks to me like you're lucky you're even getting 2 matrices -- the minimum value for gl_MaxTextureCoords. You can't simply use a uniform? Paul Martz Skew Matrix Software LLC _http://www.skew-matrix.com_ http://www.skew-matrix.com/ +1 303 859 9466 7.4 Built-In Constants The following built-in constants are provided to vertex and fragment shaders. // // Implementation dependent constants. The example values below // are the minimum values allowed for these maximums. // const int gl_MaxLights = 8; // GL 1.0 const int gl_MaxClipPlanes = 6; // GL 1.0 const int gl_MaxTextureUnits = 2; // GL 1.3 const int gl_MaxTextureCoords = 2; // ARB_fragment_program const int gl_MaxVertexAttribs = 16; // ARB_vertex_shader const int gl_MaxVertexUniformComponents = 512; // ARB_vertex_shader const int gl_MaxVaryingFloats = 32; // ARB_vertex_shader const int gl_MaxVertexTextureImageUnits = 0; // ARB_vertex_shader const int gl_MaxCombinedTextureImageUnits = 2; // ARB_vertex_shader 49 7 Built-in Variables const int gl_MaxTextureImageUnits = 2; // ARB_fragment_shader const int gl_MaxFragmentUniformComponents = 64;// ARB_fragment_shader const int gl_MaxDrawBuffers = 1; // proposed ARB_draw_buffers 7.5 Built-In Uniform State As an aid to accessing OpenGL processing state, the following uniform variables are built into the OpenGL Shading Language. All page numbers and notations are references to the 1.4 specification. // // Matrix state. p. 31, 32, 37, 39, 40. // uniform mat4 gl_ModelViewMatrix; uniform mat4 gl_ProjectionMatrix; uniform mat4 gl_ModelViewProjectionMatrix; uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords]; ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] re-initialize OpenGL objects after window resize
I'm working on and OSG/SDL application. Resizing the window in Linux works fine, but resizing it in Windows causes the app to lose all its OpenGL objects. Is there a recommended way to re-initialize all OpenGL objects? So far I have been experimenting with SceneView's releaseAllGLObjects, flushAllDeletedGLObjects, and COMPILE_GLOBJECTS_AT_INIT. But this has mostly led to crashes and hasn't fixed the problem. Just thought I would take a break and see if anyone has any other suggestions -- Terry Welsh / mogumbo 'at' gmail.com www.reallyslick.com / www.mogumbo.com ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org