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


C++ renderScene函数代码示例

本文整理汇总了C++中renderScene函数的典型用法代码示例。如果您正苦于以下问题:C++ renderScene函数的具体用法?C++ renderScene怎么用?C++ renderScene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: glutGet

void GLView::handleIdle()
{
    modcounter++;
    if (!paused) world->update();

    //show FPS
    int currentTime = glutGet( GLUT_ELAPSED_TIME );
    frames++;
    if ((currentTime - lastUpdate) >= 1000) {
        std::pair<int,int> num_herbs_carns = world->numHerbCarnivores();
        sprintf( buf, "FPS: %d NumAgents: %d Carnivors: %d Herbivors: %d Epoch: %d", frames, world->numAgents(), num_herbs_carns.second, num_herbs_carns.first, world->epoch() );
        glutSetWindowTitle( buf );
        frames = 0;
        lastUpdate = currentTime;
    }
    if (skipdraw<=0 && draw) {
        clock_t endwait;
        float mult=-0.005*(skipdraw-1); //ugly, ah well
        endwait = clock () + mult * CLOCKS_PER_SEC ;
        while (clock() < endwait) {}
    }

    if (draw) {
        if (skipdraw>0) {
            if (modcounter%skipdraw==0) renderScene();    //increase fps by skipping drawing
        }
        else renderScene(); //we will decrease fps by waiting using clocks
    }

}
开发者ID:Ramblurr,项目名称:scriptbots,代码行数:30,代码来源:GLView.cpp

示例2: display

void display()
{
	// Compute the MVP (Model View Projection matrix)
	glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Window.TranlationCurrent.y));
	glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Window.RotationCurrent.y, glm::vec3(1.f, 0.f, 0.f));
	glm::mat4 View = glm::rotate(ViewRotateX, Window.RotationCurrent.x, glm::vec3(0.f, 1.f, 0.f));
	glm::mat4 Model = glm::mat4(1.0f);

	{
		glm::mat4 Projection = glm::perspective(45.0f, float(FRAMEBUFFER_SIZE.x) / float(FRAMEBUFFER_SIZE.y), 0.1f, 100.0f);
		glm::mat4 MVP = Projection * View * Model;

		glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
		glViewport(0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);
		renderScene(glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), MVP, Texture2DName);
	}

	{
		glm::mat4 Projection = glm::perspective(45.0f, float(Window.Size.x) / float(Window.Size.y), 0.1f, 100.0f);
		glm::mat4 MVP = Projection * View * Model;

		glBindFramebuffer(GL_FRAMEBUFFER, 0);
		glViewport(0, 0, Window.Size.x, Window.Size.y);
		renderScene(glm::vec4(1.0f, 0.5f, 0.0f, 1.0f), MVP, ColorbufferName);

		glActiveTexture(GL_TEXTURE0);
		glBindTexture(GL_TEXTURE_2D, ColorbufferName);
		glBindSampler(0, SamplerName);
		glGenerateMipmap(GL_TEXTURE_2D);
	}

	glf::checkError("display");
	glf::swapBuffers();
}
开发者ID:Daft-Freak,项目名称:vogl,代码行数:34,代码来源:gl-330-fbo-mipmaps.cpp

示例3: display

void display()
{
	// Compute the MVP (Model View Projection matrix)
	glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f);
	glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Window.TranlationCurrent.y));
	glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Window.RotationCurrent.y, glm::vec3(1.f, 0.f, 0.f));
	glm::mat4 View = glm::rotate(ViewRotateX, Window.RotationCurrent.x, glm::vec3(0.f, 1.f, 0.f));
	glm::mat4 Model = glm::mat4(1.0f);
	glm::mat4 MVP = Projection * View * Model;

	glEnable(GL_SCISSOR_TEST);

	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	glScissor(0, 0, Window.Size.x, Window.Size.y);
	glClear(GL_COLOR_BUFFER_BIT);

	glViewport(0, 0, Window.Size.x, Window.Size.y);
	renderScene(MVP);

	glClearColor(0.0f, 0.5f, 1.0f, 1.0f);
	glScissor(64, 48, 160, 120);
	glClear(GL_COLOR_BUFFER_BIT);

	glViewport(64, 48, 160, 120);
	renderScene(MVP);

	glDisable(GL_SCISSOR_TEST);

	glf::checkError("display");
	glf::swapBuffers();
}
开发者ID:spetz911,项目名称:vog,代码行数:31,代码来源:ogl-210-rasterizer-viewport.cpp

示例4: renderScene

