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


C++ Framebuffer::attachColor方法代码示例

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


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

示例1: make_fb

  static void make_fb()
  {
    // tcol is a 2D RGB texsize x texsize texture
    //  RGB is a constant that represents 8-bit RGB texture
    //  See the definition of TexFormat enum in texture.h for other values allowed.
    //  Stencil may require new hardware/drivers to work properly.
    tcol = new Texture(RGB,texsize,texsize);

    // tdepth is a depth texture, i.e. it stores depth values as the values of texels.
    tdepth = new Texture(Depth,texsize,texsize);

    // allocate new Framebuffer
    fb = new Framebuffer;

    // attach color and depth textures to it; the tcol texture will play the role of color
    //  buffer and tdepth - of the depth buffer.
    fb->attachColor(tcol);
    fb->attachDepth(tdepth);

    // Print out the status of the frame buffer. In particular, if the textures are of
    //  wrong type/format, the framebuffer will not be `complete', i.e. suitable for
    //  rendering into it. If this is the case, you should get a message complaining
    //  about it in the terminal. For example, it is wrong to use a color texture as
    //  the depth texture or the other way around. The restrictions are mostly common
    //  sense. See specification for more details.
    fb->printLog();
  }
开发者ID:blendmaster,项目名称:npr,代码行数:27,代码来源:viewer.cpp

示例2: initializeGL

  void initializeGL()
  {

    vec2 qbuf[4];
    qbuf[0] = vec2(-1,-1);
    qbuf[1] = vec2(1,-1);
    qbuf[2] = vec2(-1,1);
    qbuf[3] = vec2(1,1);

    Buffer *q = new Buffer(4,qbuf);
    vaQuad = new VertexArray;
    vaQuad->attachAttribute(0,q);

    pgmPhong = Program::createProgram(ShaderFile(Vert,"dpeel-shaders/vtxPhong.glsl"),
				      ShaderFile(Frag,"dpeel-shaders/frgPhong.glsl"));
    pgmQuad = Program::createProgram(ShaderFile(Vert,"dpeel-shaders/vtxQuad.glsl"),
				     ShaderFile(Frag,"dpeel-shaders/frgQuad.glsl"));

    Mesh M(getArgv()[1]);

    center = M.getCenter();
    mx = M.getUpperCorner();
    mn = M.getLowerCorner();
    maxdim = M.getMaxDim();
    ts = M.getTriangleCount();

    vloc = new Buffer(M.getVertexCount(),M.getVertexTable());
    vnormal = new Buffer(M.getVertexCount(),M.getVertexNormals());
    ix = new IndexBuffer(M.getTriangleCount(),M.getTriangleTable());

    vaGouraudPhong = new VertexArray();
    vaGouraudPhong->attachAttribute(0,vloc);
    vaGouraudPhong->attachAttribute(1,vnormal); 

    glDisable(GL_CULL_FACE);
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glClearDepth(0.0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    texsize = 800;
    fb = new Framebuffer;
    tex_depth[0] = new Texture(Depth,texsize,texsize);   // clear
    tex_depth[1] = new Texture(Depth,texsize,texsize);
    tex_color = new Texture(RGBA,texsize,texsize);
    fb->attachDepth(tex_depth[0]);

    glClearDepth(1.0);
    fb->attachColor(tex_color);
    tex_color->bind(1);
    tex_depth[0]->nearest();
    tex_depth[1]->nearest();
    tex_color->nearest();

    beginMenu();
    addMenuEntry("Peeling",do_peel);
    addMenuEntry("Naive",do_naive);
    endMenu();
    glutAttachMenu(GLUT_RIGHT_BUTTON);

    glGenQueries(1,&query);
  }
开发者ID:andrzejszymczak,项目名称:EZGraphics,代码行数:62,代码来源:depthpeel.cpp


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