Announcement

Collapse
No announcement yet.

MultiTexturing Cube

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MultiTexturing Cube

    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

  • #2
    Your OpenGL error

    Hi,

    Error 1281 is actually from OpenGL, not Open Inventor. It's unusual to get OpenGL errors because Inventor tries to check for problems in advance and unfortunately this is a very generic error described only as "Invalid value". Getting this error on the glTexImage2D call could indicate that your graphics board doesn't support the texture cube map feature (although we check for this, graphics drivers have been known to lie about it :-). You should probably open a case with customer support (3d_hotline@mc.com). In any case we'll need to know your:
    - Operating system
    - Graphics board
    - Driver version
    - Open Inventor version
    and anything else that might be relevant. In the meantime, if you think your board does support this feature, you might want to try updating to the latest version of the driver.

    However, I should also mention that this feature may not do what you're looking for... texture cube map provides "reflection mapping", in other words it simulates each face of the cube displaying a reflection of the surrounding environment. That means the image on each face of the cube depends on its orientation.

    I'm not sure, but it sounds like you want a specific image "locked" to each face of the cube. If that's the case then you need to create six separate texture nodes and six geometry nodes (one for each face).

    -Mike

    Comment


    • #3
      Multitexturing....

      Hi.
      Thanks a lot for the information.
      The details you asked for are :
      -Operating System : Windows XP 64 Bit
      -Graphics board : NVIDIA Quadro FX 2500M
      - Driver version : 8.4.9.8
      - Open Inventor version 6.1

      Yes i want that a specific image be locked to each face of the cube.

      Regards.
      Qayoom.

      Comment


      • #4
        Multitexturing.... Solved!

        Hi.
        I achieved it by creating six different faces and then to each face i provided a separate texture.

        Thanks and Regards.
        Qayoom

        Comment

        Working...
        X