[osg-users] Problem with shadow2D

2013-04-21 Thread Peterakos
Hello.

I try to implement shadowmapping for my scenes but i cant get shadow2D to work.

Here are the parts of code for shadowmapping using texture2D:

Vertex shader

shadow_coords  =  light_projection * light_view * vertex;
shadow_coords.xy = shadow_coords.xy / 2.0 + 0.5 * shadow_coords.w;
shadow_coords = shadow_coords / shadow_coords.w;

//linear z clamped in [0,1], same function is used in Depth pass to
write the Z in depth buffer
shadow_coords.z = getLinearDepth(light_view, vertex, light_near, light_far);


Fragment shader

vec4 shadowmap_color = texture2D(light_depth_texture, shadow_coords.xy);
float shadowmap_depth = shadowmap_color.r;


if ( shadow_coords.z - 0.005  shadowmap_depth)  {
//shadowed
}

First of all everything works.

But when i change sampler2D to sampler2DShadow and texture2D to
shadow2D it doesnt work.
Here is where i create the depth buffer (shadow comparison is enabled
for shadow2D):

Texture2D* createDepthTexture(int width, int height){
Texture2D* texture2d = new osg::Texture2D;
texture2d-setTextureSize(width,height);

texture2d-setInternalFormat(GL_DEPTH_COMPONENT24);
texture2d-setSourceFormat(GL_DEPTH_COMPONENT);
texture2d-setSourceType(GL_UNSIGNED_BYTE);
texture2d-setShadowComparison(true);

texture2d-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);
texture2d-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
texture2d-setBorderColor(osg::Vec4(1,0,0,1));

texture2d-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);
texture2d-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::NEAREST);

return texture2d;
}

In texture sampling, shadow2D returns always 0:
float shadowmap_dif = shadow2D(light_depth_texture,
vec3(shadow_coords.xy, shadow_coords.z - 0.005));

Is there anything else i have to change to make it work ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Hardware animation problem

2013-03-17 Thread Peterakos
Hello.

I try to animate a model using RigTransformHardware.

The comments in createVertexAttribList() of RigTransformHardware.cpp say:

// create vertex attribute by 2 bones
// vec4(boneIndex0, weight0, boneIndex1, weight1)
// if more bones are needed then other attributes are created
// vec4(boneIndex2, weight2, boneIndex3, weight3)
// the idea is to use this format to have a granularity smaller
// than the 4 bones using two vertex attributes

(in each attribute, 2 bones are stored)

Nevertheless, skinning.vert doest appear to use attributes with the right way.

Here is the computeAcummulatedNormalAndPosition function in
skinning.vert as used in  osganimationhardware example.

void computeAcummulatedNormalAndPosition(vec4 boneWeight)
{
int matrixIndex;
float matrixWeight;
for (int i = 0; i  2; i++)
{
matrixIndex =  int(boneWeight[0]);
matrixWeight = boneWeight[1];
mat4 matrix = matrixPalette[matrixIndex];
// correct for normal if no scale in bone
mat3 matrixNormal = mat3(matrix);
position += matrixWeight * (matrix * gl_Vertex );
normal += matrixWeight * (matrixNormal * gl_Normal );

boneWeight = boneWeight.zwxy;
}
}

The first thing i notice is that the  variable i in for loop isnt used
anywhere. But it seems the  first 2 lines in this for loop should be
matrixIndex =  int(boneWeight[ i + 0 ]);
matrixWeight = boneWeight[ i + 1 ];

The point is the first case works and the second doesnt.

In the end i use the first case, but i thought i should mention it.

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


[osg-users] Problem loading RGBA bmp.

2013-03-12 Thread Peterakos
Hello.

I try to load a bmp image and set it to a texture.
When i render the model with the texture (using shaders), even though
the rgb channels are passed fine, the alpha channel is always 1.
When the image is loaded (using readImageFile),  the pixel format is
GL_RGBA (which is correct).
But the internal format is 4, which i cant find where it corresponds.

What do i have to do to read the alpha channel ?

I attach only the alpha channel of the RGBA image (as separate png).

Thnx.
attachment: AlphaChannel.pngattachment: channels.png___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [osgPPU] osgPPU with GL3

2013-02-24 Thread Peterakos
Hello.

Not sure what you mean abandoned, but it works for me.
I have run some of the osgPPU examples.

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


[osg-users] Camera Manipulator problem

2013-02-18 Thread Peterakos
Hello.

I try to make my own camera manipulator in which the push events with
X lower than the half of the window will be ignored.

I created a class, which derives trackball manipulator.
Here is the handle method

virtual bool handle( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter us )   {
if (ea.getEventType() == osgGA::GUIEventAdapter::PUSH 
isInBounds(ea.getX(), ea.getY())) {
return true;
}
return osgGA::TrackballManipulator::handle(ea, us);
}

Even though I return true (which means i dont want further handle), it
keeps taking into account the event.

Is there anything wrong with the code above ?

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


Re: [osg-users] Low frame rate for one animated character.

