What are the advantages of using osg-special parameters instead of those directly in the gl-state?

/Marcus

Andreas Zieringer wrote:
Hi Estee,

I fixed some bugs should work now there is also a new example testCGShader2.cpp in OpenSG/Source/Contrib/CGChunk

I renamed some parameters following are supported:

OSGProjection
OSGModelViewProjection
OSGTexture
OSGModelView
OSGModelViewI
OSGModelViewIT

Andreas

Hello all,

I read about some special parameters of OpenSG, OSGProjectionMatrix, OSGViewMatrix, etc. And I want to use it in my Cg program.

Instead using of glstate.matrix.mvp, I want to use OpenSG special parameters.

So I did belows.
First, I modified "checkOSGParameters" function in OSGCGChunk.cpp file because I did not call "updateProjectionMatrix" function. (Of course, I do rebuild and use new library.)

else if(parameter->getName() == "OSGProjectionMatrix")
{
    paramtercbfp fp = updateProjectionMatrix;
    _osgParametersCallbacks.push_back(fp);
}

And I registered some parameters before the "glutMainLoop" function.

_cgparameter->setUniformParameter("OSGProjectionMatrix", Real32(0.0));
_cgparameter->setUniformParameter("OSGViewMatrix", Real32(0.0));

Then, in my vertex program I added new uniform parameters and used it.

void C7E1v_reflection(float4 position : POSITION,
    float2 texCoord : TEXCOORD0,
    float3 normal   : NORMAL,

    out float4 oPosition  : POSITION,
    out float2 oTexCoord  : TEXCOORD0,
    out float3 R          : TEXCOORD1,

    uniform float3   eyePositionW,
    uniform float4x4 modelToWorld,
    uniform float4x4 OSGProjectionMatrix,
    uniform float4x4 OSGViewMatrix)

Instead of using glstate.matrix.mvp, I tried many cases with OpenSG special parameters like belows.

float4x4 modelViewProj = transpose(OSGProjectionMatrix)*transpose(OSGViewMatrix); float4x4 modelViewProj = OSGProjectionMatrix*OSGViewMatrix; float4x4 modelViewProj = transpose(OSGViewMatrix); float4x4 modelViewProj = OSGProjectionMatrix; But it seems it doesn't work. :(

If there is anybody who tried this already, please tell me what I'm wrong.
Thank you.


Best regards,
EsteeHS^µéšŠX¬²š'²ŠÞu¼ƒŠÇ(½êÄjÌ‹Š{±2(+jب+kj× ‰ë®‰ˆÁbÛ"š™^¶‡è–Z0F†™ªl²ÚÚŠm~Šðj·Z®Øœ•ë"ú+™«b½åžmƬ¶Æ§vj+xg­z÷«ÊØbž ¨ºwžvÚ zÛ©¶‹)yç_jËa¶Úý§l¢Çgr‰¿i؝¾í©e¡È^÷j)ÉrC©z{ ºÇ«²f¢–)à–+-:—§² ¬z»%ŠËl²‹«qçè®§zØm¶›?þX¬¶Ë(º·~Šàzw­þX¬¶ÏåŠËbú?¢—§² ¬ers=






-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to