I dunno bout the internals of these, but I made it work with explictily
defining the cube sampler like this
{
osg::Uniform* u = new
osg::Uniform(osg::Uniform::SAMPLER_CUBE,"cubeMapUnit");
u->set(unit);
node->getOrCreateStateSet()->addUniform( u );
}
Nick
http://www.linkedin.com/in/tnick
On Tue, Jan 26, 2010 at 12:58 AM, Trajce Nikolov
<[email protected]>wrote:
> Hi,
>
> can some of the gurus have a look at this, it will help a lot ..... The
> hack done is not working in my app which uses shader heavely
>
> Thanks a bunch
>
> Nick
>
> http://www.linkedin.com/in/tnick
> Sent from Löhne, North Rhine-Westphalia, Germany
>
> On Mon, Jan 25, 2010 at 6:14 PM, Trajce Nikolov
> <[email protected]>wrote:
>
>> well, I think I dont understand it
>>
>> I commented in the texgen part, so the texture coords are the uvs from the
>> shape drawable, for the texture2D, and these are gl_TexCoord[0].
>> the uvs for the reflection are generated in the shader, gl_TexCoord[1].
>>
>> now, from the code, the textures are switched, texture0 is assigned to
>> unit 1, and the cubemap to unit 0
>>
>> The code works now, but how????
>>
>> Nick
>>
>> http://www.linkedin.com/in/tnick
>> Sent from Haguenau, Alsace, France
>>
>> On Mon, Jan 25, 2010 at 5:23 PM, Trajce Nikolov <[email protected]
>> > wrote:
>>
>>> This is interesting .. You made it work :) ....
>>>
>>> Nick
>>>
>>> http://www.linkedin.com/in/tnick
>>> Sent from Haguenau, Alsace, France
>>>
>>> On Mon, Jan 25, 2010 at 3:46 PM, J.P. Delport <[email protected]>wrote:
>>>
>>>> Hi Nick,
>>>>
>>>> another interesting thing...
>>>>
>>>> I swapped the texture units: pass unit 0 to createShadowedScene() and
>>>> make texture0 attached to unit 1 (and update uniforms accordingly). Then
>>>> there is sky blended into the middle sphere. Maybe texgennode ignores
>>>> settextureunit?
>>>>
>>>> jp
>>>>
>>>> Trajce Nikolov wrote:
>>>>
>>>>> Hi JP,
>>>>>
>>>>> based on your screenshot, I can see it doesnt work. The texture0 is
>>>>> missing (sky.jpg). On the screen shot only the cubemap is rendered. That
>>>>> is
>>>>> what I am experiencing as well. So, no driver bug ???? Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Hermosa Beach, California, United States
>>>>>
>>>>> On Mon, Jan 25, 2010 at 3:07 PM, J.P. Delport
>>>>> <[email protected]<mailto:
>>>>> [email protected]>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>> Trajce Nikolov wrote:
>>>>>
>>>>> Hi JP,
>>>>>
>>>>> it is important to have the texture lookups instead of setting
>>>>> some values for the shaders in the code. Mix works in general,
>>>>> so when you setup values in the shader you get proper results.
>>>>> But when you do a lookup for a 2D texture and CubeMap generated
>>>>> on the fly, it doesnt work.
>>>>>
>>>>>
>>>>> yes, I understand and that's what I did, sorry for the confusion. I
>>>>> placed static values just to quickly see what parts of the scene are
>>>>> affected by the shader, then switched back to your original code in
>>>>> the email. Just in case, here is a screenshot too :) (Forget about
>>>>> the vsync lines...)
>>>>>
>>>>> jp
>>>>>
>>>>>
>>>>> Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Hermosa Beach, California, United States
>>>>>
>>>>> On Mon, Jan 25, 2010 at 2:20 PM, J.P. Delport
>>>>> <[email protected] <mailto:[email protected]>
>>>>> <mailto:[email protected] <mailto:[email protected]>>>
>>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>>
>>>>> Trajce Nikolov wrote:
>>>>>
>>>>> Hi Jp.
>>>>>
>>>>> so you are saying you see the images blended .... but
>>>>> still
>>>>> getting a warning. That is good result. I guess this
>>>>> points to
>>>>> be really a driver issue.
>>>>>
>>>>>
>>>>> yes, I was not sure what to expect, so I output frag colour
>>>>> 1,1,1,1
>>>>> and then changed back to your mix and saw the blended image
>>>>> on the
>>>>> center sphere (changing the mix factor changes the center
>>>>> sphere for
>>>>> me).
>>>>>
>>>>> Yes, not sure what the warning is about. Attached a log with
>>>>> notify=debug. The location of the warning is a bit strange.
>>>>>
>>>>> jp
>>>>>
>>>>>
>>>>> Thanks for finding a time to test this!
>>>>>
>>>>> Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Kordel, RP, Germany
>>>>>
>>>>> On Mon, Jan 25, 2010 at 9:19 AM, J.P. Delport
>>>>> <[email protected] <mailto:[email protected]>
>>>>> <mailto:[email protected] <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]> <mailto:[email protected]
>>>>> <mailto:[email protected]>>>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> seems to work on Linux 32-bit NVidia GeForce Go 7400,
>>>>> driver
>>>>> 190.53.
>>>>> Also same on GTS250, driver 190.53. I've tried
>>>>> different
>>>>> factors and
>>>>> it made a change in the output. I do get:
>>>>>
>>>>> Warning: detected OpenGL error 'invalid operation' at
>>>>> After
>>>>> Renderer::compile
>>>>>
>>>>> on both machines.
>>>>>
>>>>> jp
>>>>>
>>>>> Trajce Nikolov wrote:
>>>>>
>>>>> Here is attached code ... Would really appreciate
>>>>> if some
>>>>> take
>>>>> couple of minutes to have a look
>>>>> Thanks a lot
>>>>> Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Devlet, Ankara, Turkey
>>>>>
>>>>> On Sat, Jan 23, 2010 at 11:44 PM, Trajce Nikolov
>>>>> <[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected] <mailto:
>>>>> [email protected]>>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>>>> wrote:
>>>>>
>>>>> I am also getting this warning
>>>>> Warning: detected OpenGL error 'invalid
>>>>> operation' at
>>>>> after
>>>>> RenderBin::draw(..)
>>>>>
>>>>> Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Devlet, Ankara, Turkey
>>>>>
>>>>> On Sat, Jan 23, 2010 at 9:50 PM, Trajce Nikolov
>>>>> <[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected] <mailto:
>>>>> [email protected]>>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>>>> wrote:
>>>>>
>>>>> Hi guys,
>>>>>
>>>>> this might sound stupid but., I am trying
>>>>> to mix two
>>>>> values in
>>>>> the fragment shader. Can not blend them
>>>>> together
>>>>> no mater
>>>>> what.
>>>>> I try "manual" blending, but still the
>>>>> results are
>>>>> as for
>>>>> only 1
>>>>> and 0 blend factor. NOthing in between,
>>>>>
>>>>> Here is the shader. Any clue?
>>>>>
>>>>> "varying vec4 uv; \n" //
>>>>> "uniform sampler2D colorMap; \n" //
>>>>> "uniform samplerCube cubeMap; \n" //
>>>>> "const float reflect_factor = 0.5; \n" //
>>>>> "void main( void ) \n" //
>>>>> "{
>>>>> \n" //
>>>>> " vec3 base_color = texture2D(colorMap,
>>>>> gl_TexCoord[0].xy).rgb;
>>>>> \n" //
>>>>> " vec3 cube_color = textureCube(cubeMap,
>>>>> uv.xyz).rgb; \n" //
>>>>> " gl_FragColor = vec4( mix(base_color,
>>>>> cube_color,
>>>>> reflect_factor), 1.0); \n" //
>>>>> "}
>>>>>
>>>>> Nick
>>>>>
>>>>> http://www.linkedin.com/in/tnick
>>>>> Sent from Devlet, Ankara, Turkey
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>>
>>>>>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>> -- This message is subject to the CSIR's copyright
>>>>> terms and
>>>>> conditions, e-mail legal notice, and implemented Open
>>>>> Document
>>>>> Format (ODF) standard. The full disclaimer details can
>>>>> be
>>>>> found at
>>>>> http://www.csir.co.za/disclaimer.html.
>>>>>
>>>>> This message has been scanned for viruses and
>>>>> dangerous
>>>>> content by
>>>>> MailScanner, and is believed to be clean. MailScanner
>>>>> thanks
>>>>> Transtec Computers for their support.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>>
>>>>>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>> -- This message is subject to the CSIR's copyright terms
>>>>> and
>>>>> conditions, e-mail legal notice, and implemented Open
>>>>> Document
>>>>> Format (ODF) standard. The full disclaimer details can be
>>>>> found at
>>>>> http://www.csir.co.za/disclaimer.html.
>>>>>
>>>>> This message has been scanned for viruses and dangerous
>>>>> content by
>>>>> MailScanner, and is believed to be clean. MailScanner thanks
>>>>> Transtec Computers for their support.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[email protected]>
>>>>> <mailto:[email protected]
>>>>> <mailto:[email protected]>>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[email protected]>
>>>>>
>>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>>
>>>>>
>>>>> -- This message is subject to the CSIR's copyright terms and
>>>>> conditions, e-mail legal notice, and implemented Open Document
>>>>> Format (ODF) standard. The full disclaimer details can be found at
>>>>> http://www.csir.co.za/disclaimer.html.
>>>>>
>>>>> This message has been scanned for viruses and dangerous content by
>>>>> MailScanner, and is believed to be clean. MailScanner thanks
>>>>> Transtec Computers for their support.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> osg-users mailing list
>>>>> [email protected]
>>>>> <mailto:[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
>>>>>
>>>>
>>>> --
>>>> This message is subject to the CSIR's copyright terms and conditions,
>>>> e-mail legal notice, and implemented Open Document Format (ODF) standard.
>>>> The full disclaimer details can be found at
>>>> http://www.csir.co.za/disclaimer.html.
>>>>
>>>> This message has been scanned for viruses and dangerous content by
>>>> MailScanner, and is believed to be clean. MailScanner thanks Transtec
>>>> Computers for their support.
>>>>
>>>>
>>>> _______________________________________________
>>>> 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