2013-02-16 Thread Peterakos
Edit  for the last question:
If i face such difficulties with only 1 character, how do the modern
3D action games work ?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Higher render precision in render camera.

2013-02-10 Thread Peterakos
Hello.

I use a shader to write the depth value of a model as color in screen
using  gl_FragColor = vec4(depth, depth, depth , 1).
But it seems it renders the model with only 8-bit per channel precision.

Can i change that behavior of the main camera (to 32-bit per channel)?

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


Re: [osg-users] Retrieve Wold matrix while animating

2013-02-01 Thread Peterakos
Hello.

I try to obtain the world matrices using getWorldMatrices.

The graph is :

Group
  Group
   MatrixTransform

The object uses the following matrix as Matrix Transform:
1 0 0 0
0 1 0 0
0 0 1 2.5
0 0 0 1

But i still get 3 identity matrices.
When i add the object in scene, its position is correct +2.5 to z axis.
How can i obtain the world matrix of an object ?

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


Re: [osg-users] Retrieve Wold matrix while animating

2013-01-30 Thread Peterakos
Hello.

Thank you for your answer, but there is a problem.
In the first pass algorithm, the value osg_ViewMatrixInverse is wrong.
It corresponds to the main camera instead of the RTT camera i use.

The variable gl_ModelViewMatrix is correct though. Any idea of what i
can do to pass the correct value to osg_ViewMatrixInverse ?
I use glsl 1.2.

thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgFX::Registry::Proxy proxy

2013-01-24 Thread Peterakos
Hello and thank you for your answer.

Why do i have to register the effect?
When i remove this line nothing is changed.

Isnt the following enough ?
ref_ptrMyEffect effect = new MyEffect(model.get());
effect-addChild(model.get());
group-addChild(effect);

The model has to be passed to MyEffect's constructor, because it is
needed to initialize technique's passes.

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Retrieve Wold matrix while animating

2013-01-22 Thread Peterakos
Hello.

I try to create a multi pass algorithm and i am stuck.
I use my own view and projection matrix for an absoluted positioned camera.
But i cant figure out how to handle the World matrix.
Glsl gives me gl_ModelViewMatrix but i need only the model matrix for
the current vertex being processed.

How can i retrieve it in osg and pass it in the shader as uniform ?

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


[osg-users] osg coordinate system

2012-12-28 Thread Peterakos
Hello.

Osg uses a coordinate system in which the +y axis goes into the screen
and +z axis goes up.
Does this default matrix affects the model matrix of each object on
the scene or the view matrix of all the cameras ?
I wish i could remove this behavior.

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


Re: [osg-users] Draw shadow map to quad problem.

2012-12-21 Thread Peterakos
Hello.

It was my mistake because i forgot that gl_TexCoord[0] was vec4.
I should use gl_TexCoord[0].xy.

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


[osg-users] Draw shadow map to quad problem.

2012-12-20 Thread Peterakos
Hello.

I have a camera which renders to osg::Camera::DEPTH_BUFFER using
camera-attach(osg::Camera::DEPTH_BUFFER, texture);

Here is how i create the texture:
texture-setInternalFormat(GL_DEPTH_COMPONENT);
texture-setSourceFormat(GL_DEPTH_COMPONENT);
texture-setSourceType(GL_UNSIGNED_BYTE);
texture-setShadowComparison(false);


My Model draws to this texture in fragment shader using : gl_FragDepth
= gl_FragCoord.z;

After that i render this texture to a quad in fragment shader using
uniform sampler2D depth_texture;
void main(){
  float depth = texture2D(depth_texture, gl_TexCoord[0]).r;
  gl_FragColor = vec4(depth, depth, depth , 1.0);
}


The problem is that i get the 2 following errors and i cant figure out
where the problem is caused.
error1: 'texture2D' : no matching overloaded function found (using
implicit conversion)
error2: 'r' : field selection requires structure , vector or matrix on
left hand side.

What do i do wrong ?

Any help would much appreciated.
Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Use many effect on the same model

2012-12-16 Thread Peterakos
Hello.

Thank you for your answer but it seems it doesnt work because with
this graph we have 2 models in the scene (one on top of each other)
I want my model to be affected by both effects (only 1 model in the scene).

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


[osg-users] Use many effect on the same model

2012-12-15 Thread Peterakos
Hello.

I want to use 2 different effects on the same model but i am not sure
if this is possible.
I have 2 multi pass render algorithms implemented in 2 different effects.
Can i have the following graph ?

Effect1
   Effect2
   Model

Knowing that the child's state overrides the parent's, i would say
that you cant use 2 different programs one
after another on the same model unless you use both on the same effect.

Any idea of how i can achieve this ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Texture internal and source format questions

2012-12-14 Thread Peterakos
Hello.

Lets say i have a texture which stores the depthmap.

1) Is the following correct ?
texture2d-setInternalFormat(GL_DEPTH_COMPONENT16);
texture2d-setSourceFormat(GL_DEPTH_COMPONENT);
texture2d-setSourceType(GL_UNSIGNED_SHORT);


