コード例 #1
0
ファイル: glwrap.cpp プロジェクト: Cav098/stk-code-fix_1797
void FrameBuffer::bindLayer(unsigned i)
{
    glBindFramebuffer(GL_FRAMEBUFFER, fbolayer);
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, RenderTargets[0], 0, i);
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, DepthTexture, 0, i);
    glViewport(0, 0, (int)width, (int)height);
    GLenum bufs[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
    glDrawBuffers((int)RenderTargets.size(), bufs);
}
コード例 #2
0
 // Get contents of current texture by drawing it into a framebuffer then reading with
 // glReadPixels().
 void readTexture3D(GLuint texture, GLsizei width, GLsizei height, int zSlice, PixelRect *out)
 {
     GLFramebuffer fbo;
     glBindFramebuffer(GL_FRAMEBUFFER, fbo);
     glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0, zSlice);
     out->readFB(0, 0);
 }
コード例 #3
0
ファイル: errors.c プロジェクト: aphogat/piglit
void
piglit_init(int argc, char **argv)
{
    /* test some new error cases */

    GLuint fbo, tex;
    glGenFramebuffers(1, &fbo);

    glBindFramebuffer(GL_FRAMEBUFFER, fbo);

    glGenTextures(1, &tex);
    glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex);
    glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
            4, GL_RGBA, 64, 64, 2, GL_TRUE);

    if (!piglit_check_gl_error(GL_NO_ERROR)) {
        printf("should be no error so far\n");
        piglit_report_result(PIGLIT_FAIL);
    }

    /* binding a negative layer should fail */
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0, -1);

    if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
        printf("glFramebufferTextureLayer w/ negative layer must "
                "emit GL_INVALID_VALUE but did not\n");
        piglit_report_result(PIGLIT_FAIL);
    }

    piglit_report_result(PIGLIT_PASS);
}
コード例 #4
0
ファイル: clear-depth.c プロジェクト: BNieuwenhuizen/piglit
bool
probe_texture_layered_depth(GLuint texture, int x, int y, int z,
			    int w, int h, int d, float *expected)
{
	GLint prev_read_fbo;
	GLint prev_draw_fbo;

	GLuint fbo;
	int k;

	glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &prev_draw_fbo);
	glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &prev_read_fbo);

	glGenFramebuffers(1, &fbo);
	glBindFramebuffer(GL_FRAMEBUFFER, fbo);

	for(k = 0; k < d; k++ ) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
					  texture, 0, k+z);

		if (!piglit_probe_rect_depth(x, y, w, h, expected[k])) {
			printf("Layer: %i\n", z + k);
			return false;
		}
	}

	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, prev_draw_fbo);
	glBindFramebuffer(GL_READ_FRAMEBUFFER, prev_read_fbo);

	glDeleteFramebuffers(1, &fbo);
	return true;
}
コード例 #5
0
void XFBSource::CopyEFB(float Gamma)
{
    g_renderer->ResetAPIState();

    // Copy EFB data to XFB and restore render target again
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer());

    for (int i = 0; i < m_layers; i++)
    {
        // Bind EFB and texture layer
        glBindFramebuffer(GL_READ_FRAMEBUFFER, FramebufferManager::GetEFBFramebuffer(i));
        glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0, i);

        glBlitFramebuffer(
            0, 0, texWidth, texHeight,
            0, 0, texWidth, texHeight,
            GL_COLOR_BUFFER_BIT, GL_NEAREST
        );
    }

    // Return to EFB.
    FramebufferManager::SetFramebuffer(0);

    g_renderer->RestoreAPIState();

}
コード例 #6
0
//==============================================================================
void GlFramebuffer::attachTextureInternal(
	GLenum attachment, const GlTexture& tex, const U32 layer)
{
	const GLenum target = GL_FRAMEBUFFER;
	switch(tex.getTarget())
	{
	case GL_TEXTURE_2D:
#if ANKI_GL == ANKI_GL_DESKTOP
	case GL_TEXTURE_2D_MULTISAMPLE:
#endif
		ANKI_ASSERT(layer == 0);
		glFramebufferTexture2D(target, attachment,
			tex.getTarget(), tex.getGlName(), 0);
		break;
	case GL_TEXTURE_CUBE_MAP:
		ANKI_ASSERT(layer < 6);
		glFramebufferTexture2D(target, attachment,
			GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, tex.getGlName(), 0);
		break;
	case GL_TEXTURE_2D_ARRAY:
	case GL_TEXTURE_3D:
		ANKI_ASSERT((GLuint)layer < tex.getDepth());
		glFramebufferTextureLayer(target, attachment,
			tex.getGlName(), 0, layer);
		break;
	default:
		ANKI_ASSERT(0);
		break;
	}
}
コード例 #7
0
static GLuint
create_array_fbo_2d(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, i, format,
			     dim, dim, num_layers, 0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	for (layer = 0; layer < num_layers; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  tex,
					  0,
					  layer);
		if (!piglit_check_gl_error(GL_NO_ERROR))
		        piglit_report_result(PIGLIT_FAIL);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			load_texture_2d_array();
			goto done;
		}

		glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
		piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

		glColor4fv(layer_color[layer]);
		piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
		glColor4fv(green);
		piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
		glColor4fv(blue);
		piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
		glColor4fv(white);
		piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);
	}

