Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Linda Lee
Hi,

I tried add these lines into my code:


osg::Texture2DArray* tileImgLay;
tileImgLay = new osg::Texture2DArray;
tileImgLay->setTextureSize(128, 128, 2);
tileImgLay->setUseHardwareMipMapGeneration(false);   


tileImgLay->setImage(0, osgDB::readImageFile("test1.bmp"));
tileImgLay->setImage(1, osgDB::readImageFile("est1.bmp"));
ss->setTextureAttribute(1, tileImgLay); 


tileImgLay->setFilter( osg::Texture2DArray::MIN_FILTER, 
osg::Texture2DArray::NEAREST); 
tileImgLay->setFilter( osg::Texture2DArray::MAG_FILTER, 
osg::Texture2DArray::NEAREST); 

ss->addUniform( new osg::Uniform("test", 1) );

and in the fragment shader:

uniform sampler2DArray test;


and access it using:

gl_FragColor = texture2DArray(test, vec3(0, 0, 0)); 


However, it fail to work.

Any ideal why?


Thank you!

Cheers,
Linda

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





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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Stephan Huber
Hi,

Am 11.06.11 10:47, schrieb Linda Lee:
> and in the fragment shader:
> 
>   uniform sampler2DArray test;
>   
> 
> and access it using:
> 
>   gl_FragColor = texture2DArray(test, vec3(0, 0, 0));

Do you get any compile-error for your shader?

I had to add these lines to get texure2DArrays working in my shader:

#version 120
#extension GL_EXT_gpu_shader4 : enable
#extension GL_EXT_texture_array : enable


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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Linda Lee
Hi,

I did not get any compiler error.  The application runs successfully.  However, 
the texture did not seem to be loaded into the shader code.  The image rendered 
as black in color.

As the lines, Where should I add them?
#version 120 
#extension GL_EXT_gpu_shader4 : enable 
#extension GL_EXT_texture_array : enable 

I gotten error msg when I add them into the main .cpp file. 

Thank you!

Cheers,
Linda

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





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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Philip Taylor
Linda,

Any chance of a typo?? 

Looks like you intended the second image file to be the same as the first -
test1.bmp - except that the first letter is missing.

PhilT

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Linda Lee
Sent: 11 June 2011 09:48
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Passing multiple textures in glsl

Hi,

I tried add these lines into my code:


osg::Texture2DArray* tileImgLay;
tileImgLay = new osg::Texture2DArray;
tileImgLay->setTextureSize(128, 128, 2);
tileImgLay->setUseHardwareMipMapGeneration(false);   


tileImgLay->setImage(0, osgDB::readImageFile("test1.bmp"));
tileImgLay->setImage(1, osgDB::readImageFile("est1.bmp"));
ss->setTextureAttribute(1, tileImgLay); 


tileImgLay->setFilter( osg::Texture2DArray::MIN_FILTER,
osg::Texture2DArray::NEAREST); 
tileImgLay->setFilter( osg::Texture2DArray::MAG_FILTER,
osg::Texture2DArray::NEAREST); 

ss->addUniform( new osg::Uniform("test", 1) );

and in the fragment shader:

uniform sampler2DArray test;


and access it using:

gl_FragColor = texture2DArray(test, vec3(0, 0, 0)); 


However, it fail to work.

Any ideal why?


Thank you!

Cheers,
Linda

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





___
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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Linda Lee
Hi,

Nope.  The typo is caused when I cut and paste into the posting textbox.  I am 
quite sure the textures were loaded correctly.

Any idea what is causing the problem? :(

Thank you!

Cheers,
Linda

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





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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Linda Lee
Hi,

Forgot to mention to I have this msg when I run the application.

Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,)

Thank you!

Cheers,
Linda

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





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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Wojciech Lewandowski

Hi Linda,

Your code looks correct to me.  Your shader does the texture lookup at 0,0,0 
coord is there a chance that your test1.bmp picture is black in the corner ? 
Or its res differs than 128x128  so loading them does not work or leaves 
some empty space ?. You may try to run the example code from the following 
message:


http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg32539.html

It used to work for me.  Just change the wrap mode to other than 
CLAMP_TO_BORDER if you have ati graphics.


Wojtek


-Oryginalna wiadomość- 
From: Linda Lee

Sent: Saturday, June 11, 2011 11:42 AM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Passing multiple textures in glsl

Hi,

Forgot to mention to I have this msg when I run the application.

Warning: detected OpenGL error 'invalid enumerant' after RenderBin::draw(,)

Thank you!

Cheers,
Linda

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





___
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


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Chris 'Xenon' Hanson
On 6/10/2011 11:04 PM, Linda Lee wrote:
> Hi,
> I need to handle multiple textures in glsl.  Any suggestions how do I do it?  
> Should I use sampler2DArray?  How do I use it?  Any links I could take 
> reference from?


  Don't use 2DArray unless the textures really are related. Just use multiple 
sampler2Ds.