2) Why do we need do initialize both internal format and source format
if we are not going to use
any image ?

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


[osg-users] osgShadow::ShadowMap troubles

2012-12-13 Thread Peterakos
Hello.

I have some questions based on osgSHadow::ShadowMap

1)  I try to use the makeDebugHUD from ShadowMap class with
hudCamera-setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR),
but
it doesnt work because in a scene with a movable cessna and a
non-movable truck, the truck's shadow is moving. Which means the
bounding box is
being changed as the cessna is flying around. how can i fix that?

2)  There is also a flickering effect that osgShadow::ShadowMap
creates. Is ShadowMap well implemented or is it just a example to show
how to use the ShadowScene ? The flickering effect can be noticed in
osgShadow example.

3)  I want to use ShadowMapping in a multi pass render technique and i
need to use the depth map of ShadowMap's camera in the first pass.
In each pass i use a different RTT Camera with a model as a child.
How should the scene graph be organized ?

At the moment i use the following graph
MyEffect
Model

with each rtt camera being:

Camera
Model

Is it correct to make it like the following ?

MyEffect
ShadowScene
Model

with each rtt camera being:

Camera
ShadowScene
Model


As alternative for the third question, i am thinking of instead of
using ShadowScene, to place a camera watching the model from
different position (light's position).
The very first pass will be to obtain the depth map from that camera
and the second pass to implement my own shadow algorithm. Then, the
already existed passes will follow.
Is this approach correct ?

Thank you for your time and sorry for the long post.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Depthmap from light's point of view

2012-12-12 Thread Peterakos
Hello.

Lets say there is cessna as a child in LightSource group.
LightSource has 1 light.

What i want to do is to get the depth map from light's point of view.
How can i do this ?

I am thinking of placing a Camera as a child in LightSource.
This camera will look at exactly the same direction as the light and
will also has the same position.
Is this the right way to do it ?

( I know how to make camera render to texture)

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Tutorials

2012-12-05 Thread Peterakos
Hello

Here are the books + quick guide:
http://www.openscenegraph.com/index.php/documentation/books

And you can also download the source code of many examples using svn:
http://www.openscenegraph.com/index.php/downloads/code-repositories

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


[osg-users] RigTransformHardware skinning on DAE models

2012-11-28 Thread Peterakos
Hello.

I use the default RigTransformHardware for skinning on a dae Model
with skeleton.
My model consists of 4 RigGeometries (image 1). The number of bones
per vertex is 7, 2, 20 and 15 respectively.
After enabling the OSG_NOTIFY as INFO i see that it creates vec4
boneWeightX attributes based on the 4 previous numbers
(num_of_bones/2).

The vertex shader i use for skinning is the following:

#version 120

attribute vec4 boneWeight0;
attribute vec4 boneWeight1;
attribute vec4 boneWeight2;
attribute vec4 boneWeight3;

uniform int nbBonesPerVertex;
uniform mat4 matrixPalette[MAX_MATRIX];

vec4 position;

void computeAcummulatedNormalAndPosition(vec4 boneWeight){
int matrixIndex = int(boneWeight[0]);
float matrixWeight = boneWeight[1] ;
mat4 matrix = matrixPalette[matrixIndex];
position += matrixWeight * (matrix * gl_Vertex );
}

void main( void ){
position =  vec4(0.0,0.0,0.0,0.0);

if (nbBonesPerVertex  0)   
computeAcummulatedNormalAndPosition(boneWeight0);
if (nbBonesPerVertex  2)   
computeAcummulatedNormalAndPosition(boneWeight1);
if (nbBonesPerVertex  4)   
computeAcummulatedNormalAndPosition(boneWeight2);
if (nbBonesPerVertex  6)   
computeAcummulatedNormalAndPosition(boneWeight3);

gl_Position = gl_ModelViewProjectionMatrix * position;
}


The problem is that when i try to use all the boneWeight attributes it
creates (which are 10), the model breaks (image 2).
On the other hand the code above (with only 4 attributes) works like
the RigTransformSoftware.

On a different high detail model (which creates 25 bone weight
attributes max), i get the following results:
-With only the first 4 attributes: the model is broken and animated
-With all the attributes: the model is correct but there is no animtion.


Can anyone help me through this ?
Is this behavior normal?

I also get a lot of Warning: detected OpenGL error 'invalid value'
after RenderBin::draw()

Thank you for your time and sorry for the long post.
attachment: 4 attributes.pngattachment: 10 attributes.png___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] problem with shader loader

2012-11-27 Thread Peterakos
Hello.

Inside OpenSceneGraph-Data i have create a folder with name mydata.
Even though the line:
ref_ptrNode node = osgDB::readNodeFile(mydata/model.dae);
loads the model, i cannot load shader files from the same directory.
The call shader-loadShaderSourceFromFile(fileName) fails.

The same happens with osganimationhardware example. It finds
nathan.osg, but not shaders/skinning.vert.

