Ejemplo n.º 1
0
sge::opengl::texture::mipmap::context::context(
	sge::opengl::info::context const &_info
)
:
	sge::opengl::context::base(),
	generate_mipmap_flag_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				1u
			},
			sge::opengl::info::minor_version{
				4u
			}
		)
		?
			sge::opengl::optional_enum(
				sge::opengl::convert::to_gl_enum<
					GL_GENERATE_MIPMAP
				>()
			)
		:
			sge::opengl::optional_enum()
	),
	generate_mipmap_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				3u
			},
			sge::opengl::info::minor_version{
				0u
			}
		)
		?
			optional_gl_generate_mipmap(
				fcppt::make_ref(
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLGENERATEMIPMAPPROC
						>(
							_info.load_function(
								"glGenerateMipmap"
							)
						)
					)
				)
			)
		:
			optional_gl_generate_mipmap()
	)
{
}
Ejemplo n.º 2
0
sge::opengl::texture::npot_context::npot_context(
	sge::opengl::info::context const &_info
)
:
	sge::opengl::context::base(),
	is_supported_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				2u
			},
			sge::opengl::info::minor_version{
				0u
			}
		)
		||
		sge::opengl::info::extension_supported(
			_info.extensions(),
			sge::opengl::info::extension{
				"GL_ARB_texture_non_power_of_two"
			}
		)
	)
{
}
Ejemplo n.º 3
0
sge::opengl::srgb_context::srgb_context(
	sge::opengl::info::context const &_info
)
:
	sge::opengl::context::base(),
	flag_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				3u
			},
			sge::opengl::info::minor_version{
				0u
			}
		)
		?
			sge::opengl::optional_enum(
				sge::opengl::convert::to_gl_enum<
					GL_FRAMEBUFFER_SRGB
				>()
			)
		:
			sge::opengl::info::extension_supported(
				_info.extensions(),
				sge::opengl::info::extension{
					"GL_EXT_framebuffer_sRGB"
				}
			)
			?
				sge::opengl::optional_enum(
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_SRGB_EXT
					>()
				)
			:
				sge::opengl::optional_enum()
	)
{
}
Ejemplo n.º 4
0
sge::opengl::vf::attribute_context::attribute_context(
	sge::opengl::info::context const &_info
)
:
	sge::opengl::context::base(),
	config_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				2u
			},
			sge::opengl::info::minor_version{
				0u
			}
		)
		?
			sge::opengl::vf::optional_attribute_config(
				sge::opengl::vf::attribute_config(
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLVERTEXATTRIBPOINTERPROC
						>(
							_info.load_function(
								"glVertexAttribPointer"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLENABLEVERTEXATTRIBARRAYPROC
						>(
							_info.load_function(
								"glEnableVertexAttribArray"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLDISABLEVERTEXATTRIBARRAYPROC
						>(
							_info.load_function(
								"glDisableVertexAttribArray"
							)
						)
					)
				)
			)
		:
			sge::opengl::info::extension_supported(
				_info.extensions(),
				sge::opengl::info::extension{
					"GL_ARB_vertex_shader"
				}
			)
			?
				sge::opengl::vf::optional_attribute_config(
					sge::opengl::vf::attribute_config(
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLVERTEXATTRIBPOINTERPROC
							>(
								_info.load_function(
									"glVertexAttribPointerARB"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLENABLEVERTEXATTRIBARRAYPROC
							>(
								_info.load_function(
									"glEnableVertexAttribArrayARB"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLDISABLEVERTEXATTRIBARRAYPROC
							>(
								_info.load_function(
									"glDisableVertexAttribArrayARB"
								)
							)
						)
					)
				)
			:
				sge::opengl::vf::optional_attribute_config()
	)
{
}
Ejemplo n.º 5
0
sge::opengl::fbo::context::context(
	sge::opengl::info::context const &_info
)
:
	sge::opengl::context::base(),
	config_(
		sge::opengl::info::version_at_least(
			_info.version(),
			sge::opengl::info::major_version{
				3u
			},
			sge::opengl::info::minor_version{
				0u
			}
		)
		?
			sge::opengl::fbo::optional_config(
				sge::opengl::fbo::config(
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLGENFRAMEBUFFERSPROC
						>(
							_info.load_function(
								"glGenFramebuffers"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLDELETEFRAMEBUFFERSPROC
						>(
							_info.load_function(
								"glDeleteFramebuffers"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLBINDFRAMEBUFFERPROC
						>(
							_info.load_function(
								"glBindFramebuffer"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLFRAMEBUFFERTEXTURE2DPROC
						>(
							_info.load_function(
								"glFramebufferTexture2D"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLCHECKFRAMEBUFFERSTATUSPROC
						>(
							_info.load_function(
								"glCheckFramebufferStatus"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLGENRENDERBUFFERSPROC
						>(
							_info.load_function(
								"glGenRenderbuffers"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLDELETERENDERBUFFERSPROC
						>(
							_info.load_function(
								"glDeleteRenderbuffers"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLBINDRENDERBUFFERPROC
						>(
							_info.load_function(
								"glBindRenderbuffer"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLRENDERBUFFERSTORAGEPROC
						>(
							_info.load_function(
								"glRenderbufferStorage"
							)
						)
					),
					sge::opengl::deref_fun_ptr(
						sge::opengl::info::cast_function<
							PFNGLFRAMEBUFFERRENDERBUFFERPROC
						>(
							_info.load_function(
								"glFramebufferRenderbuffer"
							)
						)
					),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_COLOR_ATTACHMENT0
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_COMPLETE
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_UNSUPPORTED
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
					>(),
					sge::opengl::convert::to_gl_enum<
						GL_RENDERBUFFER
					>(),
					sge::opengl::fbo::attachment_type{
						sge::opengl::convert::to_gl_enum<
							GL_DEPTH_ATTACHMENT
						>()
					},
					sge::opengl::fbo::optional_attachment_type{
						sge::opengl::fbo::attachment_type{
							sge::opengl::convert::to_gl_enum<
								GL_DEPTH_STENCIL_ATTACHMENT
							>()
						}
					}
				)
			)
		:
			sge::opengl::info::extension_supported(
				_info.extensions(),
				sge::opengl::info::extension{
					"GL_EXT_framebuffer_object"
				}
			)
			?
				sge::opengl::fbo::optional_config(
					sge::opengl::fbo::config(
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLGENFRAMEBUFFERSPROC
							>(
								_info.load_function(
									"glGenFramebuffersEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLDELETEFRAMEBUFFERSPROC
							>(
								_info.load_function(
									"glDeleteFramebuffersEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLBINDFRAMEBUFFERPROC
							>(
								_info.load_function(
									"glBindFramebufferEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLFRAMEBUFFERTEXTURE2DPROC
							>(
								_info.load_function(
									"glFramebufferTexture2DEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLCHECKFRAMEBUFFERSTATUSPROC
							>(
								_info.load_function(
									"glCheckFramebufferStatusEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLGENRENDERBUFFERSPROC
							>(
								_info.load_function(
									"glGenRenderbuffersEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLDELETERENDERBUFFERSPROC
							>(
								_info.load_function(
									"glDeleteRenderbuffersEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLBINDRENDERBUFFERPROC
							>(
								_info.load_function(
									"glBindRenderbufferEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLRENDERBUFFERSTORAGEPROC
							>(
								_info.load_function(
									"glRenderbufferStorageEXT"
								)
							)
						),
						sge::opengl::deref_fun_ptr(
							sge::opengl::info::cast_function<
								PFNGLFRAMEBUFFERRENDERBUFFERPROC
							>(
								_info.load_function(
									"glFramebufferRenderbufferEXT"
								)
							)
						),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_COLOR_ATTACHMENT0_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_COMPLETE_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_UNSUPPORTED_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT
						>(),
						sge::opengl::convert::to_gl_enum<
							GL_RENDERBUFFER_EXT
						>(),
						sge::opengl::fbo::attachment_type{
							sge::opengl::convert::to_gl_enum<
								GL_DEPTH_ATTACHMENT_EXT
							>()
						},
						sge::opengl::fbo::optional_attachment_type{}
					)
				)
			:
				sge::opengl::fbo::optional_config{}
	)
{
}