void GM_Debug::updateScene()
{
	renderScene();
	g_engine->resetClipping();
	desktop.DelayedRemove();
	if (killpopup) {
        delete popup;
        popup = NULL;
        killpopup = false;
        renderScene();
	}
}
开发者ID:AdamSC1-ddg,项目名称:yatc,代码行数:12,代码来源:gm_debug.cpp

示例5: display

void display()
{
	glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Window.TranlationCurrent.y));
	glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Window.RotationCurrent.y, glm::vec3(1.f, 0.f, 0.f));
	glm::mat4 View = glm::rotate(ViewRotateX, Window.RotationCurrent.x, glm::vec3(0.f, 1.f, 0.f));
	glm::mat4 Model = glm::mat4(1.0f);

	glEnable(GL_SCISSOR_TEST);
	glDisable(GL_FRAMEBUFFER_SRGB);
	glScissorIndexed(0, 0, 0, Window.Size.x, Window.Size.y);
	glClearBufferfv(GL_COLOR, 0, &glm::vec4(1.0f, 0.5f, 0.0f, 1.0f)[0]);

	{
		glm::mat4 Projection = glm::perspective(45.0f, float(FRAMEBUFFER_SIZE.x) / float(FRAMEBUFFER_SIZE.y), 0.1f, 100.0f);
		glm::mat4 MVP = Projection * View * Model;

		glViewportIndexedf(0, 0, 0, float(FRAMEBUFFER_SIZE.x), float(FRAMEBUFFER_SIZE.y));
		glDisable(GL_FRAMEBUFFER_SRGB);

		glBindFramebuffer(GL_FRAMEBUFFER, FramebufferName);
		glClearBufferfv(GL_COLOR, 0, &glm::vec4(0.0f, 0.0f, 0.0f, 1.0f)[0]);
		renderScene(glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), MVP, Texture2DName);
		glBindFramebuffer(GL_FRAMEBUFFER, 0);
	}

	{
		glm::mat4 Projection = glm::perspective(45.0f, float(Window.Size.x) / float(Window.Size.y), 0.1f, 100.0f);
		glm::mat4 MVP = Projection * View * Model;

		glViewportIndexedfv(0, &glm::vec4(0, 0, Window.Size.x, Window.Size.y)[0]);

		// Correct display
		glScissorIndexed(0, 0, Window.Size.y / 2 - 1, Window.Size.x, Window.Size.y / 2);
		glEnable(GL_FRAMEBUFFER_SRGB);
		glSamplerParameteri(SamplerName, GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT); // GL_DECODE_EXT 
		renderScene(glm::vec4(1.0f, 0.5f, 0.0f, 1.0f), MVP, ColorbufferName);
		glDisable(GL_FRAMEBUFFER_SRGB);

		// Incorrected display
		glScissorIndexed(0, 0, 0, Window.Size.x, Window.Size.y / 2);
		glEnable(GL_FRAMEBUFFER_SRGB);
		glSamplerParameteri(SamplerName, GL_TEXTURE_SRGB_DECODE_EXT, GL_DECODE_EXT); // GL_DECODE_EXT 
		renderScene(glm::vec4(1.0f, 0.5f, 0.0f, 1.0f), MVP, ColorbufferName);
		glDisable(GL_FRAMEBUFFER_SRGB);
	}

	glf::swapBuffers();
	glf::checkError("display");
}
开发者ID:Groovounet,项目名称:ogl-samples-deprecated,代码行数:49,代码来源:gl-420-fbo-srgb-decode-ext.cpp

示例6: display

void display (void)
{
	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glDisable(GL_LIGHTING);
	drawAxis();
	glEnable(GL_LIGHTING);
	glColor3f (1., 0, 0.);
	renderScene();
	float ground[4] = {1,0,0,4};
	myShadowMatrix(ground, position);
	glColor3f (0.5, 0.5, 0.5);
	renderScene();
	glFlush ();
}
开发者ID:baffo88,项目名称:DTU-02561-ComputerGraphics-Ex,代码行数:15,代码来源:02561-07-04-2011-v0.cpp

示例7: mainLoop

/*Main Loop*/
void mainLoop() {
  double oldTime = glfwGetTime(), oldFrameTime = glfwGetTime();
  double currentTime, deltaFrame;

  while (!glfwWindowShouldClose(window)) {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    /*Delta*/
    currentTime = glfwGetTime();
    delta = (currentTime-oldTime);
    deltaFrame = (currentTime-oldFrameTime);
    nFrames++;

    /* Update scene elements */
    world.update();

    /*Draw*/
    renderReflection();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    renderScene(true);

    world.camera.calcMovement(keyState);
    world.camera.move(delta, world.sea.seaLevel + 1.0f);

    glfwSwapBuffers(window);
    glfwPollEvents();

    oldTime = currentTime;
  }
}
开发者ID:ABaptista,项目名称:cg2015,代码行数:31,代码来源:main.cpp