Do i do something wrong ?
Never had any problem loading models from openscenegraph-data.

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


Re: [osg-users] Problem with high detailed model with skinning.

2012-11-22 Thread Peterakos
Hello.

Thank you for your answer. I use collada format. I have run the model
using the osganimationviewer example.

i will try what you wrote.

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


Re: [osg-users] Export 3ds max to *.osg or *.dae.

2012-11-21 Thread Peterakos
Edit second sentence:
Now i try to use it in OSG.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Problem turning off the lights with override

2012-11-20 Thread Peterakos
Hello.

I try to turn off the lights in my scene using the following code but it fails.
group-getOrCreateStateSet()-setMode(GL_LIGHTING,
osg::StateAttribute::OFF || osg::StateAttribute::OVERRIDE );

When i use this though, the lights are turned off successfully.
group-getOrCreateStateSet()-setMode(GL_LIGHTING, osg::StateAttribute::OFF  );

What's wrong with the first one ?
group has only 1 child with the default value in lighting mode.

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


Re: [osg-users] Change uniform array size

2012-11-16 Thread Peterakos
Hello.

I try to create an algorithm which uses a configurable number of samples:
uniform vec3 sample_kernel[256];
When i use value higher than 502, i get some errors which probably
refer to my GPU (gtx 650).
It seems gl_MaxFragmentUniformComponents is 2048.

I try to use
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, value);
but i dont get the correct value.

In case I use a fixed size of samples and just pass as uniform the
number of samplesi  want to be checked, won't it affect the
performance ?
I mean having a large array of samples while i need the half.

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with TBN matrix

2012-11-12 Thread Peterakos
Hello.

I use this method: http://www.john-chapman.net/content.php?id=8 for ssao pass.
For each fragment i create a hemisphere of samples. This hemisphere is
oriented based on fragment's normal, which means
the samples have to be oriented based on normal too.

The problem is that i cant be sure for correctness. If i use more
samples, the grey artifacts tend to disappear.
I also use blur for more smooth results.

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


Re: [osg-users] problem with linear depth in fragment shader

2012-11-08 Thread Peterakos
Not sure if the different levels of depth are distinguishable in first image.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem with perspective and depth value

2012-11-07 Thread Peterakos
Hello again.

Forgot to mention this picture is the result of

float depth_value = gl_FragCoord.z;
gl_FragData[0] = vec4(depth_value, depth_value, depth_value, 1);
This is how i try to export the depth texture.

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


Re: [osg-users] how does osg call opengl's api

2012-10-20 Thread Peterakos
Hello.

I assume you have the code of OSG.
Go to svn\OpenSceneGraph\src directory and search all *.cpp files for the
gl function you want.

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


[osg-users] osgFX::Registry::Proxy proxy

2012-10-19 Thread Peterakos
Hello.

What osgFX::Registry::Proxy proxy(new MyEffect); does ?
Couldnt find any reference anywhere. i see it is used in predefined Effects
like Outline.

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


[osg-users] Window stucks while using 2 pass technique

2012-10-16 Thread Peterakos
Hello.

I add to the viewer the following scene graph:

Group
   MyEffect
 Model
   MyCamera
 Model

The effect uses a 2 pass technique.
In the first pass i render to texture the contents of color buffer 0 using
MyCamera.
In the second pass, i use the previous texture and i render MyModel using a
shader.

The effect overrides

osg::Node* getOverrideChild(int pass_num){
if (pass_num == 0) {
return MyCamera;
}
return NULL;
}



The problem is that the window cannot respond to mouse events and it stucks.
Has anyone faced this problem before ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] slave camera render to texture.

2012-10-14 Thread Peterakos
Hello.

My task is to have 2 cameras being exactly the same.
The first one will render to my window and the second one to texture.

First i tried to create a camera as child to scene data and add the same
model as child.
So i used the following code:

Viewer viewer;
Camera* camera = new Camera(*viewer.getCamera(), CopyOp::DEEP_COPY_ALL);
ref_ptrImage image = new Image();
image-allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE);
camera-setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
camera-attach(Camera::BufferComponent(Camera::COLOR_BUFFER0), image.get());
camera-setPostDrawCallback(new MyCameraPostDrawCallback(image.get()));

The post callback will writes image to file.
I couldnt make it work and i have no idea why. All i see in the texture is
an empty scene.
What more should i do ?

After that i decided to use slave camera. I noticed that i had to use 2
different graphics context.
But the problem is that i dont want the second window to appear.
What configuration should i pass to the second context to not appear any
window ?
I assume is something based on WindowingSystemInterface but i couldnt find
what exactly.

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Render to texture and write image to file.

2012-10-13 Thread Peterakos
Ok found it... I just had to write to image in post camera callback...
nothing more.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] FBO and source formats

2012-10-11 Thread Peterakos
Hello.

First of all sorry if the next question is dumb but i couldnt find it
anywhere.

