Re: [osg-users] glActiveTextureARB in OSG

2009-03-12 Thread Großer Martin
Hello Robert,

I'd like to use a OSG class. But I don't know which class I can use.
There are no way to change the active texture in osg or can I reset the
opengl state machine? After the rendering ( frame() ) the active texture
is not TEXTURE0_ARB, but that is what I need.

Cheers, Martin

Am Mittwoch, den 11.03.2009, 09:08 + schrieb Robert Osfield:
 Hi Martin,
 
 The OSG queries OpenGL extensions at runtime, so even if the header
 doesn't contain the function then it'll be able to pick it up from the
 driver.
 
 As a general note, I'd recommend avoiding calling OpenGL yourself, and
 port your code across to using the OSG classes to do the OpenGL work,
 this will avoid issues with clashes of state managment and allow the
 OSG to do state sorting + lazy state updating, and it'll do the
 extension setup for you.
 
 Robert.
 
 On Wed, Mar 11, 2009 at 7:44 AM, Großer Martin grosser.mar...@gmx.de wrote:
  Hello all,
 
  I want to use the glActiveTextureARB in my Programm, but it doesn't
  work. I get the message that the glActiveTextureARB is not declared in
  this scope. I think the problem is the nvidia driver. It replace the
  OpenGL headers. But in OSG it works fine, but why?
  I would like change the active texture to GL_TEXTURE0_ARB. Maybe there
  are a function in osg?
 
  Cheers, Martin
 
  ___
  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 mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] glActiveTextureARB in OSG

2009-03-12 Thread Robert Osfield
Hi Martin,

On Thu, Mar 12, 2009 at 10:36 AM, Großer Martin grosser.mar...@gmx.de wrote:
 I'd like to use a OSG class. But I don't know which class I can use.
 There are no way to change the active texture in osg or can I reset the
 opengl state machine? After the rendering ( frame() ) the active texture
 is not TEXTURE0_ARB, but that is what I need.

Use osg::State::setClientActiveTextureUnit(unsigned int unit);

It's implementation as:

bool State::setClientActiveTextureUnit( unsigned int unit )
{
if (unit!=_currentClientActiveTextureUnit)
{
if (_glClientActiveTexture  unit  (unsigned int)_glMaxTextureCoords)
{
_glClientActiveTexture(GL_TEXTURE0+unit);
_currentClientActiveTextureUnit = unit;
}
else
{
return unit==0;
}
}
return true;
}


I would however recommend using OSG objects to do rendering, as well
as my previously stated reasons it also will mean that you won't have
clunky high level code trying to manage drawing of the OSG and OpenGL
code.  For instance you meantion rendering after viewer.frame() which
suggests you're making the assumption that you are working on a single
graphics context single thread and that the viewer hasn't released the
graphics context.  You can do all of these things but you have to know
what you are doing.

If you do things in the scene graph, all the management of multiple
graphics contexts and threading will just fall out for free.

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


Re: [osg-users] glActiveTextureARB in OSG

2009-03-12 Thread Großer Martin
Hello Robert,

first ist works fine with setActiveTextureUnit(0)! Now I would like to
specify my request. I create my Scene and build on my scenegraph and
render my scene with frame(). I use a gtk embedded viewer like the
osgviewerGTK-Example. After the rendering I use a own render to texture
class. This class based on OpenGL only. I use glCopyTexImage2D to
translate the renderdata in the texture and project the texture on a
plane. But if the active texture unit  0 it doesn't work. That is the
reason to change the active texture after the rendering.

Thats my new line after frame():

_graphicWindow-getState()-setActiveTextureUnit(0);


Cheers, Martin

Am Donnerstag, den 12.03.2009, 10:45 + schrieb Robert Osfield:
 Hi Martin,
 
 On Thu, Mar 12, 2009 at 10:36 AM, Großer Martin grosser.mar...@gmx.de wrote:
  I'd like to use a OSG class. But I don't know which class I can use.
  There are no way to change the active texture in osg or can I reset the
  opengl state machine? After the rendering ( frame() ) the active texture
  is not TEXTURE0_ARB, but that is what I need.
 
 Use osg::State::setClientActiveTextureUnit(unsigned int unit);
 
 It's implementation as:
 
 bool State::setClientActiveTextureUnit( unsigned int unit )
 {
 if (unit!=_currentClientActiveTextureUnit)
 {
 if (_glClientActiveTexture  unit  (unsigned 
 int)_glMaxTextureCoords)
 {
 _glClientActiveTexture(GL_TEXTURE0+unit);
 _currentClientActiveTextureUnit = unit;
 }
 else
 {
 return unit==0;
 }
 }
 return true;
 }
 
 
 I would however recommend using OSG objects to do rendering, as well
 as my previously stated reasons it also will mean that you won't have
 clunky high level code trying to manage drawing of the OSG and OpenGL
 code.  For instance you meantion rendering after viewer.frame() which
 suggests you're making the assumption that you are working on a single
 graphics context single thread and that the viewer hasn't released the
 graphics context.  You can do all of these things but you have to know
 what you are doing.
 
 If you do things in the scene graph, all the management of multiple
 graphics contexts and threading will just fall out for free.
 
 Robert.
 ___
 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] glActiveTextureARB in OSG

