Exemple #1
0
axelynx::Texture* CRenderTarget::CreateDepthTexture()
{
	OPENGL_CHECK_FOR_ERRORS();
	axelynx::Texture::Desc desc;
	desc.TT = axelynx::Texture::TT_DEPTH;
	desc.width = width_;
	desc.height = height_;
	desc.cpp = 1;
	desc.bpc = 4;
	desc.use_mipmaps = false;

	CTexture *tex = new CTexture(desc);

	//tex->Bind();
	//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
	//tex->UnBind();
	tex->Build(0,GL_DEPTH_COMPONENT,GL_DEPTH_COMPONENT32F);
	OPENGL_CHECK_FOR_ERRORS();
	BindDepthTexture(tex);
	OPENGL_CHECK_FOR_ERRORS();
	return tex;
}
Exemple #2
0
axelynx::Texture* CRenderTarget::CreateColorTexture(int channels, int channel_size, int layer,bool use_mipmaps)
{
	OPENGL_CHECK_FOR_ERRORS();
	axelynx::Texture::Desc desc;
	desc.TT = axelynx::Texture::TT_2D;
	desc.width = width_;
	desc.height = height_;
	desc.cpp = channels;
	desc.bpc = channel_size;
	desc.use_mipmaps = use_mipmaps;

	CTexture *tex = new CTexture(desc);

	GLenum format;
	GLenum internalformat;
	GetGLTextures(format,internalformat,channels,channel_size);
	tex->Build(0,format,internalformat);
	OPENGL_CHECK_FOR_ERRORS();
	BindColorTexture(tex,layer);
	OPENGL_CHECK_FOR_ERRORS();
	return tex;
}