Generally you should use interfaces provided by osg to get to opengl functions, 
as they can have different pointers in different graphics contexts.

so it goes like

typedef void (APIENTRY * TransformFeedbackVaryings)(GLuint, GLsizei, const 
GLchar **, GLenum);
TransformFeedbackVaryings _glTransformFeedbackVaryingsPtr;
if (!osg::setGLExtensionFuncPtr(_glTransformFeedbackVaryingsPtr,  
"glTransformFeedbackVaryings" ))
 if (!osg::setGLExtensionFuncPtr(_glTransformFeedbackVaryingsPtr,  
"glTransformFeedbackVaryingsEXT" ))
  //not supported :(
// so now you can use this pointer in this gc


also if you need some opengl functions, first check osg::GL2Extensions, it may 
be already wrapped and initialized there.
All of this should be called with active graphics context


Cheers


29.02.2012, 18:22, "Martin Groer" <[email protected]>:
> Hello,
>
> I tried this in my camera draw callback:
>
> virtual void operator()(const osg::Camera& camera) const
> {
>   // GL-Context-ID
>   GLuint gcID = _gc->getState()->getContextID();
>
>   // GL-Program-Handle
>   osg::Program::PerContextProgram* pcp = _program->getPCP(gcID);
>   GLuint prID=pcp->getHandle();
>
>   const char* varyings[1] = { "vPosition" };
>   glTransformFeedbackVaryings(prID, 1, varyings, GL_SEPARATE_ATTRIBS);
> }
>
> But when I want to compile this, I get the error "glTransformFeedbackVaryings 
> isn't defined". I searched in my includes and it is in the glext.h and glew.h 
> defined. What is wrong?
>
> Cheers,
> Martin
>
> -------- Original-Nachricht --------
>
>>  Datum: Tue, 28 Feb 2012 10:45:16 -0700
>>  Von: Paul Martz <[email protected]>
>>  An: OpenSceneGraph Users <[email protected]>
>>  Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
>>  On 2/28/2012 9:10 AM, "Martin Großer" wrote:
>>>  Hello Paul,
>>>
>>>  In OpenGL I have to define the varying variables for the transform
>>  feedback between the compiling and linking of the shader program.
>>>  glTransformFeedbackVaryings(programHandle, 1, varyings,
>>  GL_SEPARATE_ATTRIBS);
>>>  How can I do this in OSG?
>>  The same way. You can issue an OpenGL call any time you have a current
>>  context
>>  (Camera pre draw callback, Drawable draw callback, etc).
>>
>>  A quick glance at the Program header file reveals that you can get the
>>  program
>>  ID with a call to:
>>     osg::Program::getPCP(contextID)->getHandle();
>>>  Additinally I use osg 2.8.4 from the Fedora repository.
>>>
>>>  Cheers,
>>>  Martin
>>>
>>>  -------- Original-Nachricht --------
>>>>  Datum: Mon, 27 Feb 2012 09:51:15 -0700
>>>>  Von: Paul Martz<[email protected]>
>>>>  An: OpenSceneGraph Users<[email protected]>
>>>>  Betreff: Re: [osg-users] GL_TRANSFORM_FEEDBACK_BUFFER_NV in OSG
>>>>  Yes, it's possible, but there are no examples that I know of. You might
>>>>  try
>>>>  binding a buffer object in a Camera pre-draw callback, for an example
>>  of
>>>>  one
>>>>  strategy.
>>>>       -Paul
>>>>
>>>>  On 2/27/2012 8:21 AM, "Martin Großer" wrote:
>>>>>  Hello,
>>>>>
>>>>>  Is it possible to use GL_TRANSFORM_FEEDBACK_BUFFER_NV extension in
>>  osg?
>>>>  I would like write back my vertex position data into a new Vertex
>>  Buffer
>>>>  Object. Is there any example about this?
>>>>>  Cheers
>>>>>
>>>>>  Martin
>>>>  _______________________________________________
>>>>  osg-users mailing list
>>>>  [email protected]
>>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>  _______________________________________________
>>  osg-users mailing list
>>  [email protected]
>>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> --
> NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
> Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to