示例8: SRT

void DS_Basic_MRT::buildGBuffers()
{
	HRESULT hr;
	//-- G-Buffsers
	SetRenderTarget SRT(m_pD3DDevice, m_posRT);

	IDirect3DSurface9 *pSurfaceZ = NULL;
	hr = m_posRT_Z->GetSurfaceLevel(0, &pSurfaceZ );

	IDirect3DSurface9 *pSurfaceNormal = NULL;
	hr = m_normalRT->GetSurfaceLevel(0, &pSurfaceNormal );
	
	IDirect3DSurface9 *pSurfaceDiffuse= NULL;
	hr = m_diffuseRT->GetSurfaceLevel(0, &pSurfaceDiffuse );
	
	hr = m_pD3DDevice->SetRenderTarget(1, pSurfaceZ);
	hr = m_pD3DDevice->SetRenderTarget(2, pSurfaceNormal);
	hr = m_pD3DDevice->SetRenderTarget(3, pSurfaceDiffuse);

	pSurfaceZ->Release();
	pSurfaceDiffuse->Release();
	pSurfaceNormal->Release();

	hr = m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, 0, 1, 0);

	hr = m_pEffect->SetTechnique("init_mrt");
	renderScene();

	hr = m_pD3DDevice->SetRenderTarget(1, NULL);
	hr = m_pD3DDevice->SetRenderTarget(2, NULL);
	hr = m_pD3DDevice->SetRenderTarget(3, NULL);

	//hr = D3DXSaveTextureToFile("D:\\test.dds", D3DXIFF_DDS, m_posRT, NULL);
}
开发者ID:neil3d,项目名称:myshaders,代码行数:34,代码来源:DS_Basic_MRT.cpp

示例9: draw

  void draw() {
    glClear(GL_COLOR_BUFFER_BIT);
    gl::MatrixStack & mv = gl::Stacks::modelview();
    gl::MatrixStack & pr = gl::Stacks::projection();

    FOR_EACH_EYE(eye) {
      const PerEyeArg & eyeArgs = eyes[eye];
      frameBuffer.activate();
      glEnable(GL_DEPTH_TEST);
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

      gl::Stacks::with_push(pr, mv, [&]{
        mv.preMultiply(eyeArgs.modelviewOffset);
        pr.preMultiply(eyeArgs.projectionOffset);
        renderScene();
      });

      frameBuffer.deactivate();
      glDisable(GL_DEPTH_TEST);

      viewport(eye);
      distortProgram->use();
      glActiveTexture(GL_TEXTURE1);
      eyeArgs.distortionTexture->bind();
      glActiveTexture(GL_TEXTURE0);
      frameBuffer.color->bind();
      quadGeometry->bindVertexArray();
      quadGeometry->draw();
      gl::VertexArray::unbind();
      gl::Program::clear();
    }
  }
开发者ID:edudemy,项目名称:OculusRiftInAction,代码行数:32,代码来源:Example_8_X_Bad_02_SwivelUI.cpp

示例10: draw

  void draw() {
    static int frameIndex = 0;
    static ovrPosef eyePoses[2];
    ++frameIndex;
    ovrHmd_GetEyePoses(hmd, frameIndex, eyeOffsets, eyePoses, nullptr);

    ovrHmd_BeginFrame(hmd, frameIndex);
    glEnable(GL_DEPTH_TEST);

    for (int i = 0; i < 2; ++i) {
      ovrEyeType eye = hmd->EyeRenderOrder[i];

      const ovrRecti & vp = textures[eye].Header.RenderViewport;
      eyeFramebuffers[eye]->Bind();
      oglplus::Context::Viewport(vp.Pos.x, vp.Pos.y, vp.Size.w, vp.Size.h);
      Stacks::projection().top() = eyeProjections[eye];

      MatrixStack & mv = Stacks::modelview();
      mv.withPush([&]{
        // Apply the per-eye offset & the head pose
        mv.top() = glm::inverse(ovr::toGlm(eyePoses[eye])) * mv.top();
        renderScene();
      });
    };
    oglplus::DefaultFramebuffer().Bind(oglplus::Framebuffer::Target::Draw);

    ovrHmd_EndFrame(hmd, eyePoses, textures);
  }
开发者ID:ritwik1993,项目名称:OculusMatlab,代码行数:28,代码来源:HelloRift.cpp

