Re: [osg-users] Lot of questions about OSG (Shaders)

2015-09-01 Thread Andrey Perper
i do not understand! What do i have  to do?
Code plz

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





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


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-09-01 Thread Sebastian Messerschmidt

Hey Andrey,

Simply take a look at the osgShader example. It will explain loading, 
adding to the statesets and how it simply will compile the shader 
programs on first use.
We won't be able to help you in terms of writing code, as we might not 
understand your problem.
If you need to know if a shader compiled successfully you can take a 
look at the console. If you need to check it programmatically you need 
to store the pointer to your program and later check if the shader was 
linked (with your current context).

A simple google search revealed:

http://forum.openscenegraph.org/viewtopic.php?t=5166

Another hint:
the viewer has a pointer to its camera, which IIRC contains a pointer to 
the graphics context.


So basically you simply need to put this stuff together. If it still is 
not what you are after, try to rephrase your question.






2 robertosfield

I still wait , that 100 000 users of OSG will help me!

Waiting usually gives you nothing but wasted time ;-)
Asking the right question will certainly reduce the amount of time 
wasted waiting.


Cheers
Sebastian




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





___
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] Lot of questions about OSG (Shaders)

2015-09-01 Thread Robert Osfield
On 1 September 2015 at 08:33, Andrey Perper  wrote:

> 2 robertosfield
>
> I still wait , that 100 000 users of OSG will help me!
>

You need to write questions that are easy to understand and reply to if you
want replies, otherwise people will just scratch their heads and skip them.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-09-01 Thread Andrey Perper
2 robertosfield

I still wait , that 100 000 users of OSG will help me!

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





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


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-09-01 Thread Andrey Perper
Thanks Sebastian !

Looks like i found solution:


Code:

bool ProgramIsCompiled(COITPCore *pCre,osg::Program *pPrg)
{
  Camera *pCam = pCre->getCamera();
  int contextID = pCam->getGraphicsContext()->getState()->getContextID();

  for(int i = 0; i < pPrg->getNumShaders(); i++)
  {
if(!pPrg->getShader(i)->getPCS(contextID)->isCompiled())
  return 0;
  }

  return 1;
}




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





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


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-03-31 Thread Andrey Perper
Hey Robert!

before you do any work. 

Could you post me code snippet, which have to do this checking ?

based on:

osg::ref_ptrosg::Shader SkyFromSpaceVert = osgDB::readShaderFile(systemPath + 
media/programs/EarthSkyFromSpaceShader.vert);

i guess my application gonna be multithreaded..

thanks...

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





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


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-03-17 Thread Andrey Perper
Hello..

1)
I just plan to perform something like that:


Code:
osg::ref_ptrosg::Shader EarthLoQVert = 
osgDB::readShaderFile(g_SceneGlobals.systemPath + 
media/programs/EarthLoQ.vert);

if(EarthLoQVert.isCompiledOK)
{
  create1..
}
else
{
  osg::ref_ptrosg::Shader EarthLoQVertexLighting =   
osgDB::readShaderFile(g_SceneGlobals.systemPath + media/programs 
/EarthLoQVL.vert);

 if(EarthLoQVertexLighting.isCompiledOK)
{
create2
 }
 else
{
fatalError
 }
}



i need to know if my shader is compiled ok after loading!
then i can create scene states, otherwise i load other shader and create other 
scene states

thanks


2) Are shaders with same names loaded single time ?


Code:
osg::ref_ptrosg::Shader EarthLoQVert = 
osgDB::readShaderFile(g_SceneGlobals.systemPath + 
media/programs/EarthLoQ.vert);

osg::ref_ptrosg::Shader EarthLoQVert1 = 
osgDB::readShaderFile(g_SceneGlobals.systemPath + 
media/programs/EarthLoQ.vert);

osg::ref_ptrosg::Shader EarthLoQVert2 = 
osgDB::readShaderFile(g_SceneGlobals.systemPath + 
media/programs/EarthLoQ.vert);



or should i check it self ?

3) Same question like 2 is for:

osg::ref_ptrosg::Image nrmlImage = 
osgDB::readImageFile(g_SceneGlobals.systemPath + 
media/textures/earth/normalmap.bmp);

If there will be new questions - i will post that here...
thanks!

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





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


Re: [osg-users] Lot of questions about OSG (Shaders)

2015-03-17 Thread Robert Osfield
Hi Andrey,

The only way to find out whether a shader will compile without problems is
to run a compile from a thread with a graphics context current.  You can't
do it from general threads.  This makes it awkward to weave loading code
with doing compile tests.

It is possible to do, much moving loading code into a graphics thread, or
simply running your application single threaded, single context and just
making the context current before you do any work.

Robert.

On 16 March 2015 at 07:50, Andrey Perper evillga...@bk.ru wrote:

 Hello..

 1)
 I just plan to perform something like that:


 Code:
 osg::ref_ptrosg::Shader EarthLoQVert =
 osgDB::readShaderFile(g_SceneGlobals.systemPath +
 media/programs/EarthLoQ.vert);

 if(EarthLoQVert.isCompiledOK)
 {
   create1..
 }
 else
 {
   osg::ref_ptrosg::Shader EarthLoQVertexLighting =
  osgDB::readShaderFile(g_SceneGlobals.systemPath + media/programs
 /EarthLoQVL.vert);

  if(EarthLoQVertexLighting.isCompiledOK)
 {
 create2
  }
  else
 {
 fatalError
  }
 }



 i need to know if my shader is compiled ok after loading!
 then i can create scene states, otherwise i load other shader and create
 other scene states

 thanks


 2) Are shaders with same names loaded single time ?


 Code:
 osg::ref_ptrosg::Shader EarthLoQVert =
 osgDB::readShaderFile(g_SceneGlobals.systemPath +
 media/programs/EarthLoQ.vert);

 osg::ref_ptrosg::Shader EarthLoQVert1 =
 osgDB::readShaderFile(g_SceneGlobals.systemPath +
 media/programs/EarthLoQ.vert);

 osg::ref_ptrosg::Shader EarthLoQVert2 =
 osgDB::readShaderFile(g_SceneGlobals.systemPath +
 media/programs/EarthLoQ.vert);



 or should i check it self ?

 3) Same question like 2 is for:

 osg::ref_ptrosg::Image nrmlImage =
 osgDB::readImageFile(g_SceneGlobals.systemPath +
 media/textures/earth/normalmap.bmp);

 If there will be new questions - i will post that here...
 thanks!

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





 ___
 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