Re: [osg-users] Looking for big datasets to properly challenge OSG and VSG, Please help :-)

2019-04-05 Thread Andrea Martini
Hi Robert,
concerning your question about big dataset, at link : 

http://kos.informatik.uni-osnabrueck.de/3Dscans/

at bullet 25, there is a file  wue_city.tar.xz of about 5GB got by SLAM process.

This data set contains 6 3D laser scans. Each scan has up to 22,500,000 points.

I don't know what is the dataset size you are looking for, i supposed 5GB could 
be enough (i hope).

It is a ascii format, and it can be download freely.

Hope to be useful.

Cheers,
Andrea

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





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


Re: [osg-users] osgUtil::LineSegmentIntersector performance issues

2018-12-05 Thread Andrea Martini
Hi Chris Hanson,
thank you for your suggestion and your advanced solution.
However, the Robert Osfield's answer solved completely issues concerning my 
unclear question.
At the moment i find very hard to improve (using my equipment) performance 
beyond  0.01 ms.
Anyway, i will take in consideration your  useful suggenstions for next 
challenges.

Cheers,
Andrea

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





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


Re: [osg-users] osgUtil::LineSegmentIntersector performance issues

2018-12-05 Thread Andrea Martini
Hi Robert,
thank you for your suggestion.
After using of :  

osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::Options::BUILD_KDTREES);

and 

osgUtil::IntersectionVisitor iv(intersector.get());
iv.setUseKdTreeWhenAvailable(true);

intersector visitor performances are good again.

Now, the code:

subgraph->accept(iv);

requires (in the same scenes yesterday described) only 0.01 ms. 


Thank you 

Cheers,
Andrea

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





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


[osg-users] osgUtil::LineSegmentIntersector performance issues

2018-12-04 Thread Andrea Martini
Hello everyone,
i spent my last weeks to find a reasonable cause concerning 
osgUtil::LineSegmentIntersector on some osgt file.
In detail, i would like to identify objects in the scene, using line isector 
(ray casting) starting from a certain point with a ray of 3 meter length .
Following the code i used for detecting object in front of camera (i'm using 
osg 3.5.3 and Oculus Rift device)


Code:


osg::ref_ptr intersector = new 
osgUtil::LineSegmentIntersector(startPoint, endPoint);  

osgUtil::IntersectionVisitor iv(intersector.get());

//intersector->setIntersectionLimit(osgUtil::Intersector::LIMIT_NEAREST);
//intersector->setPrecisionHint(osgUtil::Intersector::PrecisionHint::USE_FLOAT_CALCULATIONS);

//for debugging: evaluation of visitor processing time
osg::Timer_t timer_tstart = mGlobalHighResTimer->tick();

iv.setTraversalMask(vrGame::INTERACTIVE);

subgraph->accept(iv);


//for debugging: evaluation of visitor processing time
osg::Timer_t timer_tend = mGlobalHighResTimer->tick();
double  timer_tfinal = mGlobalHighResTimer->delta_m(timer_tstart, timer_tend);
std::cout << " Collision Visitor Time Computed :  " << 
std::to_string(timer_tfinal) << std::endl;






This code works correctly in terms of dected object but some times i noticed 
low performance when camera points in a space region near the object but not on 
its geometry. I mean, if camera points the geometry of the object, performance 
is ok. When camera points near the object (on an empty region) but not on its 
geometry, performance drop down.

Some numbers: When camera points on empty area near the object, Oculus passes 
from 90Hz to 45Hz framerate and the computation of 

subgraph->accept(iv);

requires from 2.8 to 4 milliseconds for each frame. 
I also investigated on osgUtil::IntersectionVisitor class, and it seems that 
(in my specific situation), 

IntersectionVisitor::apply(osg::Transform& transform) 

needs from 2.8 to 4 ms computation time when processes the following code lines:

 // now push an new intersector clone transform to the new local oordinates
push_clone();
traverse(transform);
// pop the clone.
pop_clone();



Another doubt is related to why, even if i set 

iv.setTraversalMask(0x0001001)

for avoiding to process nodes which have that mask (and the investigated object 
has this mask), visitor continues to process at each frame something that 
requires a lot computation time.

The object comes from blender (osgt export), and has One group as root, a 
MatrixTransform as child, a Geode as child and 3 drawables with 64K vertices on 
the whole. The osgt file has 18 Mbytes size


My question is: Is there some solution I might adopt to improve these 
performances? Can you give me some suggestions?


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Enable Qt5Widgets_DIR into cmake (GUI)

2018-09-05 Thread Andrea Martini
Hello Konstatine,
thank you for your suggestion.
Now CMAKE fills all Qt entries automatically.

But, osgQtWidgets and osgQtBrowser aren't in .sln
Looking into mypath\OpenSceneGraph-3.5.3\examples\CMakeLists.txt i found:

...
 IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND )
ADD_SUBDIRECTORY(osgQtWidgets)
ADD_SUBDIRECTORY(osgQtBrowser)
ENDIF()
...

Infact, CMAKE (GUI)  fill Qt5WebKitWidgets_DIR with 
Qt5WebKitWidgets_DIR-NOTFOUND. I searched in 
C:\Qt\Qt5.8.0\5.8\msvc2013_64\lib\cmake  and folder Qt5WebKitWidgets is absent. 
 

This is the reason i can't find osgQtWidgets and osgQtBrowser projects in the 
solution.

I will try with a suggestion on :
https://stackoverflow.com/questions/49249355/could-not-find-qt5webkitwidgets

using qt 5.5 instead of 5.8


Thank you!

Cheers,
Andrea

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





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


[osg-users] Enable Qt5Widgets_DIR into cmake (GUI)

2018-09-05 Thread Andrea Martini
Dear all,
i would like to enable Qt5 form Cmake(GUI) 3.8.2 using OSG 3.5.3 on Windows10. 
I installed QT 5.8.0 in c:\QT\... and i set environment variable QTDIR to 
C:\Qt\Qt5.8.0\5.8\msvc2013_64

My focus consits in get osgQtBrowser and osgQtWidgets example projects in osg 
solutions (visual studio 2013).

What i get is:

Ungrouped Entries-> Qt5Widgets_DIR =  Qt5Widgets_DIR-NOTFOUND

Furthermore, several QT -> items are automatically filled with NOFOUND (after 
Configure process). I must manually fill each items!!!

Is there a way to tell CMAKE to fill all qt entries automatically?

Thank you in advance

Regards

Andrea



... 

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] osgmovie - ffmpeg or Gstreamer

2018-06-26 Thread Andrea Martini
Hi Filippe,
after some hours of disperate fighting against gstreamer pipeline, here the 
pipeline that works for play video and audio (mp4) in a correct way:


Code:
gchar *string = g_strdup_printf("filesrc location=%s ! qtdemux name=demux 
demux.video_0 ! queue ! video/x-h264 ! avdec_h264 ! videoconvert ! 
video/x-raw,format=RGB ! appsink name=sink emit-signals=true  demux.audio_0 ! 
queue! faad ! audioconvert ! audioresample ! autoaudiosink  ", 
filename.c_str());



I don't know if it is the right way, but it works for me. I modified 
GStreamerImageStream.cpp  , GStreamerImageStream::open  method.

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] osgmovie - ffmpeg or Gstreamer

2018-06-26 Thread Andrea Martini
Hi Filippe,
another detail  i forgot to write in the previous post.
After OSGMOVIE execution, OSGDB::ReaderWriter  returns  FILE_NOT_HANDLED


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] osgmovie - ffmpeg or Gstreamer

2018-06-26 Thread Andrea Martini
Hi Filippe,
thank you for your reply.
Well, i tried front slash string for osgMovie parameters:

C:/SVILUPPO/CommonData/Movie/surf360converted.ogg  --texture2D  --interactive 
--audio

but  _width and _height attribute in GStreamerImageStream::open method, 
continue to be equal to zero, and so this method returns false.

After that, i tried to call the same pipeline dynamically created in the open 
method, with gst_launch-1.0:

gst-launch-1.0.exe filesrc 
location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin 
name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! 
appsink name=sink emit-signals=true

I get the following console message:

C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe filesrc 
location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin 
name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! 
appsink name=sink emit-signals=true
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

and nothing happens. Then i substitued appsink name=sink  with autovideosink,  
but in this case i get the following error message:

C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0.exe filesrc 
location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin 
name=deco deco. ! queue ! videoconvert ! video/x-raw,format=RGB ! 
autovideosink emit-signals=true

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:deco: Delayed linking 
failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): 
/GstPipeline:pipeline0/GstDecodeBin:deco:
failed delayed linking some pad of GstDecodeBin named deco to some pad of 
GstQueue named queue0
ERROR: from element 
/GstPipeline:pipeline0/GstDecodeBin:deco/GstOggDemux:oggdemux0: Internal data 
stream error.
Additional debug info:
gstoggdemux.c(4936): gst_ogg_demux_loop (): 
/GstPipeline:pipeline0/GstDecodeBin:deco/GstOggDemux:oggdemux0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ..

And last, i removed   video/x-raw,format=RGB   getting the following command 
line:

gst-launch-1.0.exe filesrc 
location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! decodebin 
name=deco deco. ! queue ! videoconvert ! autovideosink emit-signals=true


In this case video starts correctly.

So, i tried to change the pipeline in GStreamerImageStream::open with the 
following:

filesrc location=C:/SVILUPPO/CommonData/Movie/surf360converted.ogg ! 
decodebin name=deco deco. ! queue ! videoconvert ! appsink name=sink 
emit-signals=true
 
But, i continue to get _width and _height equal to zero, and the open method 
returns false and no video play.



Cheers,
Andrea

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





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


[osg-users] osgmovie - ffmpeg or Gstreamer

2018-06-22 Thread Andrea Martini
Dear All,
i would like to share with you some issues concerning play video streaming 
(with audio) starting from osgmovie.
I already used ffmpeg plugin with sdl2, but i get different results with the 
same application (osgmovie) and the same video (.mp4 extension) on different 
PCs:  
- HP Z440 with geforce gtx 1080
- Alianware (laptop) with 2 graphic board (nvidia geforce gtx 1080 and an 
internal intel board)

On HP, i play video correctly. On laptop video is playing faster.

Is it depends on video board configurations? 
Is there some parameters i can configure on osg:iamgestreamer class or 
FFmpegImageStream, in order to force frame rate to a specific value? 

Furthermore, i'm looking for another plugin to use with openscenegraph (i'm 
using openscenegraph 3.5.3 on windows 10) as alternative of ffmpeg. I see that 
cmake accepts gstreamer, so i downloaded gstreamer development 1.0. Cmake works 
correctly, but no change appears on solution sln. I don't know how to proceed 
to use gstreamer with osgmovie to test some video and audio streaming. Is there 
any example about?

Thank you in advance

Kind regards

Andrea






... 

Thank you!

Cheers,
Andrea

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





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


[osg-users] How to recover osg::ImageStream from Invalid Status

2018-06-19 Thread Andrea Martini
Dear all,
i'm using osg::Imagestream with ffmpeg to play an .mp4 video
Sometimes happens that imagestream switch to Invalid status and a freeze image 
appears. In this status image stream doesn't receive any command (play, rewind).
Is there a way to recover to PLAYING or PAUSE Status? 


Thank you!

Cheers,
Andrea

PS: I'm using osg 3.5.3 on windows 10

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





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


Re: [osg-users] OsgMovie ffmpeg and audio (SDL2) - Audio seems to make video slower. Audio has hiccoughing

2018-06-12 Thread Andrea Martini
Hi Lauren,
GREAT!!! It's works!
Using the 3.0 version of ffmepg, i can play both video and audio correctly.
Thank you a lot!

Cheers,
Andrea

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





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


[osg-users] OsgMovie ffmpeg and audio (SDL2) - Audio seems to make video slower. Audio has hiccoughing

2018-06-11 Thread Andrea Martini
Hi everyone,
i'm using osg3.5.6 on visual studio 2013 (windows 10), and i'm using ffmpeg  
plugin combined with SDL2 to play video and audio streaming with osgmovie 
example.
If i don't use SDL2 (no audio), video streaming works fine. 
If i add SDL2 (audio), i get two bad results:
1) video stream get slower
2) Audio has hiccoughing

I tryied with some video examples (with different resolutions) but i get the 
same result.

Following, i report audio streaming output displayed on the console:

ffmpeg::open(C:\Movie\surfers_360.mp4) size(2048, 1024) aspect ratio 1
Attaching FFmpegAudioStream
AudioStream read []
FFmpegAudioStream::setAudioSink( 0277C50FEEE0)
Assigning 0277C50FEEE0
image->s()2048 image-t()=1024 aspectRatio=1
SDLAudioSink()::startPlaying()
  audioFrequency()=48000
  audioNbChannels()=2
  audioSampleFormat()=4
  SampleFormat  = SAMPLE_FORMAT_F32

I'm wondering if i should continue with ffmpeg and sdl libraries, or i have to 
look at another one. In this last case, could you suggest me some way to 
follow? (link, examples, ...)

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] load a osg model with rigged animation (exported by 3dsmax)

2017-11-24 Thread Andrea Martini
Hi to all,
it seems that the problem is caused by 3DSmax exporter (both fbx and osgt). I 
used the blender exporter (fbx) and i was able to load animation.

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] load a osg model with rigged animation (exported by 3dsmax)

2017-11-24 Thread Andrea Martini
Hi Raymond,
unfortunally also with fbx file, animationManager used in osganimationhardware 
is null.
About step : 3DSMax→Blender→osgexport
both with 3ds and fbx to blender, model appears very different from the 
original (mesh and controllers).
Does exist other test that i should try?
Thank you


Andrea

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





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


Re: [osg-users] How to load an osg::Image into a qtwidget like Label

2015-10-15 Thread Andrea Martini
Hi,

I found a solution :


Code:
const uchar *qImageBuffer = (const uchar*)myOsgImage->data();

 QImage img(qImageBuffer, myOsgImage->s(), myOsgImage->t(), 

  myOsgImage->getRowSizeInBytes(), 

  QImage::Format_RGB888);

QPixmap pixmapObject;
pixmapObject.fromImage(img);

labelSelectedImage->setPixmap(QPixmap::fromImage(img)); // labelSelectedImage 
is a qt widget



It works, but i continue to get some problem with textures which contain alpha 
channel.



Thank you!

Cheers,
Andrea

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





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


[osg-users] How to load an osg::Image into a qtwidget like Label

2015-10-14 Thread Andrea Martini
Hi,
I'm going to create a function which can investigate on each image inside a 3D 
model.
I created a texture visitor which has a list of images belong to 3D model.
Now i would like to view each single image inside a qt widget (for example 
inside a Label).
Is there a way to do that?
I used the osg image->data() to get unsigned char*, but as i don't know the 
image type (inside the 3d model), i can't assign this image to the qt widget.
Could you give me some suggestions?
I found in this forum the inverse solution : how to copy Qimage to osg::image. 
;(
Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] left/right alternating stereo

2015-01-19 Thread Andrea Martini
Hi,
i have the same problem 
I have a system where graphic board (nvidia K5000) must be setted to 60Hz, and 
a projector able to go to 120Hz (between graphic card and projector there are 2 
devices that work only to 60 Hz).
To visualize stereo 3D, this system uses a player like butterfly3D (or BINO, 
http://bino3d.org/doc/bino.html#Overview-1). It loads a syde-by-syde left-right 
movie (60 Hz) and sends an alternating left-right (60Hz) to projector. The 
projector (Vivitek D5380U), receives a 60Hz input signal and visualizes a type 
of stereo (like quad buffer) at 120Hz. It seems to duplicates the frequency. 
Using Bino, stereo works (quite correctly).
I would like to visualize OSG application in stereo mode (using the same 
approach), on this system.
My question is :
If i use quadbuffer stereo forcing frequency to 60 Hz, do i get the same 
result? This becouse i have no side by side source. So i suppose that with a 
slow quad buffer, i can simulate the alternating output to projector.
Is it possible to force quadbuffer to 60Hz?
On a common workstation with nvidia quadro 600, using a 60Hz monitor and use 
quadbuffer stereo, i see the alternating frames slower than on 120 Hz monitor. 
This is the reason for forcing the quadbuffer to 60Hz.
I try to direct execute quadbuffer on the system with openscenegraph 
application, but i don't see the alternating images (i get also an error : 
detect OpenGL error 'invalid operation' at after RenderBin::draw(...).
I see a single image (like mono view).

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] ffmpeg plugin : play a video frame by frame

2014-02-27 Thread Andrea Martini
Hi to all,
i looked at osgmovie.cpp. I used seek method of imagstream, but i'm unable to 
visualize a specified frame (only the pecified frame).
Is it possibile to get this result with imagestream?

Thank you!

Cheers,
Andrea

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





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


[osg-users] ffmpeg plugin : play a video frame by frame