I use camera-attach(osg::Camera::COLOR_BUFFER0, textureColor); in my
program.
It works only if the texture's source format is GL_RGBA.
As i read in setSourceFormat's comment: Sets the external source image
format

Is FBO considered image ?

As it seems i dont have to use setSourceType for the texture. But the
default source type for the texture is 0.
Why is it working ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Texture coords in osgmultiplerenderingtargets.

2012-10-10 Thread Peterakos
Hello.

in the example  osgmultiplerenderingtargets, why are the texture
coordinates initialized as:

0, 0
tex_width, 0
tex_width, tex_height
0, tex_height

instead of

0,1
1,0
1,1
0,1

(the result is different)

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] COLOR_BUFFER and COLOR_BUFFER0

2012-10-10 Thread Peterakos
Hello.

What's the difference between COLOR_BUFFER  and COLOR_BUFFER0 ?
In case i want to use COLOR_BUFFER0 in frag shader, i use gl_FragData[0].
What about COLOR_BUFFER  ?

And last question, in case i dont use FBO, why writting gl_FragData[0] to
fragment shader gives us the correct result ?

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


[osg-users] Normalmap with osgPPU

2012-10-09 Thread Peterakos
Hello.

Is it possible to retrieve the normal map using osgPPU ?
I have used the following shaders and a blue screen appears.

Vert
---
varying vec3 normal;
void main(void){
gl_Position = ftransform();
normal =  gl_NormalMatrix * gl_Normal;
}

Frag
---
varying vec3 normal;
void main(){
gl_FragColor = vec4(normal,1);
}


I guess the blue color means that the normal.z is always 1.


In some examples in osgPPU solution, i have noticed that vertex shaders are
used.
Which vertices are passed through these shaders ? All of the scene's
vertices or just the ones that are visible ?

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


[osg-users] Difference between osgFX and osgPPU

2012-10-08 Thread Peterakos
Hello.

Is there any difference between these 2 or are they different
implementations for the same purpose ?
For someone who wants to support multi passes (using shaders) on model
nodes which is better ?

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


Re: [osg-users] osg::PPU texel 0,0 in depthbuffer is wrong

2012-10-05 Thread Peterakos
Hello.

This is what i use for depth texture creation:

osg::Texture2D* texture2D = new osg::Texture2D;
texture2D-setTextureSize(tex_width, tex_height);
texture2D-setInternalFormat(GL_RGBA);
texture2D-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture2D-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture2D-setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
texture2D-setWrap( osg::Texture::WRAP_R, osg::Texture::REPEAT );
texture2D-setInternalFormat(GL_DEPTH_COMPONENT);

I have also attached an image which shows that the fragment shader result.
If you watch closely in the middle, you will notice that the image is
separated into 4 pieces.

What i do is creating a UnitInOut which receives the depth buffer and
writing each pixel result to gl_FragData[0].
As you can see in the picture, i paint as red the pixels which have depth
value 1.
But when i access these pixels while another pixel is being iterated, i get
different depth value.

Why is this happening ?

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


[osg-users] osgPPU::Processor and other root's children traversing order

2012-10-03 Thread Peterakos
Hello.

I am working on osgPPU but there are some things i haven't completely
understood yet.
I add 2 children in root's group.

A cow model and the osgPPU::Processor.
In processor i have added 1 child which outputs the depth buffer and under
that child i have added 1 child which outputs to frame buffer.

I have noticed that the order of
root-addChild(loadedModel);
root-addChild(ppu);
doesnt matter and i am wondering why.


UnitCameraAttachmentBypass needs the depth buffer which is taken from
camera. But if ppu is rendered first (as first child) there will be no
depth buffer to output
to frame buffer (through UnitCameraAttachmentBypass's child, which is
UnitOut).

Why is this happening ? do i miss something?

The scene graph is the following

root
   ppu
   UnitCameraAttachmentBypass (outputs Depth)
  UnitOut
   loadedModel


Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osg::PPU , Texture unit associated with depth buffer

2012-10-03 Thread Peterakos
Hello

In osgppu_ssao project in simple.h file, there are the following lines:

shader-add(originalDepthTexture, osg::Uniform::SAMPLER_2D);
shader-set(originalDepthTexture, 1);

Where is the depth texture associated with texture unit 1 ?
i couldnt find it anywhere.

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


Re: [osg-users] OpenGL context and wglGetProcAddress

2012-09-18 Thread Peterakos
Thank you very much.

it worked.
I added the init function of the widget toolkit in the callback.

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


[osg-users] OpenGL context and wglGetProcAddress

2012-09-17 Thread Peterakos
Hello.

I am trying to use an external widget library in osg.
This library tries to load the opengl functions during initialization using
wglGetProcAddress.

This procedure works in opengl but not in open scene graph. It fails for
functions in gl 1.2 and later.
I found this: The Microsoft Windows DLL opengl32.dll only directly
exposes *OpenGL
1.1* functions. To gain access to functions from higher GL versions, you
must load these function pointers manually with wglGetProcAddress.

So the library cant load the functions using wglGetProcAddress.

