Re: [osg-users] Mipmapping for downsampling

2012-09-27 Thread Sebastian Messerschmidt

Okay, one last try:

1. Have you tried showing the last mip-level (i.e. avg. lum) in a 
separate window so you can check the value?
2. Have you double checked your actual tone-mapping? (say by providing 
the average luminance via uniform)?


I'm asking this rather silly questions, because last time I looked for 
an error I simply assumed the error to be in a step where indeed it was 
not ;-)



cheers
Sebastian

Thank you Sebastian for your support. I appreciate it.



More or less. I don't know the exact wording from the specification, but
the mipmapping should actually do a bilinear interpolation for 4
neighbouring texels per mip level. I've found many examples that used
the last LOD for average lum.


This is what I expecting from the mipmapping to implement my tone mapping 
algorithm.



That looks okay. I suppose you are using FrameBuffer Objects and this
the setup code for the texture.

Exactly, I'm using FBO to render-to-texture.


Code:
mainCamera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT, 
osg::Camera::PIXEL_BUFFER_RTT);






Have you simply tried the 1000.0 (it is clamped to the last level)?

Yes I've tried it. But still the issue.



Can you maybe provide a screenshot of your artifacts?

Actually a screenshot will not help you as there is no really artifact. 
Basically the screen is flashing. Some particularly views give a brighter image 
as no tone mapping was disable. At this moment if I move just a bit the image 
come back darker as expected from my tone mapping. It's little bit weird... I'm 
wondering if it is actually the mipmapping or if it is conflicting with an 
other stuff.

Thanks a lot,
Kenzo

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





___
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] FBO and mipmaps

2012-09-27 Thread Sergey Polischuk
Hi

in camera interfaces there are attach method which have parameter to specify 
either to generate mipmaps or not for texture rendertarget attachmant, it does 
not behave correctly?

Cheers,
Sergey.

27.09.2012, 01:55, Kenzo Lespagnol kenzo.lespag...@cm-labs.com:
 Hi Aurelien,

 I'm also using FBO and mipmaps and I would like to know if you're solved your 
 problem. I'm assuming FBO doesn't generate mipmap automatically as described 
 is this document http://www.songho.ca/opengl/gl_fbo.html.

 So I created a drawcallback to my render-to-texture geometry and add this 
 code:

 Code:
 struct DrawCallback : public osg::Drawable::DrawCallback
 {
 DrawCallback(osg::Texture* texture)
 : osg::Drawable::DrawCallback()
 , _texture(texture)
 {}

 ~DrawCallback()
 {}

 void drawImplementation(osg::RenderInfo ri,const osg::Drawable* dr) const
 {
 dr-drawImplementation(ri);

 osg::FBOExtensions* fbo_ext = 
 osg::FBOExtensions::instance(ri.getContextID(),true);
 ri.getState()-setActiveTextureUnit(0);
 ri.getState()-applyTextureAttribute(0, _texture.get());
 fbo_ext-glGenerateMipmapEXT(_texture-getTextureTarget());
 }
 osg::ref_ptrosg::Texture _texture;
 };

 I'm not sure about the final result as I've still some bugs. So I'm very 
 interesting by your solution.

 Regards,
 Kenzo

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

 ___
 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, macosx-x86_64 imageio plugin color byte swap problem

2012-09-27 Thread Thomas Hogarth
Hi Guys

Sorry to raise this again, but I'm currently having the same issue. Basically I 
am opening files, doing some bits and bobs to them and reexporting. Just for 
completeness I do alter the texture stateattributes, but not in a way I would 
think would matter. Here's what I'm doing


Code:
if(_localiseImagePaths){
std::string fileName = 
osgDB::getSimpleFileName(texture-getImage(0)-getFileName());
std::string localPath = images/+fileName;
texture-getImage(0)-setFileName(localPath);
}

//disable resize of textures
texture-setResizeNonPowerOfTwoHint(false);