2014-02-12 Thread Andrea Martini
Hi everybody,
i'm wondering if is it possible to use ffmpeg plugin with OSG 3.0.1, to play a 
video frame by frame.
I compiled  osg 3.0.1 with ffmpeg plugin, and i run the osgmovie example with 
no problem. 
Now, what i'd like to do, is to play a video frame by frame : i would say to my 
application (using ffmpeg or other video plugin), to visualize a specific frame.
I read the seek method into osg::imagestream. So i wrote the following code:

// Note 1: mImagestream is the imagestream associated to video
// Note 2: framenum is the frame number to visualize 

double duration=mImagestream-getLength();
double frame_rate=mImagestream-getFrameRate();
...

double frameTime=1/frame_rate;
double t_pos =framenum*frameTime;

mImagestream-seek(t_pos);
mImagestream-play();
mImagestream-pause();

...

Nothing happens.
 
Are there some suggestions?

Thank you!

Cheers,
Andrea

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





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


[osg-users] [osgPlugins] ffmpeg plugin : play a video frame by frame

2014-02-12 Thread Andrea Martini
Hi everybody, 
i'm wondering if is it possible to use ffmpeg plugin with OSG 3.0.1, to play a 
video frame by frame. 
I compiled osg 3.0.1 with ffmpeg plugin, and i run the osgmovie example with no 
problem. 
Now, what i'd like to do, is to play a video frame by frame : i would say to my 
application (using ffmpeg or other video plugin), to visualize a specific 
frame. 
I read the seek method into osg::imagestream. So i wrote the following code: 

// Note 1: mImagestream is the imagestream associated to video 
// Note 2: framenum is the frame number to visualize 

double duration=mImagestream-getLength(); 
double frame_rate=mImagestream-getFrameRate(); 
... 

double frameTime=1/frame_rate; 
double t_pos =framenum*frameTime; 

mImagestream-seek(t_pos); 
mImagestream-play(); 
mImagestream-pause(); 

... 

Nothing happens. 

Are there some suggestions? 

Thank you! 

Cheers, 
Andrea

PS: I erroneously  posted this topic on general forum too ... sorry!

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





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


Re: [osg-users] [osgPlugins] plugins dicom compiling error

2013-07-23 Thread Andrea Martini
Hi,

i solved the problem using the include file osconfig.h located in 
dcmtk-3.6.0\build_VS2008\include\dcmtk\config instead of 
dcmtk-3.6.0\include\dcmtk\config.
Moreover, the cmake file of dcmtk should be modified,  using  /MD instead of 
/MT   click here  (http://forum.openscenegraph.org/viewtopic.php?t=8570)


Thank you!

Cheers,
Andrea

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





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


[osg-users] [osgPlugins] plugins dicom compiling error

2013-07-08 Thread Andrea Martini
Hi to all,

after  dicom plugin compiling, i get this error :

..\DCMTK\dcmtk-3.6.0\ofstd\include\dcmtk/ofstd/ofstream.h(80) : fatal error 
C1189: #error :  DCMTK needs stringstream or strstream type

(i get this error both in debug and release configuration)

if i remove from project include dir : ..\DCMTK\dcmtk-3.6.0\ofstd\include
i get the following error:

..\dcmtk-3.6.0\dcmdata\include\dcmtk/dcmdata/dcsequen.h(35)

fatal error C1083: Impossible to open include file  'dcmtk/ofstd/offile.h': No 
such file or directory.



I'm using osg 3.0.1, visual studio 2008, dcmtk 3.6.0 on window XP (32 bit). 
I've compiled dcmtk3.6.0 with vs 2008, and i get no errors. 

Can you suggest me any solution?
 

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Multipass rendering with shader

2013-04-24 Thread Andrea Martini
Hi Sebastian,

the reason to split the shader effect into two different shaders, is to create 
a software library ables to apply multiple effect (something like the 
superposition property) on the same 3D model (or on the total scene).
I'm going to investigate on, and i hope to get a good result.

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Multipass rendering with shader

2013-04-23 Thread Andrea Martini
Hi,

using your suggestion : 

texture2D(previousTexture, gl_FragCoord.xy/ vec2(1024.0,512.0))

i think to solve my doubts.

Pratically, what i would like to do is to use the color information coming from 
the first pass, to color the twisted mesh of the second pass (using two 
different and separate shaders).


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Multipass rendering with shader

2013-04-22 Thread Andrea Martini
Hi Sebastian,
tahnk you for your suggestions. I have taken some days to study your solutions 
and to apply them to my osg application. It seem that something is going on, 
but i still get some doubts and some errors.
In the following code, i simulate the use of two shader on the same 3D object 
(cessna.osg) using two PRE_RENDER camera : the first shader (test_Pass_0) 
change the object's color, the second shader (test_Pass_1) should apply a twist 
deformation on the same 3D Object.
Finally, i use the HUD camera to visualize the final effect ( a twisted and 
colored cessna).

So, briefly : 
I use the PRE_RENDER CAMERA (first Camera) to fill the frame buffer with a 
texture (first texture) coming from the first shader.
A second PRE_RENDER CAMERA (second Camera), applies on the same object a twist 
deformation (with the vertex shader) and this second camera uses the first 
texture to get the color for the second shader (fragment shader). The
second camera fills the FBO for the next camera (HUD camera).

My doubt is : Is this approach correct?

The error is : Warning: detected OpenGL error 'invalid value' at After 
Renderer::compile
I get this error after the test_Pass_1.frag. What i see is the cessna.osg 
twisted, but completely black (it seems that the test_pass_1.frag doesn't see
the correct sampler2D input (previousTexture) coming from the first shader 
(test_Pass_0.frag). (I report a snapshot about the this result).


First i report the osg code.

Code for HUD CAMERA : the image input means the result of the test_Pass_0 shader


Code:


// this code coming from openscenegraph 3 cookbook
osg::Camera* createHUDCamera( double left, double right, double bottom, double 
top )
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setReferenceFrame( osg::Transform::ABSOLUTE_RF );
camera-setClearMask( GL_DEPTH_BUFFER_BIT );
camera-setRenderOrder( osg::Camera::POST_RENDER );
camera-setAllowEventFocus( false );
camera-setProjectionMatrix( osg::Matrix::ortho2D(left, right, bottom, 
top) );
camera-getOrCreateStateSet()-setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );
return camera.release();
}

// this code coming from openscenegraph 3 cookbook
 osg::Geode* createScreenQuad( float width, float height, float scale )
{
osg::Geometry* geom = osg::createTexturedQuadGeometry(
osg::Vec3(), osg::Vec3(width,0.0f,0.0f), 
osg::Vec3(0.0f,height,0.0f),
0.0f, 0.0f, width*scale, height*scale );
osg::ref_ptrosg::Geode quad = new osg::Geode;
quad-addDrawable( geom );
   
int values = osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED;
quad-getOrCreateStateSet()-setAttribute(
new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, 
osg::PolygonMode::FILL), values );
quad-getOrCreateStateSet()-setMode( GL_LIGHTING, values );
return quad.release();
}


void ApplyHUDCamera(osg::Texture2D *image, osg::Group* root)
{
std::cout  APPLY HUD  std::endl;
{
osg::ref_ptrosg::Camera mHudCamera;
mHudCamera =  createHUDCamera(0.0, 1.0, 0.0, 1.0);
mHudCamera-addChild(  createScreenQuad(1.0f, 1.0f));
osg::ref_ptrosg::StateSet mStateset = 
mHudCamera-getOrCreateStateSet();
mStateset-setTextureAttributeAndModes( 0, image );
root-addChild(mHudCamera.get());
}
return;
}




The following code, applies the first shader effect : simply, change object's 
color


Code:

osg::Texture2D* SingleTexturePass(osg::Group* root,osg::Node* 
viewnode,osg::Vec4 clearColor, int windowWidth, int windowHeight)
{
std::cout  FIRST PASS  std::endl;

osg::ref_ptrosg::Texture2D firstTexture = new osg::Texture2D;
firstTexture-setTextureSize(windowWidth, windowHeight);
firstTexture-setInternalFormat(GL_RGBA);
firstTexture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
firstTexture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);

firstTexture-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);

firstTexture-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
//firstTexture-setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));