done:
	glGenerateMipmapEXT(GL_TEXTURE_2D_ARRAY_EXT);
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
コード例 #8
0
static GLuint
create_texcube(void)
{
	GLuint tex, fb;
	GLenum status;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(target, tex);
	glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
	glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	if (test_array)
		glTexStorage3D(target, TEX_LEVELS, format,
			       TEX_SIZE, TEX_SIZE, num_layers);
	else
		glTexStorage2D(target, TEX_LEVELS, format,
			       TEX_SIZE, TEX_SIZE);

	glGenFramebuffers(1, &fb);
	glBindFramebuffer(GL_FRAMEBUFFER, fb);

	for (layer = 0; layer < num_layers; layer++) {
		if (test_array)
			glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
						  tex, 0, layer);
		else
			glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
					       GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer,
					       tex, 0);

		status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
		if (status != GL_FRAMEBUFFER_COMPLETE) {
			load_texcube();
			goto done;
		}

		glViewport(0, 0, TEX_SIZE, TEX_SIZE);
		piglit_ortho_projection(TEX_SIZE, TEX_SIZE, GL_FALSE);

		glColor4fv(colors[(layer + 0) % NUM_COLORS]);
		piglit_draw_rect(0, 0, TEX_HALF, TEX_HALF);

		glColor4fv(colors[(layer + 2) % NUM_COLORS]);
		piglit_draw_rect(TEX_HALF, 0, TEX_HALF, TEX_HALF);

		glColor4fv(colors[(layer + 4) % NUM_COLORS]);
		piglit_draw_rect(0, TEX_HALF, TEX_HALF, TEX_HALF);

		glColor4fv(colors[(layer + 6) % NUM_COLORS]);
		piglit_draw_rect(TEX_HALF, TEX_HALF, TEX_HALF, TEX_HALF);
	}

