[osg-users] osg win32 deubg
3 正在创建库 E:\osg\OpenSceneGraph-3.0.1\build\lib\osgUtild.lib 和对象 E:\osg\OpenSceneGraph-3.0.1\build\lib\osgUtild.exp 3正在嵌入清单... 3Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 3Copyright (C) Microsoft Corporation. All rights reserved. 3LINK : fatal error LNK1000: Internal error during IncrBuildImage 3 Version 9.00.21022.08 3 ExceptionCode= C005 3 ExceptionFlags = 3 ExceptionAddress = 00DEFCF7 (00D7) D:\Program Files\Microsoft Visual Studio 9.0\VC\bin\link.exe 3 NumberParameters = 0002 3 ExceptionInformation[ 0] = 3 ExceptionInformation[ 1] = 0014D670 3CONTEXT: 3 Eax= 40C590EC Esp= 0025EEE4 3 Ebx= 4000817C Ebp= 0025EF0C 3 Ecx= 0014D670 Esi= 40C58F58 3 Edx= 0025EEFC Edi= 00D7D6C0 3 Eip= 00DEFCF7 EFlags = 00010246 3 SegCs = 001B SegDs = 0023 3 SegSs = 0023 SegEs = 0023 3 SegFs = 003B SegGs = 3 Dr0= Dr3= 3 Dr1= Dr6= 3 Dr2= Dr7= 3生成日志保存在“file://e:\osg\OpenSceneGraph-3.0.1\build\src\osgUtil\osgUtil.dir\Debug\BuildLog.htm” 3osgUtil - 1 个错误,29 个警告___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewer::GraphicsWindowCocoa::WindowData dynamic_cast returns 0
Hi Sean, I had similar problems in the past as you and Chuck. My fix was to make sure the project-settings for osg and my own project where the same and set to FALSE: Symbols hidden by default (GCC_SYMBOLS_PRIVATE_EXTERN): FALSE and eventually Inline hidden methods (GCC_INLINES_ARE_PRIVATE_EXTERN): FALSE Cheers, Stephan Am 27.01.12 18:11, schrieb Sean Sullivan: Hey guys, I'm trying to pass an osgViewer::GraphicsWindowCocoa::WindowData to my traits object with CreateOnlyView specified. For some reason whenever my WindowData is dynamic_cast in GraphicsWindowCocoa.mm it just returns 0. If I switch them to static_cast they work. Here's my code: Code: // OSGWindow.h osgViewer::GraphicsWindowCocoa::WindowData* windowData; // OSGWindow.cpp windowData = new osgViewer::GraphicsWindowCocoa::WindowData (osgViewer::GraphicsWindowCocoa::WindowData::CreateOnlyView); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits(); traits-x = 100; traits-y = 100; traits-width = 1280; traits-height = 720; traits-red = 8; traits-blue = 8; traits-green = 8; traits-alpha = 8; traits-depth = 24; traits-windowDecoration = false; traits-doubleBuffer = true; traits-vsync = false; traits-stencil = 1; traits-samples = 8; traits-sampleBuffers = 1; traits-inheritedWindowData = windowData; osg::ref_ptrosg::GraphicsContext context = osg::GraphicsContext::createGraphicsContext (traits.get()); This is what's in GraphicsWindowCocoa.mm that returns 0: Code: GraphicsWindowCocoa::WindowData* windowData = traits-inheritedWindowData ? dynamic_castGraphicsWindowCocoa::WindowData*(traits-inheritedWindowData.get()) : NULL; I tried expanding it into if statements and the traits-inheritedWindowData returns true. I also tried copying and pasting this line into my file where I create my traits object and it returns properly. Any ideas? Cheers, Sean -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45082#45082 ___ 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] Need help fixing my atmospheric transmission shader, it's so close to working!
Hi this piece completely eliminate any green and blue values of original color, if you trees dont have red color component they will look black. color.r = color.r * exp( -1.0 * ExtinctionCoefficient * eyeDistance ); color.g = color.r; color.b = color.r; Sampling texture when it not currently bound iirc should return (0,0,0,1), here you get your black color (also this could cause crash on some drivers). 27.01.2012, 23:19, Ethan Fahy ethanf...@gmail.com: My scene contains virtualplanetbuilder-generated terrain that has a texture wrapped on it along with surface objects such as trees that I generated by creating osg primitives and coloring them PER_VERTEX without using any textures. I have written an atmospheric transmission shader that decreases the r,g and b values as a function of distance from the viewer to the object. However, I can't seem to get the shader to work properly on both the terrain and trees at the same time. Here is the code: Vertex Shader: Code: varying float eyeDistance; void main(void) { gl_TexCoord[0] = gl_MultiTexCoord0; gl_FrontColor = gl_Color; eyeDistance = length(gl_ModelViewMatrix * gl_Vertex); gl_Position = ftransform(); } Fragment Shader: Code: uniform float ExtinctionCoefficient; uniform sampler2D baseTexture; varying float eyeDistance; void main(void) { vec4 color = texture2D(baseTexture, gl_TexCoord[0].st); color.r = color.r * exp( -1.0 * ExtinctionCoefficient * eyeDistance ); color.g = color.r; color.b = color.r; gl_FragColor = color; } The above shader pair will successfully make the terrain darker in color as I zoom out, but the trees all look completely black no matter what, even if they originally had varying colors without the shader. If instead of setting color in the frag shader to texture2D() I instead set it equal to gl_Color, the shader then works on all the objects in the scene but I no longer see any remnants of the underlying terrain texture. Based on this page http://stackoverflow.com/questions/2552676/change-the-color-of-a-vertex-in-a-vertex-shader I would have expected that setting color = texture2D(baseTexture, gl_TexCoord[0].st) * gl_Color would have produced the result I was looking for, but instead the result is identical to if I leave out * gl_Color. I think my shader code is very close to being correct and just needs a nudge in the right direction. Anyone? Thanks very much in advance. -Ethan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45086#45086 ___ 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] osg win32 deubg
deubg?笑掉大牙了! ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Memory leak when resizing
Hello, I've just discovered a very strange behavior. In my setup ( Windows7 64bit, osg3.0.1rc1, Nvidia Quadro 2000M, 285.62) i've found that my memory consumption raised with every resize of the viewer window. After doing some research I didn't find anything in my program, so I tried the same thing with the osgviewer application. For sake of simplicity I started the osgviewer with no other parameters but dumptruck.osg. Same thing here, every resize event raised the amount of application used memory by about 4Mb. Can someone try this with a similar setup? cheers Sebastian ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transparency on osg::Cone
Using osg third party libraries, I have added a cone to my application in the specified color. However, I have not been able to get the cone to be anything other than opaque. Is this possible or am I doing something wrong? Code: static osg::Cone* cone = NULL; float height = 1000.0; // for now double coneHeading = 0.0; // for now, pointing North double angle = 90.0; // for now, parallel to ground double radius = height * tan(osg::DegreesToRadians(22.5 / 2.0)); // the center of the cone, by default is the center of mass (1/4 from center of base to apex) cone = new osg::Cone(osg::Vec3(0.0f, 0.0f, 0.0f), radius, height); // adjust the center to be at the apex according to the angle of rotation osg::Quat quaternion( osg::DegreesToRadians(angle), osg::Vec3(1, 0, 0), // rotate so parallel to ground +/- some osg::DegreesToRadians(0.0), osg::Vec3(0, 1, 0), osg::DegreesToRadians(-coneHeading), osg::Vec3(0, 0, 1)); // rotate so pointing North osg::Vec3 center = quaternion * osg::Vec3(0.0f, 0.0f, -(height * 0.75f)); cone-setCenter(center); cone-setRotation(quaternion); osg::Geode* geode = new osg::Geode; osg::ShapeDrawable* drawable = new osg::ShapeDrawable(cone); drawable-setColor(osg::Vec4f(1.0, 0.0, 0.0, 0.2)); geode-addDrawable(drawable); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45098#45098 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transparence/Geometry issues with PAT
Hey all of you, I have a problem with the coloring of my objects (osg::Geometry). When I resize any of them (using PositionAttitudeTransform) and the scaling factor is 1 the opacity of the respective geometry nodes is scaled accordingly. So *my question* is: How can I protect the transparence/opacity of a geometry against scaling? (some further questions below) Little description of what I'm doing: I have lots of similar objects to represent graphs and for each type of object (node, edge) I create a prototype to copy from. This is an osg::Geometry with TriangleStrips and TriangleFans. I keep it in memory as osg::ref_ptrosg::Geometry When building the structure I create a geometry for each object and copy (member by member) all the PrimitiveSets, Vertices, etc. as well as the ColorArray and color-binding (which is BIND_OVERALL) from the prototype to the new clone (- 2nd question). I then insert this geometry into a osg::Geode node (-3rd question), which I add to a osg::PositionAttitudeTransform node (to scale, move and rotate) and finally to the respective osg::Group. Optionally I insert a osg::LOD to get higher performance. I'm also not using the osg::ShapeDrawables but my own objects for said performance (I got up to 10^5 objects to display atm, but very possibly even more to come) Right now I'm hiding the scaled transparence by creating the prototypes about the size the objects will be at the end, but they all will have different sizes so there's still a difference in opacity. *2nd question*: How can I more easily create a osg::ref_ptrosg::Geometry copied from another osg::ref_ptrosg::Geometry (cloning all the PrimitiveSets, vertices, normals, colors, states and so on) *3rd question*: Can I add a geometry more directly to a PAT than Geometry-Geode-PAT? *4th question*: Does anybody have any further suggestions to improve my osg structures, mainly in means of performance? -- Hartmut Leister hartmut.leis...@s2005.tu-chemnitz.de Hofer Straße 58a, 04317 Leipzig 0175/8491877 http://www-user.tu-chemnitz.de/~harl -- E-Mails richtig schreiben: http://www-user.tu-chemnitz.de/~harl/email_nettiquette.php http://www-user.tu-chemnitz.de/~harl/gpg.php ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transparency on osg::Cone
Hi, You'll need to add two things to the geode or drawable's state set: - An osg::BlendFunc with the proper arguments for the blend you want - Calling setRenderingHint() with osg::StateSet::TRANSPARENT_BIN so it's in the proper render bin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45101#45101 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transparency on osg::Cone
Thank you so much. I got it transparent, as you suggested, with the following code that I added to the end. Code: osg::StateSet* set = geode-getOrCreateStateSet(); set-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); set-setAttributeAndModes(new osg::BlendFunc(GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA), osg::StateAttribute::ON); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45103#45103 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org