//clamp to edge required for IPhone NPOT support
texture-setWrap(osg::Texture::WRAP_S, 
osg::Texture::CLAMP_TO_EDGE);
texture-setWrap(osg::Texture::WRAP_T, 
osg::Texture::CLAMP_TO_EDGE);




Then when done I export with the following options to make sure the files are 
written as external files for whatever format I'm using.


Code:
osg::ref_ptrosgDB::Options opts = new osgDB::Options();
opts-setOptionString(OutputTextureFiles noTexturesInIVEFile 
WriteImageHint=WriteOut);



But when I look at the exported images, or load the exported model file the 
image red and blue components seem to be flipped.

I've had a little dig and did start to think it was because some of my images 
don't have alpha channels, but I've tested images with alpha channels with no 
luck.

I've attached a model that will produce the problem when loaded and reexported 
with the above options (on my end at least)

I'm using osg version 3.1.3 and running on OSX 10.7.4, with OSX sdk 10.8, XCode 
4.5. I've also tried both 32 and 64 bit builds with no luck.

Any help would be greatly appreciated.

Cheers
Tom

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




Attachments: 
http://forum.openscenegraph.org//files/boxmanmodel_190.zip


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


Re: [osg-users] osg, macosx-x86_64 imageio plugin color byte swap problem

2012-09-27 Thread Thomas Hogarth
Oops

Sorry, the last attached file had a bad png that the plugin can't load. I 
copied over it with a backup after the colors got swapped and forgot to run it 
through gimp which seems to sort it.

Also I just tested embedding the image into the osgb file, which worked fine.

Thanks
Tom

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




Attachments: 
http://forum.openscenegraph.org//files/boxmanmodel2_102.zip


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


[osg-users] Warning: detected OpenGL error 'invalid enumerant' at After Renderer::compile

2012-09-27 Thread Nav Joseph
On viewing a map.ive file (which I converted from .dem to .ive using 
osgdem.exe) with osgviewer, the map is being shown with its elevations, but is 
completely white. I can't see the raster map which is supposed to be draped on 
it. This is in Linux (osg built with the latest git clone).

On windows, when I use osgviewer to view the same map.ive, I see it with its 
elevations and the raster map draped on it.

The error I see in RHEL when I close the viewer is Warning: detected OpenGL 
error 'invalid enumerant' at After Renderer::compile. The cow.osg file is 
rendering perfectly fine with all reflections visible on the cow. I haven't yet 
installed the graphics drivers for my NVidia card, so the framerate is low, but 
I don't see why the raster doesn't render when the cow does.

On typing glxinfo, I get this:

 name of display: :0.0
 display: :0  screen: 0
 direct rendering: Yes
 server glx vendor string: SGI
 server glx version string: 1.4
 client glx vendor string: Mesa Project and SGI
 client glx version string: 1.4
 GLX version: 1.4
 OpenGL vendor string: Mesa Project
 OpenGL renderer string: Software Rasterizer
 OpenGL version string: 2.1 Mesa 7.11
 OpenGL shading language version string: 1.20

(deleted a lot of the blah blah that got printed with the glxinfo command)

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





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


[osg-users] Warning: detected OpenGL error 'invalid enumerant' at After Renderer::compile

2012-09-27 Thread Nav Joseph
On viewing a map.ive file (which I converted from .dem to .ive using 
osgdem.exe) with osgviewer, the map is being shown with its elevations, but is 
completely white. I can't see the raster map which is supposed to be draped on 
it. This is in Linux (osg built with the latest git clone).

On windows, when I use osgviewer to view the same map.ive, I see it with its 
elevations and the raster map draped on it.

The error I see in RHEL when I close the viewer is Warning: detected OpenGL 
error 'invalid enumerant' at After Renderer::compile. The cow.osg file is 
rendering perfectly fine with all reflections visible on the cow. I haven't yet 
installed the graphics drivers for my NVidia card, so the framerate is low, but 
I don't see why the raster doesn't render when the cow does.