done:
	glGenerateMipmap(target);
	glDeleteFramebuffers(1, &fb);
	return tex;
}
コード例 #9
0
	void ShadowDevice::Init(GLRenderer* p_renderer, int p_width, int p_height, BufferInterface* p_cameraBuffer, BufferInterface* p_uniforms)
	{
		m_width = p_width;
		m_height = p_height;
		m_cameraBuffer = p_cameraBuffer;
		m_uniforms = p_uniforms;

		glGenTextures(1, &m_depthTextureArray);
		glBindTexture(GL_TEXTURE_2D_ARRAY, m_depthTextureArray);
		glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_DEPTH_COMPONENT32F, m_width, m_height, RENDER_SHADOW_CASCADES);
		
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
		glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);

		for(int i = 0; i < RENDER_SHADOW_CASCADES; i++)
		{
			glGenFramebuffers(1, &m_framebuffers[i]);
			glBindFramebuffer(GL_FRAMEBUFFER, m_framebuffers[i]);
			glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_depthTextureArray, 0, i);
			glDrawBuffer(GL_NONE);
			glReadBuffer(GL_NONE);
			GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
			switch (status)
			{
			case GL_FRAMEBUFFER_COMPLETE:
				g_context.m_logger->LogText(LogTag::RENDER, LogLevel::SUCCESS, "Good framebuffer support.");
				break;
			default:
				g_context.m_logger->LogText(LogTag::RENDER, LogLevel::WARNING, "Bad framebuffer support!");
				break;
			}
			glBindFramebuffer(GL_FRAMEBUFFER, 0);
		}
		glDrawBuffer(GL_BACK);
		glReadBuffer(GL_BACK);

		m_shadowEffect = g_context.m_resourceManager->LoadEffect("Renderer/Shadow");

		glGenSamplers(1, &m_samplerObjectPCF);
		glGenSamplers(1, &m_samplerObjectFloat);

		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
		glSamplerParameteri(m_samplerObjectPCF, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);

		glSamplerParameteri(m_samplerObjectFloat, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
		glSamplerParameteri(m_samplerObjectFloat, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
		glSamplerParameteri(m_samplerObjectFloat, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
		glSamplerParameteri(m_samplerObjectFloat, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	}
コード例 #10
0
ファイル: blit.c プロジェクト: Zoxc/piglit
/*
 * Blit the passed texture to the screen. If texture is layered,
 * loops through each layer and blit it to the screen. Otherwise scales
 * the layer zero vertically with a factor of texDepth.
 */
bool
display_texture(int x, int y, GLuint tex, int layers)
{
	GLuint tempFBO;
	GLenum fbStatus;

	/* Gen temp fbo to work with */
	glGenFramebuffers(1, &tempFBO);

	if (layers == 1) {
		glBindFramebuffer(GL_FRAMEBUFFER, tempFBO);
		glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
				       GL_TEXTURE_2D, tex, 0);

		/* Blit layer to screen */
		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
		glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
		glBlitFramebuffer(0, 0, texWidth, texHeight,
				  x, y, x + texWidth, y + texDepth * texHeight,
				  GL_COLOR_BUFFER_BIT, GL_NEAREST);
	} else {
	        int i;

		/* loop through each layer */
		for (i = 0; i < layers; i++) {
			/* Bind new layer to display */
			glBindFramebuffer(GL_FRAMEBUFFER, tempFBO);
			glFramebufferTextureLayer(GL_FRAMEBUFFER,
						  GL_COLOR_ATTACHMENT0,
						  tex, 0, i);

			fbStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
			if (fbStatus != GL_FRAMEBUFFER_COMPLETE) {
				printf("Framebuffer Status: %s\n",
				       piglit_get_gl_enum_name(fbStatus));
				return false;
			}

			/* Blit layer to screen */
			glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
			glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
			glBlitFramebuffer(0, 0, texWidth, texHeight,
					  x,
                                          y + i * texHeight,
					  x + texWidth,
                                          y + (i + 1) * texHeight,
					  GL_COLOR_BUFFER_BIT, GL_NEAREST);
		}
	}

	/* Cleanup temp fbo */
	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
	glDeleteFramebuffers(1, &tempFBO);

	return piglit_check_gl_error(GL_NO_ERROR);
}
コード例 #11
0
bool initFramebuffer()
{
	glGenFramebuffers(1, &FramebufferName);
	glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
	glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, TextureName, 0, GLint(0));
	glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, TextureName, 0, GLint(1));
	glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, TextureName, 0, GLint(2));
	
	GLenum DrawBuffers[3] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2};
	glDrawBuffers(3, DrawBuffers);
	assert(glGetError() == GL_NO_ERROR);

	if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
		return false;

	glBindFramebuffer(GL_FRAMEBUFFER, 0);

	return glf::checkError("initFramebuffer");
}
コード例 #12
0
ファイル: GLHelper.cpp プロジェクト: enginmanap/uberGame
void GLHelper::switchRenderToShadowMap(const unsigned int index) {
    glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
    glBindFramebuffer(GL_FRAMEBUFFER, depthOnlyFrameBuffer);
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthMap, 0, index);

    glClear(GL_DEPTH_BUFFER_BIT);

    glCullFace(GL_FRONT);

}
コード例 #13
0
ファイル: gedraw3d.c プロジェクト: drewet/libge
void geLightInitShadow(ge_Light* light, ge_Shader* shader, int size, int depth, float size_factor){
	light->shadow_depth = depth;
	light->shadow_factor = size_factor;

	light->shadow_fbo = geCreateFramebuffer(size, size);
	glBindFramebuffer(GL_FRAMEBUFFER, light->shadow_fbo->id);
	light->shadow = (ge_Image*)geCreateSurface3D(light->shadow_fbo->texture->width, light->shadow_fbo->texture->height, depth, 0xFFFFFFFF);
	glGenTextures(1, &light->shadow->id);
	glBindTexture(GL_TEXTURE_2D_ARRAY, light->shadow->id);

	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP);
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
#ifndef PLATFORM_mac
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
#endif
	glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);

	glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, light->shadow_fbo->texture->width, light->shadow_fbo->texture->height, depth, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
	glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, light->shadow->id, 0, 0);
