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


C++ DrawScene函数代码示例

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


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

示例1: DrawScene

void
My_TestGLDrawing::OffscreenTest()
{
    DrawScene();
    WriteToFile("color", "color1_unselected.png");

    // select cube0
    _picker.Pick(GfVec2i(319,221), GfVec2i(320,222));
    DrawScene();
    WriteToFile("color", "color2_cube0_pickable.png");
    HdSelectionSharedPtr selection = _picker.GetSelection();
    HdSelection::HighlightMode mode = HdSelection::HighlightModeSelect;

    TF_VERIFY(selection->GetSelectedPrimPaths(mode).size() == 1);
    TF_VERIFY(selection->GetSelectedPrimPaths(mode)[0] == SdfPath("/cube0"));

    // make cube0 unpickable; it should not let us pick cube1 since it occludes
    SdfPathVector excludePaths = {SdfPath("/cube0")};
    _pickablesCol.SetExcludePaths(excludePaths);
    _picker.SetDoUnpickablesOcclude(true);
    _picker.Pick(GfVec2i(319,221), GfVec2i(320,222));
    DrawScene();
    WriteToFile("color", "color3_cube0_unpickable.png");
    selection = _picker.GetSelection();
    //TF_VERIFY(selection->GetSelectedPrimPaths(mode).size() == 0);
}
开发者ID:PixarAnimationStudios,项目名称:USD,代码行数:26,代码来源:testHdxUnpickablesAsOccluders.cpp

示例2: EventLoop

static void
EventLoop(WindowData *winData)
{
   while (1) {
      static long mask = StructureNotifyMask | ExposureMask | KeyPressMask;
      XEvent event;
      while (XCheckWindowEvent(winData->display, winData->window,
                               mask, &event)) {
         if (event.xany.window == winData->window) {
            switch (event.type) {
            case Expose:
               DrawScene(winData);
               break;
            case ConfigureNotify:
               glViewport(0, 0,
                          event.xconfigure.width, event.xconfigure.height);
               break;
            case KeyPress:
               {
                  char buffer[10];
                  int r;
                  r = XLookupString(&event.xkey, buffer, sizeof(buffer),
                                    NULL, NULL);
                  if (buffer[0] == 27) {
                     /* escape */
                        return;
                  }
               }
            }
         }
      }
      DrawScene(winData);
   }
}
开发者ID:OpenMORDM,项目名称:rgl,代码行数:34,代码来源:demo.c

示例3: GlutDisplay

void GlutDisplay()
{
    switch ( viewMode ) {
        case VIEWMODE_OPENGL:
            if ( dofImage ) {
                if ( dofDrawCount < MAX_DOF_DRAW ) {
                    DrawScene();
                    glReadPixels( 0, 0, camera.imgWidth, camera.imgHeight, GL_RGB, GL_UNSIGNED_BYTE, dofBuffer );
                    for ( int i=0; i<camera.imgWidth*camera.imgHeight; i++ ) {
                        dofImage[i] = (dofImage[i]*dofDrawCount + dofBuffer[i].ToColor())/(dofDrawCount+1);
                    }
                    dofDrawCount++;
                }
                glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
                glDrawPixels( camera.imgWidth, camera.imgHeight, GL_RGB, GL_FLOAT, dofImage );
                if ( dofDrawCount < MAX_DOF_DRAW ) {
                    DrawProgressBar(float(dofDrawCount)/MAX_DOF_DRAW);
                    glutPostRedisplay();
                }
            } else {
                DrawScene();
            }
            break;
        case VIEWMODE_IMAGE:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_RGB, GL_UNSIGNED_BYTE, renderImage.GetPixels() );
            DrawRenderProgressBar();
            break;
        case VIEWMODE_Z:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( ! renderImage.GetZBufferImage() ) renderImage.ComputeZBufferImage();
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetZBufferImage() );
            break;
        case VIEWMODE_SAMPLECOUNT:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( ! renderImage.GetSampleCountImage() ) renderImage.ComputeSampleCountImage();
            glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetSampleCountImage() );
            break;
        case VIEWMODE_IRRADCOMP:
            glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
            if ( renderImage.GetIrradianceComputationImage() ) {
                glDrawPixels( renderImage.GetWidth(), renderImage.GetHeight(), GL_LUMINANCE, GL_UNSIGNED_BYTE, renderImage.GetIrradianceComputationImage() );
            }
            break;
    }
    
    glutSwapBuffers();
}
开发者ID:varunk08,项目名称:raytracing,代码行数:48,代码来源:viewport.cpp