On typing glxinfo, I get this:

 name of display: :0.0
 display: :0  screen: 0
 direct rendering: Yes
 server glx vendor string: SGI
 server glx version string: 1.4
 client glx vendor string: Mesa Project and SGI
 client glx version string: 1.4
 GLX version: 1.4
 OpenGL vendor string: Mesa Project
 OpenGL renderer string: Software Rasterizer
 OpenGL version string: 2.1 Mesa 7.11
 OpenGL shading language version string: 1.20

(deleted a lot of the blah blah that got printed with the glxinfo command)

Help? How can I get the raster portion of the map to get displayed?

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





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


Re: [osg-users] Polytope - Intersections sorted by distance of localIntersectionPoint and the reference plane

2012-09-27 Thread Ron Mayer
Hi again,

After thinking about it here is what I think the answer is.
Let's say our polytope intersects two circles (or rectangles) A and B, each at 
two points
A1, A2 and
B1, B2

The center point of A1 and A2 is computed, denote by centerA12
The center point of B1 and B2 is computed, denote by centerB12

Then the distance is measured from centerA12, and centerB12 to the reference 
plane. By default the reference plane is the last plane in teh polytope - 
meaning, if the polytope is made out of 5 half-planes, the last one is the 
default reference plane (the last one, as the last one in the data structure 
the half-planes are stored).

The polytope intersector then stores the nodes sorted by the distance as 
described above.

Still need to understand what happens if one of the circles is completely 
inside the polytope, what is the order of such an object in the sorting scheme. 

Also, another question I was asking myself, was about duplicate reporting.
Let's say I have a parent and a child node both at the same location.
When the polytope intersector intersects both, are they reported as 2 different 
intersections (each having their own path, which is the same except of one 
node)? (I would say yes)

Cheers,
Ron

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





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


Re: [osg-users] Warning: detected OpenGL error 'invalid enumerant' at After Renderer::compile

2012-09-27 Thread Chris Hanson
Update your gfx driver and see what happens.

Perhaps you map file is built using an OGL feature your current driver
doesn't support. Maybe NPOT textures or something?


-- 
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


Re: [osg-users] Qt crashes on key press

2012-09-27 Thread Magnus Kessler
On Wednesday 26 Sep 2012 11:33:44 Max Sergeev wrote:
 Allright, I think I've got another, more global question: is there a way to
 make OSG ignore all keypresses, all keyboard events? Just like this, so it
 would not react on S, W or even Escape keypresses

You can stop a Viewer from exiting on Escape by calling

viewer.setKeyEventSetsDone(0);

on it.

The osgvnc example is using this, for instance. See the ViewerBase 
documentation for more information about this.

HTH,

Magnus


 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=50309#50309
 
 
 
 
 
 ___
 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, macosx-x86_64 imageio plugin color byte swap problem

2012-09-27 Thread Thomas Hogarth
Hi Again

So I've done some more digging and seems I'm hitting a case they may be known 
to not work. 

So in the function CreateCGImageFromOSGData under the case for GL_BGRA I am 
entering the else of the if statement.

if(GL_UNSIGNED_INT_8_8_8_8_REV == osg_image.getDataType()).

In there is this with the following code and comment

// FIXME: Don't know how to handle this case
bitmap_info = kCGImageAlphaPremultipliedLast;

What's weird is all my images seem to take this path even if I think they are 
pure rgb images.

I've found this function vImagePermuteChannels_ARGB, which I think can help 
me out, I just need to decide when to do it, to not break everyone else's 
functionality.

Cheers
Tom

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





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


Re: [osg-users] FBO and mipmaps

2012-09-27 Thread Kenzo Lespagnol
Hi Sergey,

When I attach a texture to the camera should I specify also the number of 
desired mipmap levels?


Code:
slaveCameraLogAveragedLum-attach(osg::Camera::COLOR_BUFFER0, 
logAveragedLumTexture.get(), numMipMap, 0, /*mipmap*/true);