/*
	glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RG32F, light->shadow_fbo->texture->width, light->shadow_fbo->texture->height, depth, 0, GL_RG, GL_FLOAT, NULL);
//	glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, light->shadow_fbo->texture->width, light->shadow_fbo->texture->height, depth, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, light->shadow->id, 0, 0);
*/
	glBindFramebuffer(GL_FRAMEBUFFER, 0);
	
//	light->shadow_fbo->texture = light->shadow;
	light->shadow_fbo->depth = light->shadow;
	//shadow->texture = scene->lights[8].shadow;
	light->flags |= GE_LIGHT_HAVE_SHADOW;

	if(shader){
		light->shadow_shader = shader;
	}else{
		light->shadow_shader = geCreateShader();
		geShaderLoadVertexSource(light->shadow_shader, "default_shaders/generic_shadow.vert");
		geShaderLoadFragmentSource(light->shadow_shader, "default_shaders/generic_shadow.frag");
	}

	if(!_ge_shadow_jitter){
		_ge_shadow_jitter = geCreateSurface3D(256, 256, 32, 0x00000000);
		int i;
		for(i=0; i<256*256*32; i++){
			u8 r = rand() % 255;
			u8 g = rand() % 255;
			u8 b = rand() % 255;
			u8 a = rand() % 255;
			_ge_shadow_jitter->data[i] = RGBA(r, g, b, a);
		}
		geUpdateImage((ge_Image*)_ge_shadow_jitter);
	}
}
コード例 #14
0
static GLuint
create_array_fbo_1d(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;
	int layer;

	if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT)
		return 0;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_1D_ARRAY_EXT, tex);
	assert(glGetError() == 0);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage2D(GL_TEXTURE_1D_ARRAY_EXT, i, format,
			     dim, num_layers, 0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	for (layer = 0; layer < num_layers; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  tex,
					  0,
					  layer);
		assert(glGetError() == 0);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			load_texture_1d_array();
			goto done;
		}

		glViewport(0, 0, TEX_WIDTH, 1);
		piglit_ortho_projection(TEX_WIDTH, 1, GL_FALSE);

		glColor4fv(layer_color[layer]);
		piglit_draw_rect(0, 0, TEX_WIDTH / 2, 1);
		glColor4fv(layer_color[(layer + 1) % 4]);
		piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, 1);
	}

done:
	glDeleteFramebuffersEXT(1, &fb);
	glGenerateMipmapEXT(GL_TEXTURE_1D_ARRAY_EXT);
	return tex;
}
コード例 #15
0
ファイル: fbo-array.c プロジェクト: chemecse/piglit
static int
create_array_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	/* allocate empty array texture */
	glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA,
		     BUF_WIDTH, BUF_HEIGHT, num_layers,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	/* draw something into each layer of the array texture */
	for (layer = 0; layer < NUM_LAYERS; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					     GL_COLOR_ATTACHMENT0_EXT,
					     tex,
					     0,
					     layer);

		if (!piglit_check_gl_error(GL_NO_ERROR))
			piglit_report_result(PIGLIT_FAIL);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			fprintf(stderr, "FBO incomplete\n");
			goto done;
		}

		glViewport(0, 0, BUF_WIDTH, BUF_HEIGHT);
		piglit_ortho_projection(BUF_WIDTH, BUF_HEIGHT, GL_FALSE);

		/* solid color quad */
		glColor4fv(layer_color[layer]);
		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
	}