// set up the render to color texture camera.
{
   osg::ref_ptrosg::Camera firstCamera = new osg::Camera;
   firstCamera-setName(FirstCamera);
   // firstCamera-setClearColor(clearColor);
   firstCamera-setViewport(0,0,windowWidth,windowHeight);
   //firstCamera-setClearStencil(0);
   //firstCamera-setClearDepth(0.0);
   //firstCamera-setClearAccum(osg::Vec4(1.0,1.0,1.0,1.0));
   //firstCamera-setClearMask(GL_COLOR_BUFFER_BIT); // | 
GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
   //firstCamera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
   //firstCamera-setCullingMode(osg::Camera::VIEW_FRUSTUM_SIDES_CULLING);
   //colorCamera-setViewport(the_viewport.get());
   

Re: [osg-users] Multipass rendering with shader

2013-04-22 Thread Andrea Martini
Hi Sebastian,
the first pass works well. I have tested it using the test_pass_0 (vertex and 
fragment) and the HUD camera. (The result in the attached picture).
I'm going to prepare a minimal compileable example.

Thank you!

Cheers,
Andrea

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



attachment: Multipass_first_pass_Colored.jpg___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Multipass rendering with shader

2013-04-22 Thread Andrea Martini
Hi Sebastian,
here you can find a minimal compileable example :



Code:

#include osg/Program
#include osgDB/ReadFile
#include osgViewer/Viewer
#include osgDB/FileUtils
#include osg/io_utils
#include osg/Texture2D
#include osg/Group
#include osg/Matrix
#include osg/MatrixTransform
#include osg/PolygonMode
 
//
// Vertex shader pass 0 : Color
//
 char vertexShaderSourcePass_0[] = 
   varying vec4 COLOR;\n
   \n
   varying vec2 texcoord;\n
   \n
   void main(void)\n
   {\n
   COLOR = gl_Color;\n
   gl_Position = ftransform();\n
   }\n;

//
// fragment shader pass 0 : Color
//
char fragmentShaderSourcePass_0[] = 
varying vec4 COLOR; \n
\n
void main(void) \n
{\n
vec4 newcolor = COLOR;\n
COLOR.r = newcolor.b/2;\n
COLOR.g = newcolor.r/3;\n
COLOR.b = newcolor.g + 0.1;\n
gl_FragColor =  COLOR; \n
}\n;

//
// Vertex shader pass 1 : TWIST
//
 char vertexShaderSourcePass_1[] = 
   uniform float time;\n
   uniform float height;\n
   uniform float angle_deg_max;\n
   \n
   varying vec2 texture_coordinate;\n
   varying vec4  normal, lightDir[3], eyeVec;\n
   \n
   vec4 DoTwist( vec4 pos, float t )\n
   {\n
   float st = sin(t);\n
   float ct = cos(t);\n
   vec4 new_pos;\n
   \n
   new_pos.x = pos.x*ct - pos.z*st;\n
   new_pos.z = pos.x*st + pos.z*ct;\n
   new_pos.y = pos.y;\n
   new_pos.w = pos.w;\n
   return( new_pos );\n
   }\n
   
void main()\n
   { \n
 float angle_deg = angle_deg_max*sin(time);\n
 float angle_rad = angle_deg * 3.14159 / 180.0;\n
 float ang = (height*0.5 + gl_Vertex.y)/height * angle_rad;\n
vec4 twistedPosition = DoTwist(gl_Vertex, ang);\n
// vec4 twistedNormal = DoTwist(vec4(gl_Normal, ang);\n
gl_Position = gl_ModelViewProjectionMatrix * twistedPosition;\n
vec3 vVertex = vec3(gl_ModelViewMatrix * twistedPosition);\n
// lightDir[0] = vec3(gl_LightSource[0].position.xyz - vVertex);\n
// lightDir[1] = vec3(gl_LightSource[1].position.xyz - vVertex);\n
// lightDir[2] = vec3(gl_LightSource[2].position.xyz - vVertex);\n
// eyeVec = -vVertex;\n
 // normal = gl_NormalMatrix * twistedNormal.xyz;\n
 //gl_TexCoord[0] = gl_MultiTexCoord0;\n
  texture_coordinate = vec2(gl_MultiTexCoord0);\n
//gl_Position = ftransform();\n
   }\n;

//
// fragment shader pass 1 : TWIST
//
char fragmentShaderSourcePass_1[] = 
uniform sampler2D previousTexture; \n
varying vec2 texture_coordinate;\n
\n
void main(void) \n
{\n
  vec4 somecolor = texture2D(previousTexture, 
gl_TexCoord[0].xy);\n
  gl_FragColor = somecolor; \n
}\n;

/*!
* \fn  osg::Camera* createHUDCamera( double left, double right, double bottom, 
double top )
* \brief Create an HUD Camera (as Post Render). Contains the result of the 
shader multiple pass
*  this code coming from openscenegraph 3 cookbook 
*/
osg::Camera* createHUDCamera( double left, double right, double bottom, double 
top )
{
osg::ref_ptrosg::Camera camera = new osg::Camera;
camera-setReferenceFrame( osg::Transform::ABSOLUTE_RF );
camera-setClearMask( GL_DEPTH_BUFFER_BIT );
camera-setRenderOrder( osg::Camera::POST_RENDER );
camera-setAllowEventFocus( false );
camera-setProjectionMatrix( osg::Matrix::ortho2D(left, right, bottom, 
top) );
camera-getOrCreateStateSet()-setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );
return camera.release();
}

/*!
* \fn  osg::Geode* createScreenQuad( float width, float height, float 
scale=1.0f)
* \brief Create screen Quad for the HUD Camera 
* this code coming from openscenegraph 3 cookbook 
*/
osg::Geode* createScreenQuad( float width, float height, float scale=1.0f)
{
osg::Geometry* geom = osg::createTexturedQuadGeometry(
osg::Vec3(), osg::Vec3(width,0.0f,0.0f), 
osg::Vec3(0.0f,height,0.0f),
0.0f, 0.0f, width*scale, height*scale );
osg::ref_ptrosg::Geode quad = new osg::Geode;
quad-addDrawable( geom );

int values = osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED;
quad-getOrCreateStateSet()-setAttribute(
new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, 
osg::PolygonMode::FILL), values );
quad-getOrCreateStateSet()-setMode( GL_LIGHTING, values );
 

[osg-users] Multipass rendering with shader

2013-04-10 Thread Andrea Martini
Hi,
i'm wondering if is it possible to apply different shaders (vertex and 
fragment) on the same osg::Node (not entire scene as RTT image) in this way : 
The result (ouput) of the first vertex/fragment shader must be used as input of 
the second vertex/fragment shader. In example, i have used a vertex and 
fragment to get refraction effect. But, unless i write the proper 
vertex/fragment code in this refraction shader, i loose lights setting coming 
from osg code. I would like to set lights using a shader (vertex/fragment) on 
the osg::Node already affected by refraction shader.
Is there any example that show how to get it?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Reflection cube map with shader

2013-03-27 Thread Andrea Martini
Hi hybr(),
thank you. Now it works!

I have to change something to update the reflected image on camera moving ... i 
have to check.
 

Thank you again.

Cheers,
Andrea

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





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


[osg-users] Problem with uniform array

2013-03-19 Thread Andrea Martini
Hi,
i have some problem using osg::Uniform as array to pass to my vertex shader.
I'm using osg 3.0.1 and visual studio 2008 (my video card has opengl 4.1 
drivers)

Here my osg code :


Code:


...
program-addShader(vertexfilename);
program-addShader(fragmentfilename);
osg::StateSet* stateset=myModel-getOrCreateStateSet();
stateset-setAttributeAndModes(program);
stateset-addUniform(new osg::Uniform(Kd,osg::Vec3(1.0,0.5,0.5)));
stateset-addUniform(new osg::Uniform(Ks,osg::Vec3(0.5,0.2,0.2)));
stateset-addUniform(new osg::Uniform(Ks,osg::Vec3(0.2,0.1,0.1)));
stateset-addUniform(new osg::Uniform(Shininess,50.0f));
osg::Uniform* arrayIntensity=new 
osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,Intensity,2); 
arrayIntensity-setElement(0,osg::Vec3f(1.0,1.0,1.0));
arrayIntensity-setElement(1,osg::Vec3f(1.0,0.5,1.0));




Here my vertex code :


Code:


uniform vec3 Intensity[2];

...

vec3 ads( int lightIndex, vec4 position, vec3 norm )
{
 vec3 s = normalize( vec3((lights[lightIndex].Position) - position));
 vec3 v = normalize(vec3(-position));
 vec3 r = reflect( -s, norm );
 vec3 I = vec3(Intensity[lightIndex]);  
 return (I * ( Ka + Kd * max( dot(s, norm), 0.0 ) + Ks * pow( max( dot(r,v), 
0.0 ), Shininess ) ));
}

...



I get no errors, but i get no results too. In detail, i'm trying to apply an 
ADS shader effects, but if i use the code above, i get a dark object. If i set 
statically the intenisty value in my vertex code, i see the expected 
visualisation result.

Could it depend on osg version?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Problem with uniform array

2013-03-19 Thread Andrea Martini
Hi Sebastian,
sure, i have forgotten to report the following code line in the previous 
message (but this code line is present in the osg code):

