Hi attach the full source code, perhaps someone can find a solution to this
problem. I dont have any clue for solving it.
Thanks,
J.
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8022#8022
osgprerender.rar
Description: Binary data
Hi,
I still cant get this working. I tried using getSteteSet instead of
GetOrCreateStateSet, but it returns a valid StateSet and when i get the texture
attribute list, its size is 1 (so i assume tha this is the texture unit im
looking for). After that i create the unifor using this texture
Hi Joseba,
sorry, I had no time to look into the problem. In my case, getStateSet returns
NULL, which means, if you call getOrCreateStateSet there will be new stateset
created. This means, that I do not have any texture attached to the StateSet,
which somehow strange, because you said that you
Hi all,
I'm trying to load a texture into a shader using a osg::Uniform. This shouldnt
be a problem, but when i load a model (cow.osg for example) and i try to use
a shader on it, the texture doesnt get loaded on the shader.
Here is the code for setting up the Uniform on the drawable's state
Joseba,
Shouldn't this:
gl_FragColor = vec4(texture2D( baseMap,*gl_TexCoord[0]*.st).xyz,
0.0);
be this?
gl_FragColor = vec4(texture2D( baseMap,*TexCoord*.st).xyz, 0.0);
David
___
osg-users mailing list
Hi Joseba,
in your code you do this:
Code:
osg::ref_ptrosg::Texture2D tex = dynamic_castosg::Texture2D*(
ss-getTextureAttribute( 0, osg::StateAttribute::TEXTURE ) );
hence you assume that your texture is bound to the stateset of the geode's
drawable. However this is not true in all cases,
Here is an small complete example (didnt check the headers and so):
Code:
#include osg/GLExtensions
#include osg/Node
#include osg/Geometry
#include osg/Notify
#include osg/MatrixTransform
#include osg/Texture2D
#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include
Yes, i was just trying to check if the tex coords were ok. The problem is not
that, i tried both possibilities, generating the tex coords on VS and passs
them to th FS and grabbing them directly in the fragment shader...
J.
--
Read this topic online here:
Hi Joseba,
Your mistake seems to be in your shaders. Let's examine:
// Vertex Shader
varying vec2 Texcoord;
void main( void )
{
gl_FrontColor = gl_Color;
gl_Position = ftransform();
Texcoord = gl_MultiTexCoord0.xy;
}
So here you're putting your texture coordinates into a
Thanks for the tip Art,
This still doesn't work. I can load the model withouth problems, but when i
attach a osg::Program to it, i still cant pass the texture to the shader
(although i can get the texture by code and see tha it has been loaded in the
Texture Unit 0). I also dont see much
Hi Joseba, Jean,
no the shader seems to be ok (or do you have changed it after submitting the
message?).
Nevertheless, the problem is in the wrong stateset. If you take a look into
cow.osg, then you see, that the Geode with the name cow.osg has a stateset
with applied texture. However the
Hi Art,
The main things is now to find out, why the StateSet is NULL although it is
defined in the cow.osg. It could be that there is a bug in the .osg loader,
however the bug could be also in the given example. I am looking forward to
solve it ;)
Perhaps the osgUtil::Optimizer is removing
Could you post some small example here, showing your problem?
cheers,
art
--
Read this topic online here:
http://osgforum.tevs.eu/viewtopic.php?p=6080#6080
___
osg-users mailing list
osg-users@lists.openscenegraph.org
13 matches
Mail list logo