done:
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
コード例 #16
0
	bool GL3FrameBufferProvider::attach_object(GLenum opengl_attachment, const Texture &texture, int level, int zoffset, GLuint texture_target)
	{
		int internal_attachment_offset = decode_internal_attachment_offset(opengl_attachment);

		// Check for object replacement
		bool is_replaced_object = false;
		if (!attached_renderbuffers[internal_attachment_offset].is_null())
		{
			is_replaced_object = true;
			attached_renderbuffers[internal_attachment_offset] = RenderBuffer();
		}
		if (!attached_textures[internal_attachment_offset].is_null())
		{
			is_replaced_object = true;
			attached_textures[internal_attachment_offset] = Texture2D();
		}

		// Store the texture
		attached_textures[internal_attachment_offset] = texture;

		// Bind the renderbuffer
		GL3TextureProvider *gl_texture_provider = dynamic_cast<GL3TextureProvider*>(texture.get_provider());
		if (!gl_texture_provider)
			throw Exception("Invalid texture");

		GLuint texture_type = gl_texture_provider->get_texture_type();
		GLuint texture_handle = gl_texture_provider->get_handle();

		GLenum target = GL_DRAW_FRAMEBUFFER;
		if (bind_target == framebuffer_read)
			target = GL_READ_FRAMEBUFFER;

		if (!texture_target)
			texture_target = texture_type;

		if (texture_type == GL_TEXTURE_1D)
		{
			glFramebufferTexture1D(target, opengl_attachment, texture_target, texture_handle, level);
		}
		else if (texture_type == GL_TEXTURE_2D)
		{
			glFramebufferTexture2D(target, opengl_attachment, texture_target, texture_handle, level);
		}
		else if (texture_type == GL_TEXTURE_3D)
		{
			glFramebufferTexture3D(target, opengl_attachment, texture_target, texture_handle, level, zoffset);
		}
		else if (texture_type == GL_TEXTURE_2D_ARRAY || texture_type == GL_TEXTURE_1D_ARRAY)
		{
			glFramebufferTextureLayer(target, opengl_attachment, texture_handle, level, zoffset);
		}
		return is_replaced_object;
	}
コード例 #17
0
 inline void VL_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
 {
   if (glFramebufferTextureLayer)
     glFramebufferTextureLayer(target, attachment, texture, level, layer);
   else
   if (glFramebufferTextureLayerARB)
     glFramebufferTextureLayerARB(target, attachment, texture, level, layer);
   else
   if (glFramebufferTextureLayerEXT)
     glFramebufferTextureLayerEXT(target, attachment, texture, level, layer);
   else
     VL_UNSUPPORTED_FUNC();
 }
コード例 #18
0
/**
 * Common code the verify attaching an invalid layer of an array texture
 * results in incompleteness.
 */
bool
invalid_array_layer_common(incomplete_fbo_test &t)
{
	const unsigned scale = (t.target == GL_TEXTURE_CUBE_MAP_ARRAY) ? 6 : 1;

	/* The texture has only 8 layers (0 through 7), but try to attach
	 * layer 8 and layer 9 to the FBO.
	 */
	glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
				  t.tex, 0, 8 * scale);

	if (!piglit_check_gl_error(GL_NO_ERROR))
		return t.fail();

	if (!t.check_fbo_status(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
		return t.fail();

	glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
				  t.tex, 0, 9 * scale);

	if (!piglit_check_gl_error(GL_NO_ERROR))
		return t.fail();

	if (!t.check_fbo_status(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
		return t.fail();

	/* Now try layer 7.  This should work.
	 */
	glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
				  t.tex, 0, 7 * scale);

	if (!piglit_check_gl_error(GL_NO_ERROR))
		return t.fail();

	if (!t.check_fbo_status(GL_FRAMEBUFFER_COMPLETE))
		return t.fail();
	return t.pass();
}
コード例 #19
0
void FramebufferManager::FramebufferTexture(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    if (textarget == GL_TEXTURE_2D_ARRAY || textarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
    {
        if (m_EFBLayers > 1)
            glFramebufferTexture(target, attachment, texture, level);
        else
            glFramebufferTextureLayer(target, attachment, texture, level, 0);
    }
    else
    {
        glFramebufferTexture2D(target, attachment, textarget, texture, level);
    }
}
コード例 #20
0
	void GLTextureBuffer::bindToFramebuffer(GLenum attachment, UINT32 zoffset, bool allLayers)
	{
		if(mTarget == GL_TEXTURE_1D || mTarget == GL_TEXTURE_2D)
			allLayers = true;

		if(allLayers)
		{
			switch (mTarget)
			{
			case GL_TEXTURE_1D:
				glFramebufferTexture1D(GL_FRAMEBUFFER, attachment, mFaceTarget, mTextureID, mLevel);
				BS_CHECK_GL_ERROR();
				break;
			case GL_TEXTURE_2D:
				glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, mFaceTarget, mTextureID, mLevel);
				BS_CHECK_GL_ERROR();
				break;
			case GL_TEXTURE_2D_MULTISAMPLE:
				glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, mFaceTarget, mTextureID, 0);
				BS_CHECK_GL_ERROR();
				break;
			case GL_TEXTURE_CUBE_MAP:
			case GL_TEXTURE_3D:
			default: // Texture arrays (binding all layers)
				glFramebufferTexture(GL_FRAMEBUFFER, attachment, mTextureID, mLevel);
				BS_CHECK_GL_ERROR();
				break;
			}
		}
		else
		{
			switch (mTarget)
			{
			case GL_TEXTURE_3D:
				glFramebufferTexture3D(GL_FRAMEBUFFER, attachment, mFaceTarget, mTextureID, mLevel, zoffset);
				BS_CHECK_GL_ERROR();
				break;
			case GL_TEXTURE_CUBE_MAP:
				glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, mFaceTarget, mTextureID, mLevel);
				BS_CHECK_GL_ERROR();
				break;
			default: // Texture arrays
				glFramebufferTextureLayer(GL_FRAMEBUFFER, attachment, mTextureID, mLevel, mFace);
				BS_CHECK_GL_ERROR();
				break;
			}
		}
	}