In the documentation it is said 

 The level parameter controls the mip map level of the texture that is attached


Am I understanding correctly this parameter?


 Hi 
 
 in camera interfaces there are attach method which have parameter to specify 
 either to generate mipmaps or not for texture rendertarget attachmant, it 
 does not behave correctly? 
 
 Cheers, 
 Sergey.  
 


Thank you!

Cheers,
Kenzo[/code]

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





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


[osg-users] Bug in Qt thread integration

2012-09-27 Thread Chris Long
Hi,

We have a large app that uses Qt for its 2D UI and OSG for 3D rendering and UI. 
So it seemed like a good idea to turn on the Qt-OpenThreads integration by 
enabling BUILD_OPENTHREADS_WITH_QT.

However, I discovered that OpenThreads::Thread::CurrentThread() (in 
src/OpenThreads/qt/QtThread.cpp) does:


Code:
QtThreadPrivateData* pd = 
static_castQtThreadPrivateData*(QThread::currentThread());


 
If this is called when the current thread is a QThread that's not an 
OpenThreads Thread, the cast isn't valid and Bad Things(TM) will happen.

This happens in our application (and when we're lucky we get a seg fault).

We can disable BUILD_OPENTHREADS_WITH_QT without significant problem, but I 
wanted to report the bug and suggest that the documentation be changed to tell 
people not to enable this until it's fixed.

BTW, we are using Qt 4.8.1 on RHEL5, but it looks like this problem could occur 
on any platform.

Thank you!

Cheers,
Chris

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





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


Re: [osg-users] FBO and mipmaps

2012-09-27 Thread Sergey Polischuk
Hi

This parameter allows you to directly attach specified mipmap level of texture 
to fbo.
If you just need to render to texture and let it generate mipmaps you should 
attach level 0.
You can set desired number of generated mipmap levels by 
logAveragedLumTexture-setNumMipmapLevels(numLevels). 

Cheers,
Sergey.

27.09.2012, 19:51, Kenzo Lespagnol kenzo.lespag...@cm-labs.com:
 Hi Sergey,

 When I attach a texture to the camera should I specify also the number of 
 desired mipmap levels?

 Code:
 slaveCameraLogAveragedLum-attach(osg::Camera::COLOR_BUFFER0, 
 logAveragedLumTexture.get(), numMipMap, 0, /*mipmap*/true);

 In the documentation it is said

  The level parameter controls the mip map level of the texture that is 
 attached

 Am I understanding correctly this parameter?

  Hi

  in camera interfaces there are attach method which have parameter to 
 specify either to generate mipmaps or not for texture rendertarget 
 attachmant, it does not behave correctly?

  Cheers,
  Sergey.

 Thank you!

 Cheers,
 Kenzo[/code]

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

 ___
 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] Bug in Qt thread integration

2012-09-27 Thread Aurelien Albert
Hi,

I'm surprised that QThread::currentThread() can return something else than a 
QThread instance.

But if this is really the case, the following should solve the issue :


Code:
QThread* pQThread = dynamic_cast QThread* (QThread::currentThread());
if (pQThread != NULL)
{
   QtThreadPrivateData* pd = static_cast QtThreadPrivateData (pQThread);
}




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





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


Re: [osg-users] How to ignore keyboard events

2012-09-27 Thread Max Sergeev

Magnus Kessler wrote:
 On Wednesday 26 Sep 2012 11:33:44 Max Sergeev wrote:
 You can stop a Viewer from exiting on Escape by calling
 
 viewer.setKeyEventSetsDone(0);
 
 on it.
 
 The osgvnc example is using this, for instance. See the ViewerBase 
 documentation for more information about this.
 


Thanks for the answer, it does block the Escape key I suppose, but still didnt 
solve my problem: qt controls on click of Escape key still change their 
positions and become unclickable. I thought there could be some more global 
way, like blocking the key events for whole application -- like they just are 
not clicked.
Will do check the example and documentation you suggested, thanks.

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





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