Re: [osg-users] Drawable init method?

2013-01-15 Thread Alexandre Valdetaro
Sorry about this delay, i did not notice when i looked and the compileGLObjects 
method that it was also const, which still confuses me.

First of all thanks for the explanation! 
Still, how is one supposed to create any opengl element (VBOs, textures...) to 
use inside the drawImplementation method when overriding it? I apologize if it 
is something simple and i am not seeing it, but i havent found an example that 
has such scenario. If there is one, could someone please point me to it?

Thanks in advance!

Cheers,
Alexandre

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





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


Re: [osg-users] Drawable init method?

2013-01-15 Thread Robert Osfield
Hi Alexandre,

On 15 January 2013 12:47, Alexandre Valdetaro osgfo...@tevs.eu wrote:
 Sorry about this delay, i did not notice when i looked and the 
 compileGLObjects method that it was also const, which still confuses me.

 First of all thanks for the explanation!
 Still, how is one supposed to create any opengl element (VBOs, textures...) 
 to use inside the drawImplementation method when overriding it? I apologize 
 if it is something simple and i am not seeing it, but i havent found an 
 example that has such scenario. If there is one, could someone please point 
 me to it?

The compileGLObjects() and draw/drawImplementation() methods are const
to give a strong hint to the developer that these classes can be run
multi-threaded and should not usually modify local data.  For data
like OpenGL objects one does need to modify it during the draw calls
but these are the exception and have to be multi-buffered with one
element in each buffer used for each graphics context, as each
graphics thread has at most one thread the thread safety is not
compromised as long as the buffers used are pre-allocated to be big
enough to contain all the elements required.

Does this make sense?

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


Re: [osg-users] Drawable init method?

2013-01-15 Thread Alexandre Valdetaro
Hummm, now i understand. I really makes perfect sense. I will follow your 
advice and implement the gl objects in a multibuffered way then.

Thanks a lot for the explanation, it really helped.

Cheers,
Alexandre

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





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


Re: [osg-users] Drawable init method?

2012-12-18 Thread Alexandre Valdetaro
Ok, that was exactly what i needed.

Thanks a lot!

Cheers,
Alex

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





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


Re: [osg-users] Drawable init method?

2012-12-17 Thread Robert Osfield
Hi Alexandre,

All OpenGL calls have be done from a thread with a valid graphics context
current, as the OSG allows multi-threaded, multi-context usage one has to
be careful when and where you do OpenGL calls.  For a Drawable the three
times when it's guaranteed to be safe to do OpenGL calls is when overriding
the Drawable::compileGLObjects() or drawImplementation() or when using a
DrawCallback.

Robert.

On 7 December 2012 01:39, Alexandre Valdetaro osgfo...@tevs.eu wrote:

 Hi,

 I just figured out that i was having a lot of trouble when creating vbos
 inside a drawable because there was no opengl context set during its
 initialization.

 After searching for a while i found out that if i initialized the vbos
 inside drawImplementation method then everything would work. There is one
 problem however, drawImplementation is const.

 I ended up setting all my members to mutable and all my methods to const
 so i could make it work. And now it is working.

 Isn't there a more proper way of initializing stuff inside a drawable? I
 would expect a initialize method or something like it, or a non const
 drawImplementation method.

 I also tried to set the context before initializing the drawable without
 using the drawImplementation method to no avail.

 Thanks a lot fellows

 Cheers,
 Alexandre

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





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

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


[osg-users] Drawable init method?

2012-12-06 Thread Alexandre Valdetaro
Hi,

I just figured out that i was having a lot of trouble when creating vbos inside 
a drawable because there was no opengl context set during its initialization.

After searching for a while i found out that if i initialized the vbos inside 
drawImplementation method then everything would work. There is one problem 
however, drawImplementation is const.

I ended up setting all my members to mutable and all my methods to const so i 
could make it work. And now it is working.

Isn't there a more proper way of initializing stuff inside a drawable? I would 
expect a initialize method or something like it, or a non const 
drawImplementation method.

I also tried to set the context before initializing the drawable without using 
the drawImplementation method to no avail.

Thanks a lot fellows

Cheers,
Alexandre

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





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