コード例 #21
0
void GLNonMultiviewRenderTexture::beginRendering(Renderer* renderer)
{
    if (!isReady())
    {
        return;
    }

    bind();
    Image* image = getImage();
    if (image->getDepth() > 1)
    {
        LOGV("GLRenderTexture::beginRendering layer=%d", layer_index_);
        glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, image->getId(), 0, layer_index_);
    }
    GLRenderTexture::beginRendering(renderer);
}
コード例 #22
0
ファイル: clear-color.c プロジェクト: ThirteenFish/piglit
bool
display_layered_texture(int x, int y, int w, int h, int texWidth, int texHeight,
			GLenum textureType, GLuint texture, int layers) {
	GLuint tempFBO;
	int i;
	int dx1, dy1, dx2, dy2;

	dx1 = x;
	dx2 = x+w;

	/* Gen temp fbo */
	glGenFramebuffers(1, &tempFBO);

	/* Loop through each layer, attaching the individual layer to the
	 * temp fbo, then blit fbo to the correct location on screen
	 */
	for(i = 0; i < layers; i++) {
		GLenum framebufferStatus;

		dy1 = y + (i)  *(h/layers);
		dy2 = y + (i+1)*(h/layers);

		glBindFramebuffer(GL_FRAMEBUFFER, tempFBO);
		glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
					  texture, 0, i);

		framebufferStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
		if(framebufferStatus != GL_FRAMEBUFFER_COMPLETE) {
			printf("Framebuffer Status: %s\n",
			       piglit_get_gl_enum_name(framebufferStatus));
			return false;
		}

		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
		glBindFramebuffer(GL_READ_FRAMEBUFFER, tempFBO);
		glBlitFramebuffer(0, 0, texWidth, texHeight,
				  dx1, dy1, dx2, dy2, GL_COLOR_BUFFER_BIT,
				  GL_NEAREST);
	}

	/* Cleanup temp fbo */
	glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
	glDeleteFramebuffers(1, &tempFBO);

	return piglit_check_gl_error(GL_NO_ERROR);
}
コード例 #23
0
void FramebufferObject::attachTexture(Texture* texture, GLenum attachment, int mipLevel, int zSlice) {
	switch(texture->type()) {
		case GL_TEXTURE_1D:
			glFramebufferTexture1D( GL_FRAMEBUFFER, attachment, GL_TEXTURE_1D, *texture, mipLevel );
			break;
		case GL_TEXTURE_3D:
			glFramebufferTexture3D( GL_FRAMEBUFFER, attachment, GL_TEXTURE_3D, *texture, mipLevel, zSlice );
			break;
		case GL_TEXTURE_2D_ARRAY:
			glFramebufferTextureLayer( GL_FRAMEBUFFER, attachment, *texture, mipLevel, zSlice );
			break;
		default: //GL_TEXTURE_2D, GL_TEXTURE_RECTANGLE
			glFramebufferTexture2D( GL_FRAMEBUFFER, attachment, texture->type(), GLuint(*texture), mipLevel );
			break;
	}
	_attachedTextures[attachment] = texture;
}
コード例 #24
0
ファイル: render_texture.cpp プロジェクト: apjagdale/GearVRf
bool RenderTexture::readRenderResult(uint32_t *readback_buffer, long capacity, int eye) {
    long neededCapacity = width_ * height_;
    if (!readback_buffer) {
        LOGE("RenderTexture::readRenderResult: readback_buffer is null");
        return false;
    }

    if (capacity < neededCapacity) {
        LOGE("RenderTexture::readRenderResult: buffer capacity too small "
                     "(capacity %ld, needed %ld)", capacity, neededCapacity);
        return false;
    }
    if (target_ == GL_TEXTURE_2D_ARRAY) {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, renderTexture_gl_read_buffer->id());
        glViewport(0, 0, width_, height_);
        glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gl_texture_->id(), 0,
                                  eye);
    } else {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
        glViewport(0, 0, width_, height_);
        glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target_,
                               gl_texture_->id(), 0);
    }
    glReadBuffer(GL_COLOR_ATTACHMENT0);
    glBindBuffer(GL_PIXEL_PACK_BUFFER, renderTexture_gl_pbo_);
    glPixelStorei(GL_PACK_ALIGNMENT, 1);

    if (!readback_started_) {
        glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, 0);
    }

    int *buf = (int *) glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, neededCapacity * 4,
                                        GL_MAP_READ_BIT);
    if (buf) {
        memcpy(readback_buffer, buf, neededCapacity * 4);
    }

    readback_started_ = false;

    glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
    glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);

    return true;
}
コード例 #25
0
ファイル: render_texture.cpp プロジェクト: apjagdale/GearVRf
/*
 * Bind the framebuffer to the specified layer of the texture array.
 * Create the framebuffer and layered texture if necessary.
 * This function must be called from the GL thread.
 */