stateset-addUniform(arrayIntensity);

so the osg code is :



Code:

program-addShader(vertexShader);
program-addShader(fragShader);
osg::StateSet* stateset=myModel-getOrCreateStateSet();
stateset-setAttributeAndModes(program);
stateset-addUniform(new osg::Uniform(Kd,osg::Vec3(1.0,1.0,1.0)));
stateset-addUniform(new osg::Uniform(Ks,osg::Vec3(1.0,1.0,1.0)));
stateset-addUniform(new osg::Uniform(Ka,osg::Vec3(1.0,1.0,1.0)));
stateset-addUniform(new osg::Uniform(Shininess,50.0f));

osg::Uniform* arrayIntensity=new 
osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,Intensity,2); 
arrayIntensity-setElement(0,osg::Vec3f(1.0,1.0,1.0));
arrayIntensity-setElement(1,osg::Vec3f(1.0,0.5,1.0));
 

osg::Uniform* arrayPosition=new 
osg::Uniform(osg::Uniform::Type::FLOAT_VEC4,Position,2); 
arrayPosition-setElement(0,osg::Vec4(0.0,1.0,0.0,0.0));
arrayPosition-setElement(1,osg::Vec4(0.0,-1.0,0.0,0.0));

stateset-addUniform(arrayIntensity);
stateset-addUniform(arrayPosition);




 
I'm wondering if the problem could depend on osg version.

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Problem with uniform array

2013-03-19 Thread Andrea Martini
Hi hybr,

thank you for your suggestion.  With :

osg::Uniform* arrayIntensity=new 
osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,Intensity[0],2);

the osg application works correctly.

Thank you!

Cheers,
Andrea

PS: I have an nVidia _Quadro FX 4600.

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





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


[osg-users] attribute from osg to vertex

2013-03-01 Thread Andrea Martini
Hi,
i'm finding a lot of difficult to solve this issue: pass uniform and attribute 
parameters from osg application to shader.

In particular, referred to attribute (or in) parameter in vertex program :


Code:

#version 150
  
attribute vec3 Vertex;
attribute vec2 Uv;

uniform mat4 osg_ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 osg_ViewMatrixInverse;
uniform vec3 ModelScale;




How can i pass these data from my osg application?

Currently, in my osg applycation i use :

Code:

mProgram-addBindAttribLocation(Vertex,0);
mProgram-addBindAttribLocation(Uv,8);




Is it correct? 

I looked at an example on OpenSceneGraph 3 cookbook chapter 6,  Using the 
bump tecnique where to pass these attributes :

  
Code:
  
attribute vec3 tangent;
attribute vec3 binormal;




The authors (Rui Wang, Xuelei Qian) use a ComputeTangentVisitor nodevisitor 
class to compute tangent and binormal for each vertex:


Code:

class ComputeTangentVisitor : public osg::NodeVisitor
{
public:
void apply( osg::Node node ) { traverse(node); }

void apply( osg::Geode node )
{
for ( unsigned int i=0; inode.getNumDrawables(); ++i )
{
osg::Geometry* geom = 
dynamic_castosg::Geometry*( node.getDrawable(i) );
if ( geom ) generateTangentArray( geom ); 
//setGeometryVertexArray(geom);
}
traverse( node );
}

void generateTangentArray( osg::Geometry* geom )
{
osg::ref_ptrosgUtil::TangentSpaceGenerator tsg = new 
osgUtil::TangentSpaceGenerator;
tsg-generate( geom );
geom-setVertexAttribArray( 6, tsg-getTangentArray() );
geom-setVertexAttribBinding( 6, 
osg::Geometry::BIND_PER_VERTEX );
geom-setVertexAttribArray( 7, tsg-getBinormalArray() 
);
geom-setVertexAttribBinding( 7, 
osg::Geometry::BIND_PER_VERTEX );
}
};




and bind them with the following code :

Code:

ComputeTangentVisitor ctv;
ctv.setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN );
mModel-accept( ctv );
mProgram-addBindAttribLocation(tangent,6);
mProgram-addBindAttribLocation(binormal,7);




But, in my case vertex are already exist. So i suppose to use only :

mProgram-addBindAttribLocation(Vertex,0);



And what about the Uv parameter? The texture i have to pass to fragment, is a 
RTT Camera image, on which i would like to apply some effects.
How can i pass these texture coordinates to shader?

About the uniform parameters, is there a way to pass the ViewMatrix?

I used myCamera-getViewMatrix() in my osgapplication, and i set uniform to 
this value inside a callback:


Code:

osg::ref_ptrosg::Uniform viewUniformParam = new osg::Uniform(ViewMatrix, 
osg::Matrixf());
viewUniformParam-setUpdateCallback( new 
ViewMatrixCallback(mApplicationCamera.get()) );




with :

 
Code:

class ViewMatrixCallback : public osg::Uniform::Callback
   {
public:
ViewMatrixCallback(osg::Camera* appcamera): 
osg::Uniform::Callback()
{
mApplicationCamera=appcamera;
};

virtual void operator()( osg::Uniform* uniform, 
osg::NodeVisitor* nv )
{
osg::Matrix 
vmFromCamera=mApplicationCamera-getViewMatrix();
uniform-set( vmFromCamera );
}
   protected:
   osg::ref_ptrosg::Camera mApplicationCamera;
};




But i get no results.

Could you give me some suggestions?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] How to pass ModelMatrix to vertex using osg::Uniform

2013-02-25 Thread Andrea Martini
Hi all,

thank you for your suggestions. 

the original vertex code is :

depthField.vert
-

attribute vec3 Vertex;

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ModelMatrix;
uniform vec3 ModelScale;

varying vec4 vPosition;


void main ()
{
vPosition = ViewMatrix * ModelMatrix * vec4(Vertex * ModelScale, 1.0);
gl_Position = ProjectionMatrix * vPosition;
}

 end vertex code

I substitute the uniform variables with the following :

attribute vec3 Vertex;

uniform mat4 osg_ProjectionMatrix; 
uniform mat4 osg_ViewMatrix;
uniform mat4 osg_ViewMatrixInverse;  
uniform vec3 ModelScale;

varying vec4 vPosition;


void main ()
{
mat4 ModelMatrix=osg_ViewMatrixInverse * gl_ModelViewMatrix;   
vPosition = osg_ViewMatrix * ModelMatrix * vec4(Vertex * ModelScale, 1.0);
gl_Position = osg_ProjectionMatrix * vPosition;
}

and in my osg application, i  used :

gc-getState()-setUseModelViewAndProjectionUniforms(true);

I didn't get the aspected result.
Do i change also the Vertex attribute and use osg_Vertex?

Where i can find all the osg built-in variables?


Thank you in advance.


Cheers,
Andrea

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





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


[osg-users] How to pass ModelMatrix to vertex using osg::Uniform

2013-02-22 Thread Andrea Martini
Hi to all,
i'm trying to visualize the depth field effect in my osg application, using 
shader (vertex and fragment) from this link 
http://devmaster.net/posts/3021/shader-effects-depth-of-field

The vertex program, requires as uniform the following :

uniform mat4 ProjectionMatrix;
uniform mat4 ViewMatrix;
uniform mat4 ModelMatrix;
uniform vec3 ModelScale;

So, in my osg application, i suppose to pass :

myProgram-addShader(mVertexShader.get());
myProgram-addShader(mFragShader.get());

mStateset = mMyModel3D-getOrCreateStateSet();
mStateset-setTextureAttributeAndModes(new osg::Uniform( ProjectionMatrix, 
myCamera-getProjectionMatrix() ));

mStateset-setTextureAttributeAndModes( new osg::Uniform(ViewMatrix, 
myCamera-getViewMatrix() ));



mStateset-setAttributeAndModes(mProgram.get());

...

Does it correct?

How can i pass also mat4 ModelMatrix and vec3 ModelScale?

mStateset-addUniform( new osg::Uniform(ModelMatrix,??? ) );

mStateset-addUniform( new osg::Uniform(ModelScale, 
myMatrixTransformObject-getMatrix().getScale() ) );  // ???


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] How to Keep model color aven if shaders are applied

2013-01-30 Thread Andrea Martini
Hi Robert,

thank you for your replay. I'm going to check how to reproduce the same 
materials and colors on 3d model with shaders.

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] How to Keep model color aven if shaders are applied

2013-01-30 Thread Andrea Martini
Hi Glenn,
thank you for your suggestions. Can i do the same thing also with materials?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] How to Keep model color aven if shaders are applied

2013-01-30 Thread Andrea Martini
Hi all,

thank for your suggestions. Now 3d model keeps its color and material also 
afeter shader applying.