Is there any reason for that happening ?


Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgsimplegl3 with opengl 3.2

2012-09-15 Thread Peterakos
Hello.

The example osgsimplegl3 sets glcontext version to 3.1.

I load cow.osg and i get the following warnings :
warning: texgen::apply not supported
warning: material::apply not supported

When i set version to 3.2  the cow model is not rendered and i get the
previous warnings plus the following :
Warning: detected opengl error invalid enumerant at after
RenderBin::draw(...).

What can i do to solve both problems?

thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgsimplegl3 with opengl 3.2

2012-09-15 Thread Peterakos
Hello.

I have managed to solve the problem with the 2 warnigs (by removing
materials and shades from cessna.osg.

Still cant solve the invalid enumerant. I use osgsimplegl3 as it is but
with more simple shaders and seting version to 3.2


Vertex
--
#version 150
uniform mat4 osg_ModelViewProjectionMatrix;
in vec4 osg_Vertex;
void main(){
gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex;
}



Frag
---
#version 150
out vec4 fragData;
void main(){
fragData = vec4(1,0,0,1);
};


What can possibly cause this problem ?
Has anyone run osgsimplegl3 example using opengl 3.2 ?

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


[osg-users] drawImplementation in every frame

2012-09-14 Thread Peterakos
Hello.

I create a class which inherits from drawble and i implement the
drawImplenetation method.
But as it seems it is called only once at start.

I want it to be called in every frame.
Do i have to create a DrawCallback and set it to Drawable ?

and what would the Drawable::drawImplementation contain if i implement the
drawing code in DrawCallback::drawImplemenetation ?

thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Opengl 3

2012-09-12 Thread Peterakos
Hello.

I did exactly what's written in comments in osgsimplegl3, except teh
CMAKE_CXX_FLAGS thing.
I created the solution, built it and worked fine except for 2 projects
which concern QT.
I managed to ran the osgsimplegl3.
The only thing i did with the gl3/gl3.h is to add this path in visual
studio's include path.

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


Re: [osg-users] Opengl 3

2012-09-12 Thread Peterakos
Hello

These error i posted in my first post gave me a hard time. Even though I
tried everything to make them disappear they simple didnt.
I even tried to delete the whole OpenScenegraph/build directory and build
everything from scratch. But they were still there.

After that i deleted everything that had to do with openscenegraph and
build everything again. Only then they disappeared (i used the same
settings in cmake that i was using before). I cant explain it.

So now I build open scene graph with the open gl 3 cmake settings and i run
osgsimplegl3 with no problems (except for the 2 projects that relate with
qt).

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Opengl 3

2012-09-11 Thread Peterakos
Hello.

In the example you mention the is this text:

Add the path to GL3/gl3.h to the CMake compiler flags, CMAKE_CXX_FLAGS and
CMAKE_CXX_FLAGS_DEBUG (for release and debug builds; others if you use other
build configurations). The text to add should look something like this:
/I “C:\GLHeader”
The folder GLHeader should contain a subfolder GL3, which in turn
contains gl3.h.

But Cmake doesnt create any entries with these names
(CMAKE_CXX_FLAGS, CMAKE_CXX_FLAGS_DEBUG).
Do i have to create them or is it ok if i add the opengl path in the
parameter CMAKE_INCLUDE_PATH ?

thank you.


On 11 September 2012 04:58, Paul Martz pma...@skew-matrix.com wrote:

 On 9/10/2012 10:34 AM, Peterakos wrote:

 Hello.

 I face a problem trying to compile open scene graph using open gl 3.

 I get errors like these:

 error C3861: 'glLoadMatrixf': identifier not found
 error C3861: 'glMultMatrixf': identifier not found
 error C3861: 'glLoadMatrixd': identifier not found
 error C3861: 'glMultMatrixd': identifier not found


 Hm. Both v3.0.1 and also svn trunk r13140 seem to build fine for me, so
 I'm not sure why you'd encounter these errors.


  In CMake i have disabled everything that have the prefix OSG_GL
 except OSG_GL3_AVAILABLE.


 I build for GL3 using the instructions found in the osgsimplegl3.cpp
 example source code comment block.


  I also want to ask if i will be able to run the osg examples if i fully
 convert
 open scene graph in opengl 3.


 I doubt that any example other than osgsimplegl3 would work.
-Paul


 __**_
 osg-users mailing list
 osg-users@lists.**openscenegraph.org osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.**org/listinfo.cgi/osg-users-**
 openscenegraph.orghttp://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


[osg-users] AntTweakBar with Opengl 3.2

2012-09-11 Thread Peterakos
Hello.

Has anyone managed to make AntTweakBar work with OpengGL 3.2 and the usage
of shaders in the models ?

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


[osg-users] Opengl 3

2012-09-10 Thread Peterakos
Hello.

I face a problem trying to compile open scene graph using open gl 3.

I get errors like these:

error C3861: 'glLoadMatrixf': identifier not found
error C3861: 'glMultMatrixf': identifier not found
error C3861: 'glLoadMatrixd': identifier not found
error C3861: 'glMultMatrixd': identifier not found

In CMake i have disabled everything that have the prefix OSG_GL
except OSG_GL3_AVAILABLE.

I also want to ask if i will be able to run the osg examples if i fully
convert open scene graph in opengl 3.

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OpenGL core

2012-09-09 Thread Peterakos
Hello.

How do i change opengl profile between core and compatibility?
Which one is the default that the osg uses ?

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


[osg-users] VIewer light and scaled scene

2012-09-09 Thread Peterakos
Hello. I have 2 questions.


Does the osg::viewer's  light continue to affect the sene graph if it (the
scenegraph) has each own lights?