示例4: ChoosePixelFormat

void CMemoryCardView::CRender::ThreadProc()
{
	unsigned int nPixelFormat = ChoosePixelFormat(m_deviceContext, &m_PFD);
	SetPixelFormat(m_deviceContext, nPixelFormat, &m_PFD);
	m_hRC = wglCreateContext(m_deviceContext);
	wglMakeCurrent(m_deviceContext, m_hRC);

	glEnable(GL_TEXTURE_2D);
	glClearColor(1.0, 1.0, 1.0, 1.0);

	while(!m_threadOver)
	{
		while(m_mailBox.IsPending())
		{
			m_mailBox.ReceiveCall();
		}

		Animate();
		DrawScene();
		Sleep(16);
	}

	m_icons.clear();
	wglMakeCurrent(NULL, NULL);
	wglDeleteContext(m_hRC);
}
开发者ID:250394,项目名称:Play-,代码行数:26,代码来源:MemoryCardView.cpp

示例5: PrepareToDraw

void rwxGLView::DrawReconditeScene(){
    PrepareToDraw();

    DrawScene();

    SwapBuffers();
}
开发者ID:aedotcom,项目名称:recondite,代码行数:7,代码来源:rwxGLView.cpp

示例6: printf

void OVRScene::RenderForOneEye(const float* pMview, const float* pPersp) const
{
    printf("Rendering in OVRScene!\n");
    if (m_bDraw == false)
        return;
    if (pMview == false)
        return;
    if (pPersp == false)
        return;

    const glm::mat4 modelview = glm::make_mat4(pMview);
    const glm::mat4 projection = glm::make_mat4(pPersp);

    // Assemble modelview matrix to lock camera in with real world geometry:
    // We still have to use the assembled HMD stereo modelview matrices from OVRSDK05AppSkeleton,
    // but we undo the effects of chassis yaw and position so the frustum follows the viewer.
    if (m_pHmd != NULL)
    {
        const ovrTrackingState ts = ovrHmd_GetTrackingState(m_pHmd, ovr_GetTimeInSeconds());
        const ovrPosef& cp = ts.CameraPose;

        OVR::Matrix4f camMtx = OVR::Matrix4f();
        camMtx *= OVR::Matrix4f::Translation(cp.Position)
            * OVR::Matrix4f(OVR::Quatf(cp.Orientation));

        glm::mat4 ogmat = glm::make_mat4(&camMtx.Transposed().M[0][0]);

        DrawScene(modelview * ogmat, projection);
    }
}
开发者ID:jazztext,项目名称:VRRayTracing,代码行数:30,代码来源:OVRScene.cpp

示例7: while

int DemoBase::RunDemo()
{
	MSG msg = { 0 };

	mTimer.Reset();

	while (msg.message != WM_QUIT)
	{
		if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			mTimer.Tick();

			if (!mAppPaused)
			{
				CalculateFrameStats();
				UpdateScene(mTimer.DeltaTime());
				DrawScene();
			}
			else
			{
				Sleep(100);
			}
		}
	}

	return (int)msg.wParam;
}
开发者ID:akasteven,项目名称:DeferredDemo,代码行数:32,代码来源:DemoBase.cpp

示例8: RENDERING_PASS

void RENDERING_PASS ()
{
	glViewport(0, 0, windowWidth, windowHeight);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// textureMatrix=biasMatrix*lightProjectionMatrix*lightViewMatrix*cameraViewInverse
	// store the coordinate conversion matrix to texture matrix[3]
	// to be used in shader
	glActiveTexture (GL_TEXTURE3);  // use the last texture unit
	glBindTexture (GL_TEXTURE_2D, depthTextureId);

	glMatrixMode (GL_TEXTURE);	glLoadIdentity();
	static float b[16] = {.5, 0,0,0, 0,.5,0,0, 0,0,.5,0, .5,.5,.5,1};
	glMultMatrixf (b);  // scale and bias
	MULT_LIGHT_PROJECTION();
	MULT_LIGHT_MODELVIEW();
	apply_modelview_inverse ();  // camera view inverse 

	glMatrixMode (GL_MODELVIEW);
	
	// three important settings to use depth texture (see notes)

	glUseProgram (program);
	DrawScene();
}
开发者ID:terryfeverpitch,项目名称:GLSL,代码行数:25,代码来源:main-fbo.cpp