thank again

Cheers,
Andrea

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





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


Re: [osg-users] 3D Modeler for OpenScenegraph

2012-06-26 Thread Andrea Martini
Hello Jean-Sébastien,
thank you for your suggestion. I will look on 3DS MAX  Blender.
I hope to find a plugin that allows me a complete scene control.

Thank you!

Cheers,
Andrea

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





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


[osg-users] 3D Modeler for OpenScenegraph

2012-06-25 Thread Andrea Martini
Hi,
so far, to display a 3D model with a hierarchy of nodes already included in the 
model (such as DOF, SWITCH, LOD, ...), I used Multigen Creator, with models in 
flt format. There is the possibility of having a 3D model (not Multigen 
creator) that contains this hierarchy? For example, if you want to model a 
mechanical arm with Multigen, you can put DOF nodes in place of the elbow and 
the wrist. Then, in OSG, you can read these nodes and move mecchanical arm and 
wrist. There is another 3D modeling software (no Multigen Creator) that allows 
me to read such information from the model,  without which software I should 
have to manually insert a DOF node in the tree scene?
Do you think Blender can do that?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] 3D Modeler for OpenScenegraph

2012-06-25 Thread Andrea Martini
Hi Andreas,
thank you for your quick answer.
I'm looking about software like : Blender, Lightwave, Maya and/or particolar 
exporter (i.e. Collada)

Thank you!

Cheers,
Andrea

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Change Texture in a given 3D model

2012-01-24 Thread Andrea Martini
Hi,
thank you for your answer.
I solved using :

osg::Geode* mGeodeWhoHasTexture;  // Geode with texture
osg::ref_ptrosg::Texture2D mGeodeTexture;
osg::ref_ptrosg::Image mOriginalImage; // original image
osg::ref_ptrosg::Image mImageOne; // new image

// After image load
... 
mGeodeTexture=dynamic_castosg::Texture2D*
(mGeodeWhoHasTexture-getDrawable(0)-getStateSet()-getTextureAttribute(Channel,osg::StateAttribute::TEXTURE));
if (mGeodeTexture.get())
{
   mOriginalImage = mGeodeTexture-getImage();
   mGeodeTexture-setImage(mImageOne.get());
 }

Is there a way to  load all the images during start application to avoid 
waiting time during image switching?
Beccouse each time i load a new image, i see a rescaling process. (i don't want 
to rescale image) that could take some seconds.


Thank you!

Cheers,
Andrea

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





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


[osg-users] Change Texture in a given 3D model

2012-01-23 Thread Andrea Martini
Hi,

is it possibile change texture image of a given 3D model?
I have a 3D model coming from lightwave. I know the node* where i can find the 
texture (i.e Sun.tga). I'm wondering if is it possibile to change the SUN 
texture with another one (i.e MOON.tga) that has the same resolution.
Moreover that texture would be applied in the same way  of the previous one.
PS: The only information i have is the name of the surface (geode) that 
contains the texture (created with uv map).

Thank you!

Cheers,
Andrea

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





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


[osg-users] osg::Manipulator TabBoxDragger and Clipnode

2011-12-13 Thread Andrea Martini
Hi,
... a hope 
Is there a class, like osgManipulator::TabBoxDragger and relative DraggerCall 
back that allows object (osg::Node* ) clipping instead of resize or moving?
In this mode, picking on a box's plane, it is possible to cut the 3D model 
inside the box on a fixed direction (one for each plane).

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Sectional plane on DICOM

2011-12-06 Thread Andrea Martini
Hi to all,
I probably made ​​a mistake in formulating the previous post. What I would try 
to do, is the cutting plane on a volume (OSG:: volume). In the previous version 
of OsgVolume example, there was a --clip parameters (now deprecated). Is there 
a way to simulate a clip plane on a Volume? 
Should I work on the shader parameter? Like :

 osgVolume::AlphaFuncProperty* ap = new osgVolume::AlphaFuncProperty(alphaFunc);
osgVolume::SampleDensityProperty* sd = new 
osgVolume::SampleDensityProperty(0.005);
osgVolume::TransparencyProperty* tp = new 
osgVolume::TransparencyProperty(1.0);
osgVolume::TransferFunctionProperty* tfp = transferFunction.valid() ? 
new osgVolume::TransferFunctionProperty(transferFunction.get()) : 0;


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Sectional plane on DICOM

2011-12-06 Thread Andrea Martini
Hi,

in osgVolume example, using --manipulator parameter, allows to cut the volume 
as a cut plan (or clipplane).
Hoping it could be useful.

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Sectional plane on DICOM

2011-12-06 Thread Andrea Martini
Hi Robert,

thank you for your suggestion.

Cheers,
Andrea

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





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


[osg-users] [osgPlugins] Sectional plane on DICOM

2011-12-05 Thread Andrea Martini
Hi to all,
i'm looking for visualize and ispection a Volume got from dicom files.
I'm using osg 3.0.1 and dcmtk 3.6, vith vs 2008. Osg volume example, shows how 
to load a dicom volume data. But, i'm wondering if is it possible to create a 
Sectional Plane (like cut plane) on dicom Volume using osg 3.0.1 and dcmtk 3.6? 
Is there any example about? Which class and methods sholud  i consider?
Thank you!

Cheers,
Andrea

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





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


[osg-users] [osgPlugins] Compiling osg dicom plugin with dcmtk isuue

2011-10-26 Thread Andrea Martini
Hi,

i'm looking for compiling osg dicom plugin. I have osg 2.8.2 and i downloaded 
dcmtk source code 3.6.0 from http://dicom.offis.de/dcmtk.  
First i have compiled dcmtk ... all ok.
Then, i get no error from compiling of ReaderWriterDICOM.cpp in Plugins dicom. 
But i get Errors (only 113!!!) in linking process, like this :

dcmdata.lib(vrscan.obj) : error LNK2001: external symbol public: bool 
__thiscall log4cplus::Logger::isEnabledFor(int)const  
(?isEnabledFor@Logger@log4cplus@@QBE_NH@Z) unsolved.

dcmdata.lib(dcpixseq.obj) : error LNK2001: external symbol public: void 
__thiscall log4cplus::Logger::forcedLog(int,class OFString const ,char const 
*,int,char const *)const  
(?forcedLog@Logger@log4cplus@@QBEXHABVOFString@@PBDH1@Z) unsolved

dcmimgle.lib(dimomod.obj) : error LNK2001: external symbol public: bool 
__thiscall log4cplus::Logger::isEnabledFor(int)const  
(?isEnabledFor@Logger@log4cplus@@QBE_NH@Z) unsolved

(only for dmcimgle.lib and dcmdata.lib files).

I'm using VS2005.
I quite sure to set the correct path for include and lib files. (I suppose)
Could it depend on dcmtk version?
Could someone give me some suggestions?
Thank you in advance.

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Compiling osg dicom plugin with dcmtk isuue

2011-10-26 Thread Andrea Martini
Hi Robert,
thank you for your reply. 
I was hoping to build the plugin with osg 2.8.2 for compatibility with other 
modules.
But, if there are no way to compile, i'm forced to do that.
Thank you again.
Andrea

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





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


Re: [osg-users] [osgPlugins] Compiling osg dicom plugin with dcmtk isuue

2011-10-26 Thread Andrea Martini
Hi Robert,
I will do a first test in this way. As soon as I can, I will move to the new 
version.
I will post the result

Thank you!

Andrea

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





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


Re: [osg-users] [osgPlugins] Error compiling fbx plugin

2011-05-09 Thread Andrea Martini
Hi Michael,
i have installed fbx sdk 2010.2 and i'm using openscenegraph 2.8.4
But, unfortunally, i have the same error during compile time :

..\..\..\..\src\osgPlugins\fbx\ReaderWriterFBX.cpp(233) :
'fbxsdk_201002::KFbxImporter::Initialize' : no overloaded function takes 2 
arguments

Maybe, i'm doing something wrong, but i don't understand what.


Andrea

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





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


[osg-users] Animate a 3D model using osg::Animation and bvh plugin

2011-05-06 Thread Andrea Martini
Hi,
I would like to use osg_bvh plugin and osg:animation to animate a 3D model that 
has DOFTransform nodes. But i don't understand how use osgAnimation::Skeleton, 
osgAnimation::Animation, osgAnimation::BasicAnimationManager, 
osgAnimation::Bone.
To animate a single DofTransform nodes inside model (i.e. head) i traverse 3D 
model, but how can i get information by bvh?

I use :

osg::Node* loadedModel = osgDB::readNodeFile(SimpleWalk.bvh);

but i don't know how to get information about head rotation.