How can i disable the viewer's operation of scaling down the models in a
scenegraph if they are too big?

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


[osg-users] osgviewerfltk doesnt appear in solution

2012-09-08 Thread Peterakos
Hello.

I use CMake to create the openscenegraph solution
Even though i set the fltk paths paths, the osgviewerfltk project doesnt
appear in solution.

Here are the values i set in parameters:

FLTK_GL_LIBRARY:fltk 1-3-0/lib/fltkgl.lib
FLTK_INCLUDE_DIR:   fltk 1-3-0/include
FLTK_LIBRARY:  fltk 1-3-0/lib/fltk.lib

What else do i have to do ?

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


[osg-users] Vertex Attrib arrays

2012-09-07 Thread Peterakos
Hello.

I create a geom and i set the Vertex arrays and the Vertex Attrib arrays
for color, position and texcoords.
What i noticed is that even if i dont use shaders in my application, the
Vertex Attrib Arrays overwrite the Vertex Arrays.

Is that true ?
Nowhere in the application i set osg::Program to the stateset of the
geometry.

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


[osg-users] Osg Sliders

2012-09-07 Thread Peterakos
Hello.

Are there sliders in osgWidget ?
Didnt find any example that uses sliders.
Do i have to create my own ?

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


[osg-users] (no subject)

2012-09-06 Thread Peterakos
Hello.

My task is to render an animated dae character with shaders.
I have created a simple vertex shader:

attribute vec4 position_attribute;
attribute vec4 color_attribute;

varying vec4 color;

void main(){
color = color_attribute;
gl_Position = gl_ModelViewProjectionMatrix * position_attribute;
}
After that i use stateset-setAttributeAndModes to assign the program to
the model .
I assign the position and color atrtibute to the corresponding location
according to this:

gl_Vertex 0
gl_Normal 2
gl_Color 3
gl_SecondaryColor 4
Everything works fine.



The problem comes when i try to pass manually the vertex array and color
array using:
geom-setVertexAttribArray(attrib_num, data_array);
geom-setVertexAttribBinding(attrib_num, attrib_binding);
I pass the RigGeometry's VertexArray as data array, but the character is
not animated because the default
geometry's values are passed. Watching the osganimationhardware example i
noticed that i have to pass the bone matrices
as well and multiply with vertex position.


Is there any Array which keeps the updated vertex positions according to
the animation?
If there is, i can match this array's values to position attribute, without
having to pass the matrices in the shader.

Thank you for your time and sorry for the long post.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] (no subject)

2012-09-06 Thread Peterakos
Hello.


First of all the SceneGraph that is created after i read the dae file
doesnt have any RigTransformSoftware node.
Does that mean the values in the vertex array in the rig geometry will stay
the same during the program execution (and they will never get the updated
value) ?

In order for me to pass to the shader's position_attribute the correct
updated value what do i have to do ?
Do i have to call setVertexAttribArray in every loop, passing the as
parameter the udapted values ?
Is there any way to received these updated vertex positions without using
the RigTransformSoftware and without having to multiply with the
transformation matrices i received from bones ??

Thnx again and sorry for the long thread.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Program attribute cannot me removed

2012-09-05 Thread Peterakos
Hello.

This is what i did.
I disabled it in run time and checked the state set before and after this
line:
stateset-removeAttribute(osg::StateAttribute::PROGRAM)

Before that line the program was in attribute list along with lighting.
After that line, only lighting was there. But still the shaders seem active.

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


[osg-users] Split screen

2012-09-04 Thread Peterakos
Hello.

Is there any way to split the screen in 2 (vertical) ?
I would like to use 2 different cameras at the same time.

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


[osg-users] Program attribute cannot me removed

2012-09-04 Thread Peterakos
Hello.

I face a problem with a program attribute.

I enable the program using this:
osg::StateSet* stateset = model_node-getOrCreateStateSet();
stateset-setAttributeAndModes( program, osg::StateAttribute::ON |
osg::StateAttribute::OVERRIDE );

and i disable it using:
osg::StateSet* stateset = model_node-getOrCreateStateSet();
stateset-removeAttribute(osg::StateAttribute::PROGRAM);


Before the return viewer.run() , enable and disable operations work fine.
But after that, only enable works.
I use 2 buttons to enable and disable program in run time.

