Exemplo n.º 1
0
// Load texture into memory
void LoadGLTextures(void) 
{
    OSG::ImageRefPtr image = OSG::Image::create();
    if(!image->read("./Data/worldground.jpg"))
    {
        printf("Could not read ./Data/worldground.jpg!!\n");
        exit(1);
    }

    // create Texture
    glGenTextures(1, &texture[0]);

    // texture 2 (linear scaling)
    glBindTexture(GL_TEXTURE_2D, texture[0]);   // 2d texture (x and y size)
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); // scale linearly when image bigger than texture
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); // scale linearly when image smalled than texture
    glTexImage2D(GL_TEXTURE_2D, 0, 3, image->getWidth(), image->getHeight(), 0, GL_RGB, GL_UNSIGNED_BYTE, image->getData());
}
Exemplo n.º 2
0
OSG::LabelTransitPtr createIconLabel(void)
{
    OSG::IconLabelRefPtr iconLabel = OSG::IconLabel::create();

#if 0
    iconLabel->setSize(OSG::Vec2f(64,64));
#else
    iconLabel->setSize(OSG::Vec2f(0.2,0.2));
#endif

#if 0
    // FIXME: find better image example + check that in...
    iconLabel->setFilename("/home/spindler/Projects/Tonky/Data/paul.jpg");
#else
    std::cerr << "specify IcoenLabel.image" << std::endl;
    OSG::ImageRefPtr img = OSG::Image::create();
    img->read("/home/spindler/Projects/Tonky/Data/paul.jpg");
    iconLabel->setImage(img);
#endif
    return OSG::LabelTransitPtr(iconLabel);
}