[osg-users] Problem of Screen Resolution Automatic Change

2008-05-08 Thread zhangguilian
Hi,
The screen resolution changed when I add a model into the scene, does osg 
automatic change the screen resolution in some abnormal operating conditions?
This problem appreared on the machine: Intel(R) 82845G/GL/GE/PE/GV Graphics 
Controller.
Do anybody come accross such problem?

Thanks very much! 




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


[osg-users] Multiple render targets

2008-04-06 Thread zhangguilian

Hi,
As far as I know MRT is not supported in some ealier version of OSG, there is 
no call to glDrawBuffers (as opposed to glDrawBuffer) which is needed  for MRT. 
I don't know current vesion of OSG supprot it or not, if not ,is there any 
solutions available in the osg community today?
I would greatly appreciate if you can give some examples.

Thanks in advance,


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


[osg-users] How does data flows

2007-12-19 Thread zhangguilian
Hi,
I used Render To Texture in an algorithm of reflection, It works very well on  
GeForce 8800 GTS/PCI/SSE2 from NVIDIA Corporation but doesn't have any 
reflection effect on a GeForce4 MX 440/AGP/SSE2 from NVIDIA Corporation.
I usesetRenderTargetImplementation(CameraNode::FRAME_BUFFER_OBJECT)  and 
setRenderOrder(CameraNode::PRE_RENDER); 
of osg1.2, and the notification on the later machine(GeForce4 MX 440/AGP/SSE2 
from NVIDIA ) say Failed to aquire Graphics Context Setting up 
osg::CameraNode::FRAME_BUFFER, I think the reason is that it don't support 
FBO, and the maincamera render to FRAME_BUFFER, overriding the render of render 
to texture camera(rttcamera), am I right, if so, how can I make the 
pre_rendered data of rttcamera be avoid overriding? How does the data of render 
to texture flows on the machines support FBO and thoes don't support FBO, is 
there any information I can learn?

Thanks very much!



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


[osg-users] Render To Texture problem in a Reflection algorithm

2007-12-02 Thread zhangguilian
Hi,
In an algorithm of reflection I used Render To Texture, part of the code is:

 Texture2D* reflectionTex=new Texture2D;//rtt texture 
  reflectionTex-setTextureSize(512, 512);
  reflectionTex-setInternalFormat(GL_RGBA);
  reflectionTex-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
  reflectionTex-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
  reflectionTex-setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_EDGE);
  reflectionTex-setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_EDGE);

  CameraNode * rttcamera=new CameraNode;//rttcam  
  rttcamera-setCullingMode(CullSettings::NO_CULLING);
  rttcamera-setCullingActive(false);
  rttcamera-setClearMask(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT);

 // rttcamera-setViewport(0,0,512,512);
  rttcamera-setRenderOrder(CameraNode::PRE_RENDER);
  
rttcamera-setRenderTargetImplementation(CameraNode::FRAME_BUFFER_OBJECT,CameraNode::PIXEL_BUFFER_RTT);
 
  rttcamera-attach(osg::CameraNode::COLOR_BUFFER,reflectionTex);

  osg::ClipNode* clipNode = new osg::ClipNode;
  osg::ClipPlane* clipplane = new osg::ClipPlane;
  Plane pl(normal,point);
  clipplane-setClipPlane(pl);
  clipplane-setClipPlaneNum(0);
  clipNode-addClipPlane(clipplane);
  clipNode-addChild(reflectTransform);
  rttcamera-addChild(clipNode);

 I don't know why it running well on a GeForce 8800 GTS/PCI/SSE2 from 
NVIDIA Corporation but doesn't have any reflection effect on a GeForce4 MX 
440/AGP/SSE2 from NVIDIA Corporation,
and while I add a line:rttcamera-setViewport(0,0,512,512),the later 
machine(GeForce4 MX 440/AGP/SSE2 from NVIDIA Corporation) can have reflect 
effect,but a strange phenomena appears:
an arbitrary window(relative or irrelative with the program) over it will 
destroy the reflction map and the area destroyed will move with the window over 
it
(once the window over it moves ,the destroyed area move too) , I don't know 
what have happend and I eagerly to know how to solve the problem.

Thanks very much!
zhangguilian
2007.12.3
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] How to write RGB value To the osg::Texture object pixel by pixel?

2007-10-21 Thread zhangguilian
Hi ,I still don't know how to write RGB value to the osg::Texture object pixel 
by pixel which can be realized in OpenGL as follows:

//in openGL
#define TEXTUREWIDTH 64
#define TEXTUREHEIGHT 64
GLubyte Texture[TEXTUREWIDTH][TEXTUREHEIGHT][3];
void makeTexture(void)
void makeTexture(void)
{
int i,j,r,g,b;
for(i=0;iTEXTUREWIDTH;i++)
{
for(j=0;jTEXTUREHEIGHT;j++)
{
r=(i*j)%255;
g=(4*i)%255;
b=(4*j)%255;
Texture[i][j][0 =(GLubyte)r;
Texture[i][j][1 =(GLubyte)g;
Texture[i][j][2 =(GLubyte)b;
}
}
}

//Used here
glTexImage2D(GL_TEXTURE_2D,0,3,TEXTUREWIDTH,
TEXTUREHEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,
Texture[0][0][0]);

Could you please give some examples? Thank you very much!

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


[osg-users] How to write RGB value of the osg::Texture2D

2007-10-20 Thread zhangguilian
Hi, I have an question and eagerly to know the answer.
How can I directly write the RGB value of the osg::Texture2D?
As a matter of fact,I can write the RGB value of Texture in OpenGL,such as :
#define TEXTUREWIDTH 64
#define TEXTUREHEIGHT 64
GLubyte Texture[TEXTUREWIDTH][TEXTUREHEIGHT][3];
void makeTexture(void)
void makeTexture(void)
{
int i,j,r,g,b;
for(i=0;iTEXTUREWIDTH;i++)
{
for(j=0;jTEXTUREHEIGHT;j++)
{
r=(i*j)%255;
g=(4*i)%255;
b=(4*j)%255;
Texture[i][j][0 =(GLubyte)r;
Texture[i][j][1 =(GLubyte)g;
Texture[i][j][2 =(GLubyte)b;
}
}
}


void myinit(void)
{
auxInitDisplayMode(AUX_SINGLE|AUX_RGBA);
auxInitPosition(0,0,500,500);
auxInitWindow(sample1);
auxInitWindow(sample1);
glClearColor(0.0,0.0,0.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);

//The data used for creating texture image is saved in Texture[][][]
makeTexture();
glPixelStorei(GL_UNPACK_ALIGNMENT,1);

//Used here
glTexImage2D(GL_TEXTURE_2D,0,3,TEXTUREWIDTH,
TEXTUREHEIGHT,0,GL_RGB,GL_UNSIGNED_BYTE,
Texture[0][0][0]);

glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);

glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);

glEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
// glShadeModel(GL_FLAT);
}

But I really don't know how to use this mathod in OSG,Could you please give me 
an advice,Thanks a lot!



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