> Also, is there a limit to the amount of textures I could load into GPU.   I 
> tried loading 25 4096by4096 textures and it crashes when I tried to load 
> more.  Is there any ways to increase the amount that I could load?

  It's just limited by memory. What are your 25 textures? Usually one doesn't 
need 25 4k
textures unless you're doing volumetric work or something.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Passing multiple textures in glsl

2011-06-11 Thread Paul Martz

On 6/11/2011 8:14 AM, Chris 'Xenon' Hanson wrote:

Also, is there a limit to the amount of textures I could load into GPU.   I 
tried loading 25 4096by4096 textures and it crashes when I tried to load more.  
Is there any ways to increase the amount that I could load?


   It's just limited by memory. What are your 25 textures? Usually one doesn't 
need 25 4k
textures unless you're doing volumetric work or something.


Chris is right. For uncompressed rgba (four byte per texel) data, a 4kx4k 
texture consumes 4k * 4k * 4bytes = 64MB. Times 25 textures = 1.6GB. If this is 
a 32-bit app, chances are it's your application that is exhausting per-process 
host RAM and crashing, rather than a GPU RAM / OpenGL issue, but you'd have to 
check the call stack. You might try your app on a 64-bit system.


But, using that many textures will likely cause OpenGL to swap textures in and 
out of GPU RAM, which will kill performance, so you should look at using 
fewer/smaller textures or using a compressed texture format.


You can set OSG_MAX_TEXTURE_SIZE in your environment to restrict the maximum 
size of texture objects that OSG creates. For example:

  OSG_MAX_TEXTURE_SIZE=1024
means if the texture you load from disk is larger than 1kx1k, OSG will reduce it 
to 1kx1k before sending it to the GPU. This can be a handy tool for digging in 
to texture memory or performance issues.


--
  -Paul Martz  Skew Matrix Software
   http://www.skew-matrix.com/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] LNK1181 fatal error ONLY for libpng.lib

2011-06-11 Thread Mohamed Alji
Hi,

Since I have been mislead between the 32-bit and 64-bit... assuming it is the 
same case for a lot of people, I've translated the article, which I found 
interesting,   Enabling 64-bit Support in Visual Studio 2008 
(https://programmersnotebook.wordpress.com/2010/01/23/enabling-64-bit-support-in-visual-studio-2008/)
 from the Programmer's Notebook to french, and publish it La prise en charge du 
64-bit sous Visual Studio 2008 
(http://aljilogy.wordpress.com/2011/06/11/64-bit-visual-studio-2008/).

Have a nice day


Mohamed ALJI


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




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


Re: [osg-users] OSG 2.8.4 - CMake with GDAL (VS9-32bit)

2011-06-11 Thread Torben Dannhauer
Hi,

the OSG 3rd Party Package for VS9 provides CURL and GDAL. So download that 
package, point your folders to the correct subfolder (x86/lib|include or 
x64/lib|include) and it should work. 

Thank you!

Cheers,
Torben

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





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


Re: [osg-users] OSG based aplication nominated in CG Architect Awards

2011-06-11 Thread Alessandro Terenzi
Thanks Alberto for spending time to answer my questions, your answers and
your work are really inspiring.

Looking forward to seeing other works like that.
Alessandro

On Fri, Jun 10, 2011 at 7:59 PM, Alberto Jaspe  wrote:

> Hi,
>
> Thanks Alsessandro and Ulrich for your feedback :)
>
> Asking questions...
>
>>
>> 1) how do you cap holes when performing dynamic clipping?
>>
> Every poly behind the holes is viewed by its back face. You only have to
> fill any back face with an uniform color in a fragment program.
>
>
>>
>> 2) is global illumination calculated in real-time as well?
>>
> No. It's a precalculated  radiosity solution, with some optimizations in
> the scenegraph and lighting info per vertex.
>
>>
>> 3) how did you integrated panoramas in OSG?
>>
> Well, we had two ways doing that. At one hand, we developed our own
> panorama library, that textures any panoramic image in the inside face of a
> sphere, taking care of projections, texture load, movement control, etc.
> This is a good choose if you need to integrate in any way the panorama in
> your 3D scene.
> By the other side and in the last times we had integrated web browsing
> inside our own GI system, via awesomium. So most times it were faster and
> more effective using a page with a flash panorama viewer, like kr-pano.
>
> Bye and thanks again!
> Alberto.
>
> --
> *Alberto Jaspe*
> *Computer Graphics R&D Guy*
>
> http://albertojaspe.net
>
>
> ___
> 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


Re: [osg-users] [build] How to compile OSG examples with OSX 10.5 / XCode 3.0 binaries?

2011-06-11 Thread Mohamed Alji
Hi raw, 

I downloaded the OpenSceneGraph-2.9.X and using CMake I generated the 
.xcodeproject. I compiled the Build_All and then Install. Everything seem to 
work fine. 

I am using OSX 5 Leopard with XCode 3. 

can you give more details please ?


Mohamed ALJI


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




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