bool RenderTextureArray::bindFrameBuffer(int layerIndex) {
    int fbid = getId();
    if (!isReady()) {
        if (renderTexture_gl_frame_buffer_ == nullptr) {
            renderTexture_gl_frame_buffer_ = new GLFrameBuffer();
        }
        glBindTexture(GL_TEXTURE_2D_ARRAY, fbid);
        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
        //   glTexImage3D(GL_TEXTURE_2D_ARRAY,0,GL_RGB8, width,height,depth,0,GL_RGB, GL_UNSIGNED_BYTE,NULL);
        //   glTexImage3D(GL_TEXTURE_2D_ARRAY,0,GL_R16F, width,height,depth,0,GL_RED, GL_HALF_FLOAT,NULL);  // does not work for S6 edge
        //   glTexImage3D(GL_TEXTURE_2D_ARRAY,0,GL_RGB10_A2, width,height,depth,0,GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV,NULL);
        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA8, width(), height(), mNumLayers, 0, GL_RGBA,
                     GL_UNSIGNED_BYTE, NULL);
        glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
        setReady(fbid > 0);
        checkGLError("create RenderTextureArray");
    }
    bind();
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                              fbid, 0, layerIndex);
    checkGLError("RenderTextureArray::bindFrameBuffer");
    int fboStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (fboStatus != GL_FRAMEBUFFER_COMPLETE) {
        LOGE("RenderTextureArray::bindFrameBuffer Could not bind framebuffer: %d", fboStatus);
        switch (fboStatus) {
            case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT :
                LOGE("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
                break;

            case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
                LOGE("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
                break;

            case GL_FRAMEBUFFER_UNSUPPORTED:
                LOGE("GL_FRAMEBUFFER_UNSUPPORTED");
                break;
        }
        return false;
    }
    return true;
}
コード例 #26
0
void GLNonMultiviewRenderTexture::generateRenderTextureLayer(int width, int height)
{
    if (depth_format_ && (renderTexture_gl_render_buffer_ == nullptr))
    {
        renderTexture_gl_render_buffer_ = new GLRenderBuffer();
        glBindRenderbuffer(GL_RENDERBUFFER, renderTexture_gl_render_buffer_->id());
        glRenderbufferStorage(GL_RENDERBUFFER, depth_format_, width, height);
        glBindRenderbuffer(GL_RENDERBUFFER, 0);
    }
    GLRenderImage* image = static_cast<GLRenderImage*>(getImage());
    glBindFramebuffer(GL_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, image->getId(), 0, layer_index_);
    LOGD("LIGHT: generated render texture layer = %d texid = %d", layer_index_, image->getId());
    checkGLError("RenderTexture::generateRenderTextureLayer");
    int fboStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (fboStatus == GL_FRAMEBUFFER_COMPLETE)
    {
        if (depth_format_)
        {
            GLenum attachment =  GL_DEPTH24_STENCIL8_OES == depth_format_ ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT;
            glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER,
                                      renderTexture_gl_render_buffer_->id());
        }
        return;
    }
    LOGE("RenderTexture::generateRenderTextureLayer Could not bind texture %d to framebuffer: %d", image->getId(), fboStatus);
    switch (fboStatus)
    {
        case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT :
        LOGE("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
        break;

        case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
        LOGE("GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");
        break;

        case GL_FRAMEBUFFER_UNSUPPORTED:
        LOGE("GL_FRAMEBUFFER_UNSUPPORTED");
        break;
    }
}
コード例 #27
0
ファイル: render_texture.cpp プロジェクト: apjagdale/GearVRf
void RenderTexture::startReadBack(int layer) {

    if (target_ == GL_TEXTURE_2D_ARRAY) {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, getReadBufferId());
        glViewport(0, 0, width(), height());
        glFramebufferTextureLayer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, getId(), 0, layer);
        glReadBuffer(GL_COLOR_ATTACHMENT0);
    } else {
        glBindFramebuffer(GL_READ_FRAMEBUFFER, renderTexture_gl_frame_buffer_->id());
        glViewport(0, 0, width_, height_);
        glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target_,
                               gl_texture_->id(), 0);
    }
    glReadBuffer(GL_COLOR_ATTACHMENT0);
    glBindBuffer(GL_PIXEL_PACK_BUFFER, renderTexture_gl_pbo_);
    glPixelStorei(GL_PACK_ALIGNMENT, 1);
    glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, 0);

    readback_started_ = true;
    glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
}
bool initFramebuffer()
{
	glGenFramebuffers(1, &FramebufferName);
	glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);

	GLenum DrawBuffers[3];
	DrawBuffers[0] = GL_COLOR_ATTACHMENT0;
	DrawBuffers[1] = GL_COLOR_ATTACHMENT1;
	DrawBuffers[2] = GL_COLOR_ATTACHMENT2;
	glDrawBuffers(3, DrawBuffers);

	for(std::size_t i = TEXTURE_R; i <= TEXTURE_B; ++i)
		glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + GLuint(i - TEXTURE_R), Texture2DName, 0, GLint(i));

	if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
		return false;

	glBindFramebuffer(GL_FRAMEBUFFER, 0);

	return glf::checkError("initFramebuffer");
}
コード例 #29
0
bool
probe_texture_layered_rgb(GLuint texture, int x, int y,
			  int z, int w, int h, int d, const float *expected)
{
	int k;
	GLuint fbo;

	glGenFramebuffers(1, &fbo);
	glBindFramebuffer(GL_FRAMEBUFFER, fbo);

	for(k = 0; k < d; k++ ) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
					  texture, 0, k+z);

		if(!piglit_probe_rect_rgb(0, 0, w, h, &expected[k*3])) {
			printf("Layer: %i\n", k);
			return false;
		}
	}
	return true;
}
コード例 #30
0
	void GL3FrameBufferProvider::detach_object(GLenum opengl_attachment)
	{
		int internal_attachment_offset = decode_internal_attachment_offset(opengl_attachment);

		GLenum target = GL_DRAW_FRAMEBUFFER;
		if (bind_target == framebuffer_read)
			target = GL_READ_FRAMEBUFFER;

		if (!attached_renderbuffers[internal_attachment_offset].is_null())
		{
			glFramebufferRenderbuffer(target, opengl_attachment, GL_RENDERBUFFER, 0);
			attached_renderbuffers[internal_attachment_offset] = RenderBuffer();
		}

		if (!attached_textures[internal_attachment_offset].is_null())
		{
			GL3TextureProvider *gl_texture_provider = dynamic_cast<GL3TextureProvider*>(attached_textures[internal_attachment_offset].get_provider());
			GLuint texture_type = gl_texture_provider->get_texture_type();

			if (texture_type == GL_TEXTURE_1D)
			{
				glFramebufferTexture1D(target, opengl_attachment, texture_type, 0, 0);
			}
			else if (texture_type == GL_TEXTURE_2D)
			{
				glFramebufferTexture2D(target, opengl_attachment, texture_type, 0, 0);
			}
			else if (texture_type == GL_TEXTURE_3D)
			{
				glFramebufferTexture3D(target, opengl_attachment, texture_type, 0, 0, 0);
			}
			else if (texture_type == GL_TEXTURE_2D_ARRAY || texture_type == GL_TEXTURE_1D_ARRAY)
			{
				glFramebufferTextureLayer(target, opengl_attachment, 0, 0, 0);
			}

			attached_textures[internal_attachment_offset] = Texture();
		}
	}