Exemple #1
0
GLuint GameSprite::NormalImage::getHardwareID() {
	if(isGLLoaded == false) {
		createGLTexture(id);
	}
	visit();
	return id;
}
Exemple #2
0
bool CCTextureASTC::initWithContentsOfFile(const char* path)
{
    int len = 0;
    std::string lowerCase(path);
    if (lowerCase.find(".ccz") != std::string::npos)
    {
        len = ZipUtils::ccInflateCCZFile(path, &m_data);
    }
    else if (lowerCase.find(".gz") != std::string::npos)
    {
        len = ZipUtils::ccInflateGZipFile(path, &m_data);
    }
    else
    {
        m_data = CCFileUtils::sharedFileUtils()->getFileData(path, "rb", (unsigned long *)(&len));
    }
    if(len<0){
        this->release();
        return false;
    }
    m_uName = 0;
    m_uWidth = m_uHeight = 0;
    if (!unpackData(m_data) ||!createGLTexture())
    {
        this->release();
        return false;
    }
    
    return true;
}
//**************************************************************************************************************
LLTextureAtlas::LLTextureAtlas(U8 ncomponents, S16 atlas_dim) : 
    LLViewerTexture(atlas_dim * sSlotSize, atlas_dim * sSlotSize, ncomponents, TRUE),
	mAtlasDim(atlas_dim),
	mNumSlotsReserved(0),
	mMaxSlotsInAtlas(atlas_dim * atlas_dim)
{
	generateEmptyUsageBits() ;

	//generate an empty texture
	generateGLTexture() ;
	LLPointer<LLImageRaw> image_raw = new LLImageRaw(mFullWidth, mFullHeight, mComponents);
	createGLTexture(0, image_raw, 0);
	image_raw = NULL;
}
Exemple #4
0
void LLViewerDynamicTexture::generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes)
{
	if (mComponents < 1 || mComponents > 4)
	{
		llerrs << "Bad number of components in dynamic texture: " << mComponents << llendl;
	}
	
	LLPointer<LLImageRaw> raw_image = new LLImageRaw(mFullWidth, mFullHeight, mComponents);
	if (internal_format >= 0)
	{
		setExplicitFormat(internal_format, primary_format, type_format, swap_bytes);
	}
	createGLTexture(0, raw_image, 0, TRUE, LLViewerTexture::DYNAMIC_TEX);
	setAddressMode((mClamp) ? LLTexUnit::TAM_CLAMP : LLTexUnit::TAM_WRAP);
	mGLTexturep->setGLTextureCreated(false);
}
//**************************************************************************************************************
LLTextureAtlas::LLTextureAtlas(U8 ncomponents, S16 atlas_dim) : LLImageGL(),
	mAtlasDim(atlas_dim)
{
	setComponents(ncomponents) ;

	mCanAddToAtlas = FALSE ;//do not add one atlas to another.
	mNumSlotsReserved = 0 ;
	mMaxSlotsInAtlas = mAtlasDim * mAtlasDim ;

	generateEmptyUsageBits() ;

	//generate an empty texture
	S32 dim = mAtlasDim * sSlotSize ; //number of pixels per dimension 
	LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim, dim, getComponents());
	createGLTexture(0, image_raw, 0);
	image_raw = NULL;
	dontDiscard();
}