Qayoom
01-06-2009, 01:47 AM
Hi.
I want to render a cube with all the six faces having distinct textures.I read the documentation where in i found the following code:
char *faceFile[6] = {
"left.jpg",
"right.jpg",
"top.jpg",
"bottom.jpg",
"back.jpg",
"front.jpg",
};
int
main(int, char **argv)
{
Widget myWindow = SoXt::init(argv[0]);
if(myWindow == NULL) exit(1);
// Add a sphere with a texture map.
SoSeparator *root = new SoSeparator;
SoTextureCubeMap *myTexture = new SoTextureCubeMap;
for (int i=0;i<6;i++)
myTexture->filenames.set1Value(i,SbString(faceFile[i]));
root->addChild(new SoTextureCoordinateReflectionMap) ;
root->addChild(myTexture);
root->addChild(new SoSphere);
SoXtExaminerViewer *myViewer =
new SoXtExaminerViewer(myWindow);
myViewer->setSceneGraph(root);
myViewer->setTitle("Cube texture map");
myViewer->show();
myViewer->viewAll();
SoXt::show(myWindow);
SoXt::mainLoop();
return 0;
}
But i am not able to get the different textures on all six surfaces as specified in the six texture files.
I am getting this error:
-----------------------------------
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
---------------------------------------------------
Please suggest how to achieve the multitexturing on cube.
Thanks
Qayoom
I want to render a cube with all the six faces having distinct textures.I read the documentation where in i found the following code:
char *faceFile[6] = {
"left.jpg",
"right.jpg",
"top.jpg",
"bottom.jpg",
"back.jpg",
"front.jpg",
};
int
main(int, char **argv)
{
Widget myWindow = SoXt::init(argv[0]);
if(myWindow == NULL) exit(1);
// Add a sphere with a texture map.
SoSeparator *root = new SoSeparator;
SoTextureCubeMap *myTexture = new SoTextureCubeMap;
for (int i=0;i<6;i++)
myTexture->filenames.set1Value(i,SbString(faceFile[i]));
root->addChild(new SoTextureCoordinateReflectionMap) ;
root->addChild(myTexture);
root->addChild(new SoSphere);
SoXtExaminerViewer *myViewer =
new SoXtExaminerViewer(myWindow);
myViewer->setSceneGraph(root);
myViewer->setTitle("Cube texture map");
myViewer->show();
myViewer->viewAll();
SoXt::show(myWindow);
SoXt::mainLoop();
return 0;
}
But i am not able to get the different textures on all six surfaces as specified in the six texture files.
I am getting this error:
-----------------------------------
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
Inventor error in SoGLTextureImageElement::sendTex():
glTexImage2D/glCompressedTexImage2D unable to create texture image (1281).
---------------------------------------------------
Please suggest how to achieve the multitexturing on cube.
Thanks
Qayoom