Moreover, if i don't use osgAnimation Classes, i can set hpr bvh info to each 
DofTransform ... but it could be an hard work. I suppose that it could be more 
simpler using osganimation. 
Could you give me some suggestions?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Error compiling fbx plugin

2011-04-22 Thread Andrea Martini
Hi Michael, 

thank you for answer. I have followed suggestion on  :

http://www.openscenegraph.org/projects/osg/wiki/Support/UserGuides/Plugins; 
where, about fbx plugin there is the follo sugestion :

Requires version 2011.3.1 (static libraries) of the FBX SDK. If you have 
problems loading an FBX model please check that it works in Autodesk's FBX 
QuickTime Viewer first to see if the model was correctly exported.

I have download the fbx sdk from :

http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112id=10775892;.

Maybe, do you mean i have to use the 2010.0.2 sdk version? (static or dynamic)

What version of openscenegraph i can use?

I'll inform you about version working ok with 2.8.3 ... if i find it!

Thank you again.

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Error compiling fbx plugin

2011-04-22 Thread Andrea Martini
Hi to all,

i have tried also to compile osg 2.8.3 fbx plugin, with fbx sdk 2010.0.2.
In this case, i get only one compiling error :

..\..\..\..\src\osgPlugins\fbx\ReaderWriterFBX.cpp(233) : error C2661: 
'fbxsdk_201002::KFbxImporter::Initialize': no overloaded function takes 2 
arguments

The error line code is :

if (!lImporter-Initialize(utf8filename.c_str(), fileFormat))
{
return std::string(lImporter-GetLastErrorString());
}

becouse Initialize accept only one input parameters.
Infact, from intellisense, i see :

virtual bool fbxsdk_201002::KFbxImporter::Initialize(const char * pFileName)

virtual bool fbxsdk_201002::KFbxImporter::Initialize(fbxsdk_201002::KFile 
*pFileName)

Is there a way to use fbx plugin with openscenegraph 2.8.3?

Thank you!

Andrea

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





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


[osg-users] [osgPlugins] Error compiling fbx plugin

2011-04-21 Thread Andrea Martini
Hi,

i would like to use fbx plugin with openscenegraph. I'm using openscenegraph 
2.8.4 (Windows Xp, VisualStudio 2005), and fbx sdk 2011.3.1 (static).

During file compiling, i get :

fbxRNode.cpp - OK
fbxRMesh.cpp - Error

..\..\..\..\src\osgPlugins\fbx\fbxRMesh.cpp(244) : error C2039: 
'GetTakeNodeCount': is not a member of  'fbxsdk_2011_3_1::KFbxNode'

..\..\..\..\src\osgPlugins\fbx\fbxRMesh.cpp(246) : error C2039: 
'GetTakeNodeName': is not a member of  'fbxsdk_2011_3_1::KFbxNode'

fbxRLight.cpp -  OK

fbxRCamera.cpp - Ok

fbxRAnimation.cpp - error

..\..\..\..\src\osgPlugins\fbx\fbxRAnimation.cpp(225) : error C2039: 
'GetTakeNodeCount':  is not a member of   'fbxsdk_2011_3_1::KFbxNode'


..\..\..\..\src\osgPlugins\fbx\fbxRAnimation.cpp(227) : error C2039: 
'GetTakeNodeName': is not a member of  'fbxsdk_2011_3_1::KFbxNode'


fbxMaterialToOsgStateSet.cpp - Ok


ReaderWriterFBX.cpp - Error (12 errors)

(one of them)
..\..\..\..\src\osgPlugins\fbx\ReaderWriterFBX.cpp(95) : error C2039: 
'IOSettingsRef': is not a member of 'fbxsdk_2011_3_1::KFbxIOSettings'


WriterNodeVisitor.cpp - error
(one of them)

..\..\..\..\src\osgPlugins\fbx\WriterNodeVisitor.cpp(494) : error C2039: 
'SetDiffuseTextures': is not a member of  'fbxsdk_2011_3_1::KFbxLayer'


Could you suggest me how to solve these problems?


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Error compiling fbx plugin

2011-04-21 Thread Andrea Martini
Hi,

i have compiled fbx plugin also with openscenegraph 2.8.3 and 2.9.6 (using fbx 
sdk 2011.3.1) but i have compiling errors too.

Thank you!

Cheers,
Andrea

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





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


[osg-users] Material and SetTrasparancy

2011-03-25 Thread Andrea Martini
Hi,

i'm looking for give to an 3d object, some transparent value (not completely 
transparency) . So, i'm starting from osgclip example, to make trasparent (with 
0.5 opacity) the wireframe part of the cow.

part of the c++ code :

osg::Node* decorate_with_clip_node(osg::Node* subgraph)
{
...
float Opacity=0.5;
osg::Material * material = (osg::Material *) 
wireframe_subgraph-getOrCreateStateSet()-getAttribute(osg::StateAttribute::MATERIAL);
material-setTransparency(osg::Material::FRONT_AND_BACK, 1. - Opacity);
wireframe_subgraph-getStateSet()-setRenderBinDetails(0, 
transparent);
wireframe_subgraph-getStateSet()-setMode( GL_BLEND, 
osg::StateAttribute::ON );

wireframe_subgraph-getStateSet()-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
wireframe_subgraph-getStateSet()-setAttributeAndModes(material, 
osg::StateAttribute::OVERRIDE);

wireframe_subgraph-addChild(subgraph);
rootnode-addChild(wireframe_subgraph);
...

At runtime, at :

material-setTransparency(osg::Material::FRONT_AND_BACK, 1. - Opacity);

i get the following error :

Access violation in the writing of the address ...

and the check is on the following methods:

void Material::setTransparency(Face face,float transparency)
{
   //clampBetweenRange(transparency,0.0f,1.0f,Material::setTransparency());

   if (face==FRONT || face==FRONT_AND_BACK)
   {
_ambientFront[3] = 1.0f-transparency;   // I get error here
_diffuseFront[3] = 1.0f-transparency;
_specularFront[3] = 1.0f-transparency;
_emissionFront[3] = 1.0f-transparency;
}

if (face==BACK || face==FRONT_AND_BACK)
{
_ambientBack[3] = 1.0f-transparency;
_diffuseBack[3] = 1.0f-transparency;
_specularBack[3] = 1.0f-transparency;
_emissionBack[3] = 1.0f-transparency;
}
}  

Could you suggest me to solve this problem?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] Material and SetTrasparancy

2011-03-25 Thread Andrea Martini
Hi,

I solved. The Problem is a null pointer of material, after :
osg::Material * material = (osg::Material *) 
wireframe_subgraph-getOrCreateStateSet()-getAttribute(osg::StateAttribute::MATERIAL);
 command.

I solved simply in this way :
osg::Material * material = new osg::Material();
material-setTransparency(osg::Material::FRONT_AND_BACK, 1. - Opacity);
wireframe_subgraph-getOrCreateStateSet()-setRenderBinDetails(0, 
transparent);
wireframe_subgraph-getOrCreateStateSet()-setMode( GL_BLEND, 
osg::StateAttribute::ON );

wireframe_subgraph-getOrCreateStateSet()-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

wireframe_subgraph-getOrCreateStateSet()-setAttributeAndModes(material, 
osg::StateAttribute::OVERRIDE);



... 

Sorry.

Andrea

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





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


Re: [osg-users] More than one ClipNode and ClipPlane

2011-03-02 Thread Andrea Martini
Hi Robert,

following your suggestions, i solved my doubts.

This is the correct code:

...
// cylinder :

osg::ClipNode* cnCylinder=new osg::ClipNode();

cnCylinder-addChild(cylinderModel);

groupCylynder-addChild(cnCylinder);

clipPlaneForCylinder=new osg::ClipPlane();

planeForCylinder=new osg::Plane(NormalCylinder,CenterCylinder);

clipPlaneForCylinder-setClipPlane(planeForCylinder);


// Important to manage multiple clipnode
clipPlaneForCylinder-setClipPlaneNum(0);



cnCylinder-addClipPlane(clipPlaneForCylinder);

cnCylinder-setCullingActive(false);


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [osgPlugins] Shader from Rendermonkey : Collada plugin

2009-10-08 Thread Andrea Martini
Hi,

i'm sorry  the second question in the post above was my typing error in the 
project properties (i have written .dll instead .lib). 
So i can compile plugin DAE correctly with openscenegraph 2.8.2.
But i get the same warning message of 2.8.0 :

unsupported effect profile profile_GLSL.

when i load a dae file (created with rendermonkey) in osgviewer.


Thank you!

Cheers,
Andrea

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





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