2009-03-12 Thread Thrall, Bryan
Großer Martin wrote on Thursday, March 12, 2009 7:20 AM:

 Hello Robert,
 
 first ist works fine with setActiveTextureUnit(0)! Now I would like to
 specify my request. I create my Scene and build on my scenegraph and
 render my scene with frame(). I use a gtk embedded viewer like the
 osgviewerGTK-Example. After the rendering I use a own render to texture
 class. This class based on OpenGL only. I use glCopyTexImage2D to
 translate the renderdata in the texture and project the texture on a
 plane. But if the active texture unit  0 it doesn't work. That is the
 reason to change the active texture after the rendering.
 
 Thats my new line after frame():
 
 _graphicWindow-getState()-setActiveTextureUnit(0);

Perhaps osgPPU would help do what you want? It uses a pbuffer (see also 
osg::Camera::attach()), which would be faster than glCopyTexImage2D.

 Am Donnerstag, den 12.03.2009, 10:45 + schrieb Robert Osfield:
 Hi Martin,
 
 On Thu, Mar 12, 2009 at 10:36 AM, Großer Martin grosser.mar...@gmx.de
 wrote: 
 I'd like to use a OSG class. But I don't know which class I can use.
 There are no way to change the active texture in osg or can I reset the
 opengl state machine? After the rendering ( frame() ) the active texture
 is not TEXTURE0_ARB, but that is what I need.
 
 Use osg::State::setClientActiveTextureUnit(unsigned int unit);
 
 It's implementation as:
 
 bool State::setClientActiveTextureUnit( unsigned int unit ) {
 if (unit!=_currentClientActiveTextureUnit)
 {
 if (_glClientActiveTexture  unit  (unsigned
 int)_glMaxTextureCoords) {
 _glClientActiveTexture(GL_TEXTURE0+unit);
 _currentClientActiveTextureUnit = unit; } else
 {
 return unit==0;
 }
 }
 return true;
 }
 
 
 I would however recommend using OSG objects to do rendering, as well
 as my previously stated reasons it also will mean that you won't have
 clunky high level code trying to manage drawing of the OSG and OpenGL
 code.  For instance you meantion rendering after viewer.frame() which
 suggests you're making the assumption that you are working on a single
 graphics context single thread and that the viewer hasn't released the
 graphics context.  You can do all of these things but you have to know
 what you are doing.
 
 If you do things in the scene graph, all the management of multiple
 graphics contexts and threading will just fall out for free.
 
 Robert.
 ___
 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



-- 
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] glActiveTextureARB in OSG

2009-03-11 Thread Großer Martin
Hello all,

I want to use the glActiveTextureARB in my Programm, but it doesn't
work. I get the message that the glActiveTextureARB is not declared in
this scope. I think the problem is the nvidia driver. It replace the
OpenGL headers. But in OSG it works fine, but why?
I would like change the active texture to GL_TEXTURE0_ARB. Maybe there
are a function in osg?

Cheers, Martin

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


Re: [osg-users] glActiveTextureARB in OSG

2009-03-11 Thread Robert Osfield
Hi Martin,

The OSG queries OpenGL extensions at runtime, so even if the header
doesn't contain the function then it'll be able to pick it up from the
driver.

As a general note, I'd recommend avoiding calling OpenGL yourself, and
port your code across to using the OSG classes to do the OpenGL work,
this will avoid issues with clashes of state managment and allow the
OSG to do state sorting + lazy state updating, and it'll do the
extension setup for you.

Robert.

On Wed, Mar 11, 2009 at 7:44 AM, Großer Martin grosser.mar...@gmx.de wrote:
 Hello all,

 I want to use the glActiveTextureARB in my Programm, but it doesn't
 work. I get the message that the glActiveTextureARB is not declared in
 this scope. I think the problem is the nvidia driver. It replace the
 OpenGL headers. But in OSG it works fine, but why?
 I would like change the active texture to GL_TEXTURE0_ARB. Maybe there
 are a function in osg?

 Cheers, Martin

 ___
 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] glActiveTextureARB in OSG

2009-03-11 Thread Jason Daly

Robert Osfield wrote:

Hi Martin,

The OSG queries OpenGL extensions at runtime, so even if the header
doesn't contain the function then it'll be able to pick it up from the
driver.

As a general note, I'd recommend avoiding calling OpenGL yourself, and
port your code across to using the OSG classes to do the OpenGL work,
this will avoid issues with clashes of state managment and allow the
OSG to do state sorting + lazy state updating, and it'll do the
extension setup for you.
  


Hi, Martin,

First read and consider Robert's warning above (to me, it seems that 
switching the active texture unit in the middle of a traversal is just 
asking for trouble). 

Next, have you tried using just glActiveTexture() (without the ARB)?  
glActiveTextureARB() is the function from the ARB_multitexture extension. 

Since OpenGL 1.3, multitexture has been part of core OpenGL, and the 
core function is just glActiveTexture().


Hope this helps...

--J


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