what do i do wrong ?

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


Re: [osg-users] Program attribute cannot me removed

2012-09-04 Thread Peterakos
Hello.

I have used this:
stateset-setAttributeAndModes(new osg::Program());
and it worked.

But why the other way didnt work ?

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


[osg-users] Problems with graphics cards and Vertex Arrays

2012-09-03 Thread Peterakos
Hello.

In my application i use the following code:

geom-setVertexAttribArray(0, data_array);
geom-setVertexAttribBinding(0, osg::Geometry::BIND_PER_VERTEX );
program-addBindAttribLocation(position_attr, 0);

I run this application in 2 different graphics cards:
1) NVidia 7900 GS
2) ATI 5570

Both cards support opengl 2.1.
The problem is that the previous code doesnt work in the second card (which
is newer).

Why is this happening?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Safe downcast

2012-08-21 Thread Peterakos
Hello.

I forgot to mention that i check it. That's why i posted it. Cause it is
very strange to run even though there is no group as root..

osg::ref_ptrosg::Group node =
dynamic_castosg::Group*(osgDB::readNodeFile( astroboy_walk.dae ));
if(!node) {
   std::cout  Model could not be loaded   std::endl;
   return 1;
}

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


[osg-users] Safe downcast

2012-08-20 Thread Peterakos
Hello.

In the example osganimationviewer in main there is the following line:
osg::Group* node =
dynamic_castosg::Group*(osgDB::readNodeFiles(arguments));

How safe is this if i use only 1 model in arguments and it is not Group ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Colors in dae file

2012-03-27 Thread Peterakos
Hello.

I have some problems reading colors from dae files.

I use a node visitor to traverse the scene graph.
On each geode's geometry, I get the vertices, normals and colors using:
geom-getVertexArray()
geom-getColorArray()
geom-getNormalArray()

The problem is that getColorArray() returns NULL.
The model has colors which are visible if i just project the dae model
using a viewer.

How do i get the colors from a dae file?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Passing dae data in shader.

2012-03-26 Thread Peterakos
Hello.

Is there any way using the dae plugin in osg, to pass the vertices in
shader code as attributes?
What i do now for simple geometry shapes (lets assume we have a quad), is
to use

setAttributeValues( ... ); passing the vertices' positions, colors normals
etc.
How can i get this information from a dae file and use the same shader?

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


Re: [osg-users] Passing dae data in shader.

2012-03-26 Thread Peterakos
Hello.

Is there any Sample/Example for this ?

Thank you again.

On 26 March 2012 15:00, Christian Buchner christian.buch...@gmail.comwrote:

 I'd say you would have to modify the DAE reader according to your
 shader's needs, or alternatively you'd need to do some postprocessing
 on the returned geometry.

 I would think that modifying the reader might be easier than
 processing its generated output.

 Christian
 ___
 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


[osg-users] Light source default position

2012-03-05 Thread Peterakos
Hello.

I found this shader line in the book:
float intensity = dot(vec3(gl_LightSource[0].position), normal );

i was wondering why he doesnt normalize the light source position.
He loads the cow.osg.
The normal vector is normalized using:
normal = normalize(gl_NormalMatrix * gl_Normal);

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Read dae files with osg.

2012-02-26 Thread Peterakos
Hello.

I have to load a .dae model in my scene and i was wondering if there is any
code example.

I use the following code
osg::ref_ptrosg::Node root = osgDB::readNodeFile( bmw.dae );
but i get a warning: Could not find plugin to read objects from file
bmw.dae.

I have built OpenSceneGraph code, but there isn't any project for this
extension in the solution's plugin project list.

How can i proceed ?

Thank you for your time.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Read dae files with osg.

2012-02-26 Thread Peterakos
Hello.

First of all thnx for your answer.
Watchig the list with projects in open scene graph solution, i notice there
is a Plugins dae project.
Even after building everything (using the all build project), my
application is still unable to load dae files.
I build for both release and debug mode.
I get the same warning as before.
My 3rd party binaries are visible and well recognized by CMake.

Any ideas?
Thnx.


On 26 February 2012 17:54, Kim Bale kcb...@googlemail.com wrote:

 You will need to point CMake to the Collada libraries when you build the
 OpenSceneGraph project. I believe there's a copy of them in the prebuilt
 3rd party dependencies that are distributed along side OSG. After that you
 you should get a DAE plugin inside of the OSG projects list. This will
 enable you to load collada files.

 Regards,

 Kim.




 On 26 February 2012 15:47, Peterakos hay...@gmail.com wrote:

 Hello.

 I have to load a .dae model in my scene and i was wondering if there is
 any code example.

 I use the following code
 osg::ref_ptrosg::Node root = osgDB::readNodeFile( bmw.dae );
 but i get a warning: Could not find plugin to read objects from file
 bmw.dae.

 I have built OpenSceneGraph code, but there isn't any project for this
 extension in the solution's plugin project list.

 How can i proceed ?

 Thank you for your time.

 ___
 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


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