示例9: ms_tick

void ms_tick(void)
{
	DrawScene();
	draw_banner();
	
	if (ms.state == MS_EXPANDING)
	{
		ms.expandframe++;
		
		if (ms.expandframe > EXPAND_LENGTH)
			ms.state = MS_DISPLAYED;
		else
			draw_expand();
	}
	
	if (ms.state == MS_DISPLAYED)
	{
		// scan down effect
		if (ms.current_row < map.ysize)
		{
			draw_row(ms.current_row++);
			
			if (ms.current_row < map.ysize)
				draw_row(ms.current_row++);
		}
		
		// draw map
		DrawRect(ms.x - 1, ms.y - 1, ms.x + ms.w, ms.y + ms.h, DK_BLUE);
		DrawSurface(ms.sfc, ms.x, ms.y);
		
		// you-are-here dot
		if (++ms.timer & 8)
			draw_sprite(ms.px, ms.py, SPR_MAP_PIXELS, 4);
		
		// dismissal
		if (ms.lastbuttondown)
		{
			if (!buttondown())
				ms.lastbuttondown = false;
		}
		else if (buttondown())
		{
			ms.state = MS_CONTRACTING;
		}
	}
	else if (ms.state == MS_CONTRACTING)
	{
		ms.expandframe--;
		
		if (ms.expandframe <= 0)
		{
			int param = (ms.return_gm == GM_INVENTORY) ? 1 : 0;
			game.setmode(ms.return_gm, param);
		}
		else
		{
			draw_expand();
		}
	}
}
开发者ID:octopuserectus,项目名称:NXEngine-iOS,代码行数:60,代码来源:map_system.cpp

示例10: DrawShadowMapping

void SceneManager::Draw()
{
    if (MainEngine::_enableShadows)
    {
        DrawShadowMapping();
    }
    else
    {
        glUseProgram(MainEngine::shaders["MainShader"]);
        glUniform1i(glGetUniformLocation(MainEngine::shaders["MainShader"], "bEnableShadowMapping"), 0);
        DrawScene();
        glUseProgram(0);
    }

    // ---- Debug Show Depth Texture
    //glPushMatrix();
    //glOrtho(-int(MainEngine::_mainWindow->getSize().x) / 2, MainEngine::_mainWindow->getSize().x / 2,
    //        -int(MainEngine::_mainWindow->getSize().y) / 2, MainEngine::_mainWindow->getSize().y / 2, 1, 2000);
    //glActiveTexture(GL_TEXTURE0);
    //glBindTexture(GL_TEXTURE_2D, MainEngine::m_shadowMapFBO.GetShadowMap());
    //glEnable(GL_TEXTURE_2D);
    //glTranslated(0, 0, - 1);
    //glBegin(GL_QUADS);
    //glTexCoord2d(0, 0); glVertex3f(0, 0, 0);
    //glTexCoord2d(1, 0); glVertex3f(MainEngine::_mainWindow->getSize().x / 2, 0, 0);
    //glTexCoord2d(1, 1); glVertex3f(MainEngine::_mainWindow->getSize().x / 2, MainEngine::_mainWindow->getSize().y / 2, 0);
    //glTexCoord2d(0, 1); glVertex3f(0, MainEngine::_mainWindow->getSize().y / 2, 0);
    //glEnd();
    //glDisable(GL_TEXTURE_2D);
    //glPopMatrix();
}
开发者ID:domzhaosh,项目名称:BumpShadowRefr-Mapping,代码行数:31,代码来源:SceneManager.cpp

示例11: SHADOW_MAP_PASS

