Re: [osg-users] How to use osg::ShaderBinary

2017-07-24 Thread Julien Valentin
Hi
Shader binary formats are vendor specific.
You can retrieve it by hand with 

Code:
Program::ProgramBinary* 
Program::PerContextProgram::compileProgramBinary(osg::State& state);


but as it requires a proper context bound so you can't call it from an update 
callback.
Perhaps recording osg::Programs you wanna bake in a Camera PostDrawCallback can 
do the trick...
But I think the best way to generate them is offline using vendor sdk tools:

Here are list of OpenGL ES 2.0 SDK from some popular GPU vendors. It either 
includes offline GLSL shader compiler, or documentation about binary GLSL 
shaders :

ARM Mali OpenGL ES 2.0 SDK - used, for example, in Galaxy S II
Qualcomm Adreno SDK - used, for example, in Nexus One, HTC Desire, HTC 
Legend
ImgTec PowerVR Insider SDK - used, for example, in Galaxy Nexus, LG Optimus 
3D, Galaxy Tab

ARM Mali provides malisc executable that can compile shaders in command line on 
your host.

Qualcomm Adreno actually allows to get binary of GLSL shader at runtime using 
glGetProgramBinaryOES, but not offline. At least so says the docs in Adreno SDK.

PowerVR SDK also states that its GPU allows to get binary of GLSL shader during 
runtime using glGetProgramBinaryOES.

 


qiaokun wrote:
> Hi,
> 
> I want to know the use of 'osg::ShaderBinary'.
> 'osg:: ShaderBinary' is read from a binary file.
> I just don't know how to generate a binary shader file.
> Maybe use an offline shader compiler?
> I hope someone tell me if it is necessary to use 'osg::ShaderBinary' in 
> case of using a lot of shaders in a big project and how to use it. 
> Thank you!
> 
> Cheers,
> Qiaokun


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





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


Re: [osg-users] OpenGL

2017-07-24 Thread David Heitbrink
yes this is possible, but I am afraid its likely not going to be simple, 
depending on how much integration between the two you are looking for. 

Most likely the easiest path for you is to just create a OSG program, and 
create your python program, and use sockets 
(https://docs.python.org/2/howto/sockets.html), to have your python program 
tell your OSG program what to do. 

Other than that you can setup your c++ program to compile to a DLL, then call 
the C++ dll from Python, and have it create your OSG window, and handle 
everything OSG. Or you can progress further and look at say the MFC OSG 
example, assuming you are working in windows, and look at how the device 
context are used, and look to pass the DC between your python and c++ sides. 

I would just recommend making two separate programs, particularly if you are 
new to programming, or at least just to start with.

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





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


[osg-users] How to use osg::ShaderBinary

2017-07-24 Thread Qiaokun Lefei
Hi,

I want to know the use of 'osg::ShaderBinary'.
'osg:: ShaderBinary' is read from a binary file.
I just don't know how to generate a binary shader file.
Maybe use an offline shader compiler?
I hope someone tell me if it is necessary to use 'osg::ShaderBinary' in 
case of using a lot of shaders in a big project and how to use it. 
Thank you!

Cheers,
Qiaokun

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





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