[osg-users] [osgPlugins] Shader from Rendermonkey : Collada plugin

2009-10-06 Thread Andrea Martini
Hi,

i have Only 2 questions ... about shaders!
I would like to use shaders created with rendermonkey  1.81 and exported as 
collada 1.4.1. I'm using OpenScenegraph 2.8.0 and 2.8.2. 

First question:
Using  Osg 2.8.0
I run viewer.exe with myfile.dae (a specular bump effect with teapot as model). 
The result is a black teapot with some red effect. On the console system 
reports unsupported effect profile profile_GLSL! 
What does it mean? What is the solution? Where i can find supported and 
unsupported effect?
(I have an NVIDIA QUADRO FX 4600, and rendermonkey render my teapot correctly!)

Second question:
Using Osg2.8.2

I have download the collada package and i have compiled the vc8 dom 1.4 
solution correctly (release and debug). With CMAKE i get the new openscenegraph 
solution with DAE plugin. But ... when i compile openscenegraph solution, in 
the linking phase, compiler says :

dom\build\vc8-1.4-d\libcollada14dom21-d.dll : fatal error LNK1107: file damaged 
or not valid!

What is wrong?

Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [vpb] Some questions about VPB and cloud of points

2009-08-27 Thread Andrea Martini
Hi,

... 


Thank you!

Cheers,
Andrea

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





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


Re: [osg-users] [vpb] Some questions about VPB and cloud of points

2009-08-27 Thread Andrea Martini
Hi Jagovic,
thank you for your suggestion. I've tried 3Dem ... but what i mean is to find a 
procedure that i can use to design and develop inside a software application 
(using technologies like osg, gdal, vpb, osgearth,...). So i can create and 
visualize automatically my row data. Using 3Dem, instead, i can't realize this 
automatic procedure, but  i need to use different software applications.
Thank you again!
Andrea

PS: Sorry, i have posted a blank email above!  :(

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





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


Re: [osg-users] [vpb] Some questions about VPB and cloud of points

2009-08-26 Thread Andrea Martini
Hi Glenn,
thank you for your answer. What do you think about the first question?
Can i create a dem file starting from a cloud of points using osgdem? This 
cloud of points is an ascii file with n rows each one with x,y,z values. These 
values are referred to a coordinate system (i know this one).
If i do that, i can create earth and seaground with osgdem then i will assembly 
them with osgearth. Is it right?

Thank you!
Andrea

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





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


[osg-users] [vpb] Some questions about VPB and cloud of points

2009-08-24 Thread Andrea Martini
Hi to all,
i would like to create or use a software application ables to visualize a 
seaground (get from a cloud of points) 3d model inside earth 
model created by osgdem. I'm wondering if VPB, OsgEarth or osgGIS are the 
correct technologies to solve my problem.
Some questions :
1) Can i create a DEM file from a cloud of points (I have information about its 
coordinates) using osgdem?
2) How i can add the DEM file obtained from previous question (or a generic 3d 
model) to earth model created by osgdem?
3) I have created the earth model with osgdem using blu marble image from nasa 
web site. The best image resolution get from 
this website  is too far from the ground (i think that image was taken from 
about 900 km of quote). I would like to insert or ADD 3d model 
of my clouds of point (the seaground), in DEM format, and i would like to 
visualize this model only at a certain level 
(i.e. after the last level created by osgdem).
Hoping my questions could be enough clear ...

Thank you!

Cheers,
Andrea

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





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


[osg-users] OSGEARTH cmake problem

2009-01-28 Thread Andrea Martini
Hi to all,
i'm trying to compile osgearth using svn source code and cmake 2.4.8.
I'm using windows XP, Visual studio 2005 sp1. I have correctly installed
Openscenegraph 2.6.1 with its dependencies.
Cmake configuration need OSG_GEN_INLUDE_DIR and OSG_DIR parameters. Where i
can point this folder?
Without these information i can't create the solution sln of osgearth
project.
Could anyone help me?
Thank you in advance.
Bye,
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-04 Thread Andrea Martini
Well,
in my msys shell, in the correct build folder created by CMAKE 2.6.0, i type
follow command :

$mingw32-make VERBOSE=1 2makeResult.log

to get error(?) message in a log file (i.e. makeResult.log)

I have no compile problem if i exclude from cmake the quicktime plugin.
But if i include quicktime plugin (i have taken quicktime sdk 7.1 from
official web site) i get error reported in

http://pastebin.com/m74380111

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


Re: [osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-04 Thread Andrea Martini
Hi,
i get 2 errors in tha last two line of log reported in :

http://pastebin.com/m74380111

I have compiled with -Wno-multichar , but i still continue get the same
warnings and error.

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


Re: [osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-04 Thread Andrea Martini
 Hi,
 i get 2 errors in tha last two line of log reported in :

 http://pastebin.com/m74380111

 I have compiled with -Wno-multichar , but i still continue get the same
 warnings and error.


Can you paste the entire output of mingw32-make VERBOSE=1 including stdout
and stderr?


Hi,
i put the entire output at web site url :

http://pastebin.com/m72a3d0d2

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


Re: [osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-03 Thread Andrea Martini
Hi Philip,
thank for your answer. I have searched gl.h include file in my fyle system,
and i get this include file both in c:\mingw\include and visual studio path
directory.
Gl.h comes from visual studio directory contains the extension GL_BGRA_EXT
and gl.h that comes from mingw has not.
If i compile osg plugins with visual studio i have no problem.
So i suppose that mingw must be updated with new opengl include and library.

I have tried to use gl.h and glext.h from visual studio folder in mingw, but
mingw gives me error!
How i can update mingw to get the right gl extension?
I have an nvidia quadro fx 4600 on window xp.
bye.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-03 Thread Andrea Martini
Hi,
i have used Robert's suggestion.
I have added :

#ifndef GL_BGRA_EXT
#define GL_BGRA_EXT  0x80E1
#endif

in MovieData.h. Previuos problem SOLVED. THANX :)

Now i get another error :

For each .h file in CInclude directory of QuickTime SDK folder, i get :
  warning: multi-character character constant
and warning list ended with this error.

mingw32-make[2]: ***
[src/osgPlugins/quicktime/CMakeFiles/osgdb_qt.dir/MovieData.obj] Error 1
mingw32-make[1]: *** [src/osgPlugins/quicktime/CMakeFiles/osgdb_qt.dir/all]
Error 2
mingw32-make: *** [all] Error 2



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


[osg-users] Quicktime osgplugin compile error with eclipse + mingw

2008-07-02 Thread Andrea Martini
Hi guys,
i have some problem when i try to compile quicktime osg plugin and
openscenegraph 2.2.0.
I'm going to compile openscenegraph 2.2.0 with minGW 3.14 and Eclipse 3.3.2
using CMake 2.6.0.
I have downloaded quicktime SDK (version 7.1) and i have specified include
and lib variables in CMAKE gui application.
I'm using msys to compile openscenegraph, but at osgplugins QuickTime i get
this error:

O:\OpenSceneGraph-2.2.0\OpenSceneGraph\src\osgPlugins\quicktime\MovieData.cpp:
In member function `void MovieData::_initImage(osg::Image*)':
O:\OpenSceneGraph-2.2.0\OpenSceneGraph\src\osgPlugins\quicktime\MovieData.cpp:115:
error: `GL_BGRA_EXT' was not declared in this scope
mingw32-make[2]: ***
[src/osgPlugins/quicktime/CMakeFiles/osgdb_qt.dir/MovieData.obj] Error 1
mingw32-make[1]: *** [src/osgPlugins/quicktime/CMakeFiles/osgdb_qt.dir/all]
Error 2
mingw32-make: *** [all] Error 2

Could anyone gives me any suggestion?
Thanx.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] loading thousands of images!

2008-06-12 Thread Andrea Martini
Hi guys,
i'm using osg 1.2. I would like to load a lot of images (15000 jpeg files)
in memory using an osg:image vector ( std::vectorosg::image), but i
receive something like a memory bug when i arrive to load the 400th image
(if i load i.e. 380 images i have no problem).
Initally i have supposed to load all images (30 kbyte for each image) in a
std:vectorosg:image. I have seen that osg:imagestream also exists. What is
the difference between image and imagestream? where i can find more
information on how to  use these classes? Is there a tutorial or example
that explain how to use them? I have taken look on quicktime plugin, but
both version and topic inside plugin (quick time plugin try to convert video
streaming into image, my problem is to load a lot of images!) don't allow me
to use it. Also, i have tought to use two separate threads one for image
folder loading, and the second for visualize image, but visualization thread
is two time faster then loading thread (and i have only a buffer of 400
images available!).
Any suggestion?
Bye.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org