本文整理汇总了C++中render_context::opengl_api方法的典型用法代码示例。如果您正苦于以下问题:C++ render_context::opengl_api方法的具体用法?C++ render_context::opengl_api怎么用?C++ render_context::opengl_api使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类render_context
的用法示例。
在下文中一共展示了render_context::opengl_api方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
uniform_1ui::apply_value(const render_context& context, const program& p)
{
const opengl::gl_core& glapi = context.opengl_api();
glapi.glUniform1uiv(_location, _elements, &(_value.front()));//&_value);
gl_assert(glapi, leaving uniform_1ui::apply_value());
}
示例2: if
void
uniform_image_sampler_base::apply_value(const render_context& context, const program& p)
{
const opengl::gl_core& glapi = context.opengl_api();
#if SCM_GL_CORE_USE_EXT_DIRECT_STATE_ACCESS
if (_bound_unit >= 0) {
glapi.glProgramUniform1i(p.program_id(), _location, _bound_unit);
}
else if ( glapi.extension_ARB_bindless_texture
&& _resident_handle != 0ull)
{
glapi.glProgramUniformHandleui64ARB(p.program_id(), _location, _resident_handle);
}
#else
if (_bound_unit >= 0) {
glapi.glUniform1i(_location, _bound_unit);
}
else if ( glapi.extension_ARB_bindless_texture
&& _resident_handle != 0ull)
{
glapi.glUniformHandleui64ARB(_location, _resident_handle);
}
#endif
gl_assert(glapi, leaving uniform_1f::apply_value());
}
示例3: assert
void
transform_feedback::end(render_context& in_context)
{
assert(state().ok());
gl_assert(in_context.opengl_api(), entering transform_feedback:end());
const opengl::gl_core& glapi = in_context.opengl_api();
if (active()) {
glapi.glEndTransformFeedback();
}
unbind(in_context);
_active = false;
gl_assert(in_context.opengl_api(), leaving transform_feedback:end());
}
示例4: assert
void
query::end(const render_context& in_context) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
assert(0 != query_id());
assert(0 != query_type());
glapi.glEndQuery(query_type());
gl_assert(glapi, leaving query::end());
}
示例5: assert
void
sync::server_wait(const render_context& in_context,
scm::uint64 in_timeout) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
assert(0 != object());
glapi.glWaitSync(object(), 0, sync_timeout_ignored);
gl_assert(glapi, leaving sync::server_wait());
}
示例6:
void
rasterizer_state::apply(const render_context& in_context,
const float in_line_width,
const float in_point_size,
const rasterizer_state& in_applied_state,
const float in_applied_line_width,
const float in_applied_point_size) const
{
const opengl::gl_core& glapi = in_context.opengl_api();
if (_descriptor._fill_mode != in_applied_state._descriptor._fill_mode) {
glapi.glPolygonMode(GL_FRONT_AND_BACK, util::gl_fill_mode(_descriptor._fill_mode));
gl_assert(glapi, rasterizer_state::apply() after glPolygonMode);
}
if (_descriptor._cull_mode != in_applied_state._descriptor._cull_mode) {
if (_descriptor._cull_mode == CULL_NONE) {
glapi.glDisable(GL_CULL_FACE);
}
else {
glapi.glEnable(GL_CULL_FACE);
glapi.glCullFace(util::gl_cull_mode(_descriptor._cull_mode));
}
gl_assert(glapi, rasterizer_state::apply() after glCullFace);
}
if (_descriptor._front_face != in_applied_state._descriptor._front_face) {
glapi.glFrontFace(util::gl_polygon_orientation(_descriptor._front_face));
gl_assert(glapi, rasterizer_state::apply() after glFrontFace);
}
if (_descriptor._multi_sample != in_applied_state._descriptor._multi_sample) {
if (_descriptor._multi_sample) {
glapi.glEnable(GL_MULTISAMPLE);
}
else {
glapi.glDisable(GL_MULTISAMPLE);
}
gl_assert(glapi, rasterizer_state::apply() after GL_MULTISAMPLE);
}
if (SCM_GL_CORE_OPENGL_CORE_VERSION >= SCM_GL_CORE_OPENGL_CORE_VERSION_400) {
if ( _descriptor._multi_sample
&& _descriptor._sample_shading)
{
glapi.glEnable(GL_SAMPLE_SHADING);
}
else {
glapi.glDisable(GL_SAMPLE_SHADING);
}
gl_assert(glapi, rasterizer_state::apply() after GL_SAMPLE_SHADING);
glapi.glMinSampleShading(math::clamp(_descriptor._min_sample_shading, 0.0f, 1.0f));
gl_assert(glapi, rasterizer_state::apply() after glMinSampleShading);
}
if (_descriptor._scissor_test != in_applied_state._descriptor._scissor_test) {
if (_descriptor._scissor_test) {
glapi.glEnable(GL_SCISSOR_TEST);
}
else {
glapi.glDisable(GL_SCISSOR_TEST);
}
gl_assert(glapi, rasterizer_state::apply() after GL_SCISSOR_TEST);
}
if (_descriptor._smooth_lines != in_applied_state._descriptor._smooth_lines) {
if (_descriptor._smooth_lines) {
glapi.glEnable(GL_LINE_SMOOTH);
}
else {
glapi.glDisable(GL_LINE_SMOOTH);
}
gl_assert(glapi, rasterizer_state::apply() after GL_LINE_SMOOTH);
}
if (in_line_width != in_applied_line_width) { // i do no care about float compare at this point
glapi.glLineWidth(math::max<float>(0.0f, in_line_width));
gl_assert(glapi, rasterizer_state::apply() after glLineWidth);
}
if (in_point_size != in_applied_point_size) { // i do no care about float compare at this point
glapi.glPointSize(math::max<float>(0.0f, in_point_size));
gl_assert(glapi, rasterizer_state::apply() after glPointSize);
}
if (_descriptor._point_state != in_applied_state._descriptor._point_state) {
if (_descriptor._point_state._shader_point_size) {
glapi.glEnable(GL_PROGRAM_POINT_SIZE);
}
else {
glapi.glDisable(GL_PROGRAM_POINT_SIZE);
}
glapi.glPointParameterf(GL_POINT_FADE_THRESHOLD_SIZE, math::max<float>(0.0f, _descriptor._point_state._point_fade_threshold));
glapi.glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, util::gl_origin_mode( _descriptor._point_state._point_origin_mode));
gl_assert(glapi, rasterizer_state::apply() after glPointParameter);
}
gl_assert(glapi, leaving rasterizer_state::apply());
}