示例11: firstPersonView

/*Setup a viewport of a first person view from a base.*/
void firstPersonView(float baseRotation, float starRotation, int leftY)
{
    glPushMatrix();
    
    glTranslatef(0.0, 0.0, -2.3);
    /*Rotate on x axis to get the flat ringworld.*/
    glRotatef(-90.0, 1.0, 0.0, 0.0);
    /*Rotate on z to get to a base.*/
    glRotatef(baseRotation, 0.0, 0.0, 1.0);
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(45.0f, 700.0f/350.0f, 0.1f, 100.0f);
    glMatrixMode(GL_MODELVIEW);
    glViewport(0, leftY, 700, 350);

    /*Draw the star background perspective.*/
    glPushMatrix();
    glRotatef(starRotation, 0.0, 1.0, 0.0);
    glTranslatef(0.0, 0.0, -2.2);
    drawStarBackground();
    glPopMatrix();

    renderScene();
    glPopMatrix();
}
开发者ID:JaydenIvanovic,项目名称:SpaceWars,代码行数:27,代码来源:main.c

示例12: QWidget

MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent)
    , m_rendererPanel(new RendererPanel(this))
{

    setlocale(LC_ALL,"C");
    //omp_set_dynamic(1);
    display.resize(512,512);
    layout = new QHBoxLayout();
    layout->addWidget(&display);

    layout->addWidget(m_rendererPanel);

    mainLayout = new QVBoxLayout();
    renderButton = new QPushButton("Render");
    mainLayout->addLayout(layout);
    mainLayout->addWidget(renderButton);

    setLayout(mainLayout);

    m_image = new Image(512, 512);
    display.setImage(m_image);

    connect(renderButton, SIGNAL(clicked()), this, SLOT(renderScene()));
}
开发者ID:kosmo16,项目名称:PathTracer,代码行数:25,代码来源:MainWindow.cpp

示例13: renderScene

void Game::renderScreen()
{
  m_currentCam->setAsCamera();

  renderScene(false);

  PlaneObject *plane = objects->getPlaneObject();
  if(plane != NULL)
  {
    //render plane reticles    
    plane->renderReticle(15.0f, 1.3f);
    plane->renderReticle(8.0f, 1.0f);
    
    if (plane->isPlaneAlive() == false)
    {
      int textY = gRenderer.getScreenY()/2;
      IRectangle rect = IRectangle(0,textY,gRenderer.getScreenX()-1, textY + 30);
      gRenderer.drawText("Press \"Space Bar\" to Respawn",&rect, eTextAlignModeCenter, false);
    }
  }

  gConsole.render();
  if (GameBase::m_renderInfo)
    GameBase::renderInfo();  
}
开发者ID:carussell,项目名称:nvvg,代码行数:25,代码来源:Game.cpp

示例14: update

//extern void update();
void update()
{
	// add any update code here...

	// always re-render the scene..
	renderScene();
}
开发者ID:StephenThomasUWTSD,项目名称:graphicstemplate-new-finalish,代码行数:8,代码来源:GraphicsTemplate.cpp

示例15: onDraw

void onDraw()
{
  /*setViewer O(1)*/
  setMatrixMode(PROJECTION);
  initMatrix();
  setViewer(vertex(eyex, eyey, eyez), vertex(lookx, looky, lookz), vertex(upx, upy, upz));
  setFrustum(10, 10*MAX_H/MAX_W, 4, 25);

  /*createPolygons O(1)*/
  initScene();
  setMatrixMode(MODELVIEW); 
  initMatrix();
  blockWithHole(-5.0,0.0,0.0);
  blockColoured(barx, bary, 0.0);

 
  /*calcData*/
  /*
    For each polygon,
      Go to next triangle if current polygon doesn't face viewer O(1)
      Calculate pixel values of vertices of the triangle O(1)
      clip triangle  //unless you model your scene such that no part ever goes outside the viewport (commentception) O(1)
      For each triangle, O(m*n)
        Add x,y,z position of scan conversion pixels to temp per-polygon table (indexed on y position with min and max x values)
        Also store a min and max x for y=0, y=MAX_Y-1. Add the x,y values for the points in between to the temp table
        Copy temp table to data table with the points between min and max x values filled (in case of conlict, min z value only) O(m*n)
  */

  /*drawPixels*/
  if(q4) innerclipTriangles();
  renderScene();
  glDrawPixels(MAX_W, MAX_H, GL_RGBA, GL_BYTE, data);
  glFlush();
}
开发者ID:suhailsherif,项目名称:Graphics-Lab,代码行数:34,代码来源:main.c


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