当前位置: 首页>>代码示例>>C++>>正文


C++ vogl_context_info::is_core_profile方法代码示例

本文整理汇总了C++中vogl_context_info::is_core_profile方法的典型用法代码示例。如果您正苦于以下问题:C++ vogl_context_info::is_core_profile方法的具体用法?C++ vogl_context_info::is_core_profile怎么用?C++ vogl_context_info::is_core_profile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vogl_context_info的用法示例。


在下文中一共展示了vogl_context_info::is_core_profile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

vogleditor_stateTreeTextureItem::vogleditor_stateTreeTextureItem(QString name, QString value, vogleditor_stateTreeItem* parentNode, vogl_texture_state* pState, const vogl_context_info& info)
   : vogleditor_stateTreeItem(name, value, parentNode),
     m_pTexture(pState),
     m_pDiffBaseState(NULL)
{
   QString tmp;

   float fVals[16];
   int iVals[16];

#define STR_INT1(val) tmp.sprintf("%d", val[0])


#define GET_INT(name, num) if (m_pTexture->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecIntItem* pItem = new vogleditor_stateTreeStateVecIntItem(#name, name, 0, m_pTexture->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
#define GET_ENUM(name, num) if (m_pTexture->get_params().get<int>(name, 0, iVals, num)) { vogleditor_stateTreeStateVecEnumItem* pItem = new vogleditor_stateTreeStateVecEnumItem(#name, name, 0, m_pTexture->get_params(), iVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
#define GET_FLOAT(name, num) if (m_pTexture->get_params().get<float>(name, 0, fVals, num)) { vogleditor_stateTreeStateVecFloatItem* pItem = new vogleditor_stateTreeStateVecFloatItem(#name, name, 0, m_pTexture->get_params(), fVals, num, false, this); m_diffableItems.push_back(pItem); this->appendChild(pItem); }
                  GET_INT(GL_TEXTURE_BASE_LEVEL, 1);
                  int base_level = iVals[0];
                  GET_INT(GL_TEXTURE_MAX_LEVEL, 1);
                  GET_FLOAT(GL_TEXTURE_BORDER_COLOR, 4);
                  GET_ENUM(GL_TEXTURE_COMPARE_MODE, 1);
                  GET_ENUM(GL_TEXTURE_COMPARE_FUNC, 1);
                  GET_FLOAT(GL_TEXTURE_LOD_BIAS, 1);
                  GET_ENUM(GL_TEXTURE_MIN_FILTER, 1);
                  GET_ENUM(GL_TEXTURE_MAG_FILTER, 1);
                  GET_FLOAT(GL_TEXTURE_MIN_LOD, 1);
                  GET_FLOAT(GL_TEXTURE_MAX_LOD, 1);
                  GET_ENUM(GL_TEXTURE_SWIZZLE_R, 1);
                  GET_ENUM(GL_TEXTURE_SWIZZLE_G, 1);
                  GET_ENUM(GL_TEXTURE_SWIZZLE_B, 1);
                  GET_ENUM(GL_TEXTURE_SWIZZLE_A, 1);
                  GET_ENUM(GL_TEXTURE_SWIZZLE_RGBA, 4);
                  GET_ENUM(GL_TEXTURE_WRAP_S, 1);
                  GET_ENUM(GL_TEXTURE_WRAP_T, 1);
                  GET_ENUM(GL_TEXTURE_WRAP_R, 1);

                  if (!info.is_core_profile())
                  {
                     GET_ENUM(GL_GENERATE_MIPMAP, 1);
                  }

                  GET_INT(GL_TEXTURE_IMMUTABLE_FORMAT, 1);

                  if (info.supports_extension("GL_EXT_texture_filter_anisotropic"))
                  {
                     GET_FLOAT(GL_TEXTURE_MAX_ANISOTROPY_EXT, 1);
                  }

                  if (info.supports_extension("GL_EXT_texture_sRGB_decode"))
                  {
                     GET_ENUM(GL_TEXTURE_SRGB_DECODE_EXT, 1);
                  }

                  if (!info.is_core_profile() && info.supports_extension("GL_ARB_shadow_ambient"))
                  {
                     GET_FLOAT(GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 1);
                  }

                  if (!info.is_core_profile())
                  {
                     GET_ENUM(GL_DEPTH_TEXTURE_MODE, 1);
                     // TODO
                     //GL_TEXTURE_PRIORITY
                     //GL_TEXTURE_RESIDENT
                  }

                  int num_actual_levels = m_pTexture->get_num_levels();
                  uint num_faces = (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP) ? 6 : 1;

                  for (uint face = 0; face < num_faces; face++)
                  {
                     GLenum face_target_to_query = m_pTexture->get_target();
                     if (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP)
                        face_target_to_query = GL_TEXTURE_CUBE_MAP_POSITIVE_X + face;

                     vogleditor_stateTreeItem* pFaceNode = this;

                     if (m_pTexture->get_target() == GL_TEXTURE_CUBE_MAP)
                     {
                        pFaceNode = new vogleditor_stateTreeItem(enum_to_string(face_target_to_query), "", this);
                        this->appendChild(pFaceNode);
                     }

                     for (int level = base_level; level < num_actual_levels; level++)
                     {
                        vogleditor_stateTreeItem* pLevelNode = new vogleditor_stateTreeItem(tmp.sprintf("Mip level %d", level), "", pFaceNode);
                        pFaceNode->appendChild(pLevelNode);

                        const vogl_state_vector& level_params = m_pTexture->get_level_params(face, level);

                        // TODO: Check for core vs. compat profiles and not query the old stuff
#undef GET_INT
#undef GET_ENUM
#define GET_INT(name, num) if (level_params.get<int>(name, 0, iVals, num)) { pLevelNode->appendChild(new vogleditor_stateTreeStateVecIntItem(#name, name, 0, level_params, iVals, num, false, pLevelNode)); }
#define GET_ENUM(name, num) if (level_params.get<int>(name, 0, iVals, num)) { pLevelNode->appendChild(new vogleditor_stateTreeStateVecEnumItem(#name, name, 0, level_params, iVals, num, false, pLevelNode)); }
                        GET_INT(GL_TEXTURE_WIDTH, 1);
                        GET_INT(GL_TEXTURE_HEIGHT, 1);
                        GET_INT(GL_TEXTURE_DEPTH, 1);
                        GET_ENUM(GL_TEXTURE_INTERNAL_FORMAT, 1);

//.........这里部分代码省略.........
开发者ID:Daft-Freak,项目名称:vogl,代码行数:101,代码来源:vogleditor_statetreetextureitem.cpp

示例2: snapshot

bool vogl_default_framebuffer_state::snapshot(const vogl_context_info &context_info, const vogl_default_framebuffer_attribs &fb_attribs)
{
    VOGL_NOTE_UNUSED(context_info);

    clear();

    m_fb_attribs = fb_attribs;

    // Create compatible GL texture
    // Attach this texture to an FBO
    // Blit default framebuffer to this FBO
    // Capture this texture's state

    vogl_scoped_state_saver framebuffer_state_saver(cGSTReadBuffer, cGSTDrawBuffer);

    vogl_scoped_binding_state orig_framebuffers(GL_DRAW_FRAMEBUFFER, GL_READ_FRAMEBUFFER, GL_TEXTURE_2D, GL_TEXTURE_2D_MULTISAMPLE);

    GL_ENTRYPOINT(glBindFramebuffer)(GL_READ_FRAMEBUFFER, 0);
    VOGL_CHECK_GL_ERROR;

    vogl_scoped_binding_state orig_bindings(GL_PIXEL_PACK_BUFFER, GL_PIXEL_UNPACK_BUFFER);

    GL_ENTRYPOINT(glBindBuffer)(GL_PIXEL_PACK_BUFFER, 0);
    VOGL_CHECK_GL_ERROR;

    GL_ENTRYPOINT(glBindBuffer)(GL_PIXEL_UNPACK_BUFFER, 0);
    VOGL_CHECK_GL_ERROR;

    vogl_scoped_state_saver pixelstore_state_saver(cGSTPixelStore);

    vogl_scoped_state_saver pixeltransfer_state_saver;
    if (!context_info.is_core_profile())
        pixeltransfer_state_saver.save(cGSTPixelTransfer);

    vogl_reset_pixel_store_states();
    if (!context_info.is_core_profile())
        vogl_reset_pixel_transfer_states();

    // TODO: Test multisampled default framebuffers
    const GLenum tex_target = (fb_attribs.m_samples > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;

    for (uint i = 0; i < cDefFramebufferTotal; i++)
    {
        GLenum internal_fmt, pixel_fmt, pixel_type;

        // TODO: This uses fixed pixel formats, and assumes there's always a depth/stencil buffer.
        if (i == cDefFramebufferDepthStencil)
        {
            if ((fb_attribs.m_depth_size + fb_attribs.m_stencil_size) == 0)
                continue;

            GL_ENTRYPOINT(glReadBuffer)(fb_attribs.m_double_buffered ? GL_BACK_LEFT : GL_FRONT_LEFT);

            internal_fmt = GL_DEPTH_STENCIL;
            pixel_fmt = GL_DEPTH_STENCIL;
            pixel_type = GL_UNSIGNED_INT_24_8;
        }
        else
        {
            if ((fb_attribs.m_r_size + fb_attribs.m_g_size + fb_attribs.m_b_size + fb_attribs.m_a_size) == 0)
                continue;

            GL_ENTRYPOINT(glReadBuffer)(g_def_framebuffer_enums[i]);

            internal_fmt = GL_RGBA;
            pixel_fmt = GL_RGBA;
            pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV;
        }

        if (vogl_check_gl_error_internal(true))
            continue;

        // Create texture
        GLuint tex_handle = 0;
        GL_ENTRYPOINT(glGenTextures)(1, &tex_handle);
        VOGL_CHECK_GL_ERROR;

        GL_ENTRYPOINT(glBindTexture)(tex_target, tex_handle);
        VOGL_CHECK_GL_ERROR;

        if (fb_attribs.m_samples > 1)
        {
            GL_ENTRYPOINT(glTexImage2DMultisample)(tex_target,
                fb_attribs.m_samples,
                internal_fmt,
                fb_attribs.m_width,
                fb_attribs.m_height,
                GL_TRUE);
        }
        else
        {
            GL_ENTRYPOINT(glTexImage2D)(tex_target,
                0,
                internal_fmt,
                fb_attribs.m_width,
                fb_attribs.m_height,
                0,
                pixel_fmt,
                pixel_type,
                NULL);
//.........这里部分代码省略.........
开发者ID:guozanhua,项目名称:vogl,代码行数:101,代码来源:vogl_default_framebuffer_state.cpp


注:本文中的vogl_context_info::is_core_profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。