void SHADOW_MAP_PASS()   // NON-FBO Version
{
	glClear(GL_DEPTH_BUFFER_BIT);  // no output to colorbuffer

	glViewport(0, 0, shadowMapSize, shadowMapSize);
	glMatrixMode(GL_PROJECTION); glPushMatrix();   glLoadIdentity();// save current projection
	MULT_LIGHT_PROJECTION();  // light projection

	glMatrixMode(GL_MODELVIEW);	glPushMatrix();  glLoadIdentity(); // viewer: save current modelview (containing Viewing of camera)
	MULT_LIGHT_MODELVIEW();   // light view

	// disable texturing in the first pass (if any)
	// disable lighting too

	glPushAttrib (GL_ENABLE_BIT | GL_LIGHTING_BIT | GL_COLOR_BUFFER_BIT);
		//Disable color writes, and use flat shading for speed
		glColorMask(0, 0, 0, 0);  // color buffer bit
		glShadeModel(GL_FLAT);    // lighting bit
		glDisable (GL_LIGHTING);
		glDisable (GL_TEXTURE_2D);

		glPolygonOffset (8.0, 4.0); // IMPORTANT: to remove moire pattern (from z-fighting)
		glEnable (GL_POLYGON_OFFSET_FILL);
		
		glUseProgram(0);
		DrawScene(); // Draw the scene (fixed function)
	glPopAttrib();

	glMatrixMode(GL_PROJECTION); glPopMatrix();  // restore current projection
	glMatrixMode(GL_MODELVIEW); glPopMatrix();  // restore Modelview to Vcamera

	//Read the depth buffer into the shadow map texture
	glActiveTexture (GL_TEXTURE3);
	glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, shadowMapSize, shadowMapSize);
}
开发者ID:terryfeverpitch,项目名称:GLSL,代码行数:35,代码来源:main.cpp

示例12: messageloop

int messageloop(){
	MSG msg;
	ZeroMemory(&msg, sizeof(MSG));
	while(true)
	{
		BOOL PeekMessageL( 
			LPMSG lpMsg,
			HWND hWnd,
			UINT wMsgFilterMin,
			UINT wMsgFilterMax,
			UINT wRemoveMsg
			);

		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			if (msg.message == WM_QUIT)
				break;
			TranslateMessage(&msg);	
			DispatchMessage(&msg);
		}
		else{
			// run game code            
			UpdateScene();
			DrawScene();
		}
	}
	return msg.wParam;
}
开发者ID:ezeroone02,项目名称:Braynzar_Soft_Tutorials_DX11_Exercise,代码行数:28,代码来源:main.cpp

示例13: DrawScene

void CCg3DTransView::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	DrawScene();

	CView::OnTimer(nIDEvent);
}
开发者ID:pobingwanghai,项目名称:cg3DTrans-Final,代码行数:7,代码来源:cg3DTransView.cpp

示例14: Test3

void Test3()
{
	LoadBCP("data.bcp");
	ReadLanguageFile();
	InitWindow();
	//InitRectDrawing();
	//IDirect3DTexture9 *mytex = GetTexture("Interface\\LOADING SCREEN 1.tga");
	//IDirect3DPixelShader9 *psh = LoadPixelShader("test.psh");
	InitScene(); LoadMap("testmap.bcm");
	while(!appexit)
	{
		BeginDrawing();
		//ddev->SetRenderState(D3DRS_ZENABLE, FALSE);
		//ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
		//ddev->SetPixelShader(psh);
		//ddev->SetTexture(0, mytex);
		//DrawRect(0, 0, 640, 480, -1);
		DrawScene();
		EndDrawing();
		HandleWindow();

		if(keyheld[VK_UP]) camerapos += Vector3(0.0f, 0.0f, walkstep);
		if(keyheld[VK_DOWN]) camerapos -= Vector3(0.0f, 0.0f, walkstep);
		if(keyheld[VK_LEFT]) camerapos -= Vector3(walkstep, 0.0f, 0.0f);
		if(keyheld[VK_RIGHT]) camerapos += Vector3(walkstep, 0.0f, 0.0f);
		if(keyheld['E']) camerapos += Vector3(0.0f, walkstep, 0.0f);
		if(keyheld['D']) camerapos -= Vector3(0.0f, walkstep, 0.0f);
	}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:29,代码来源:test.cpp

示例15: InitGL

void ViewWindow::draw ()
{
	//bool use_solid = false; // unused

	if(!valid ())
		InitGL ();

	glClearColor(backgroundColor.x,backgroundColor.y,backgroundColor.z,0.0f);
	glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadIdentity ();
	SetupProjectionMatrix ();

	bSelecting=false;
	selector_count=0;

	DrawScene ();
	SetRasterMatrix ();
	Draw2D ();

	if (bBoxSelect)
	{
		fltk::glsetcolor(fltk::WHITE);
		fltk::glstrokerect(click.x,click.y,last.x-click.x, last.y-click.y);
	}
}
开发者ID:SpliFF,项目名称:upspring,代码行数:27,代码来源:View.cpp


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