本文整理汇总了C++中CD3DTexture::select方法的典型用法代码示例。如果您正苦于以下问题:C++ CD3DTexture::select方法的具体用法?C++ CD3DTexture::select怎么用?C++ CD3DTexture::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CD3DTexture
的用法示例。
在下文中一共展示了CD3DTexture::select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Combined
void Combined()
{
// Begin rendering the Sobel Filter along the X-axis
gRenderTarget.begin(&gBlurTexture2);
gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));
// Select unfiltered render target to the left side of the screen
gDiffTex.select();
g3D->renderSAQ(0, 0, 256, 256, "GuassianBlurVert");
gRenderTarget.end(); // Finish rendering to the shadow map
// Begin rendering the Sobel Filter along the Y-axis
gRenderTarget.begin(&gBlurTexture1);
gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));
// Select unfiltered render target to the left side of the screen
gBlurTexture2.select();
g3D->renderSAQ(0, 0, 256, 256, "GuassianBlurHorz");
gRenderTarget.end(); // Finish rendering to the shadow map
////// Sobel
// Begin rendering the Sobel Filter along the X-axis
gRenderTarget.begin(&gBlurTexture2);
gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));
// Select unfiltered render target to the left side of the screen
gBlurTexture1.select();
g3D->renderSAQ(0, 0, 256, 256, "SobelFilter");
gRenderTarget.end(); // Finish rendering to the shadow map
}
示例2: RenderScene
void RenderScene()
{
g3D->begin(); // Begin the scene
g3D->clear(D3DCOLOR_XRGB(0,0,0)); // Clear the frame buffer color, z-buffer, and stencil buffer
// Select unfiltered render target to the left side of the screen
gDiffTex.select();
g3D->renderSAQ(0,0,256,256);
gBlurTexture2.select();
g3D->renderSAQ((float)kWinWid-256,0,256,256);
g3D->end();
}
示例3: RenderScene
void RenderScene()
{
g3D->begin(); // Begin the scene
g3D->clear(D3DCOLOR_XRGB(0,0,25)); // Clear the frame buffer color, z-buffer, and stencil buffer
D3DXMATRIX wMat; // world matrix for each object we want to render
// Select the shadow map as the active texture
gShadowMap.select();
// Translate and draw the ground
D3DXMatrixTranslation(&wMat, kGroundPos.x, kGroundPos.y, kGroundPos.z);
g3D->setWorldMatrix(&wMat);
g3D->render("PerPixelLightingWithShadowMap", gGround);
// Translate and draw the box
D3DXMatrixTranslation(&wMat, kBoxPos.x, kBoxPos.y, kBoxPos.z);
g3D->setWorldMatrix(&wMat);
g3D->render("PerPixelLightingWithShadowMap", gBox);
// Translate and draw the sphere
D3DXMatrixTranslation(&wMat, kSherePos.x, kSherePos.y, kSherePos.z);
g3D->setWorldMatrix(&wMat);
g3D->render("PerPixelLightingWithShadowMap", gSphere);
// Draw the tiny sphere representing the light
D3DXMatrixIdentity(&wMat);
D3DXMatrixTranslation(&wMat, gLightPos.x, gLightPos.y, gLightPos.z);
g3D->setWorldMatrix(&wMat);
g3D->render(gLight);
g3D->end();
}
示例4: RenderSobelFilter
void RenderSobelFilter()
{
// Begin rendering the Sobel Filter along the X-axis
gRenderTarget.begin(&gBlurTexture2);
gRenderTarget.clear(D3DCOLOR_XRGB(255, 255, 255));
// Select unfiltered render target to the left side of the screen
gDiffTex.select();
g3D->renderSAQ(0, 0, 256, 256, "SobelFilter");
gRenderTarget.end(); // Finish rendering to the shadow map
}
示例5: WinMain
// Main window program
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
HWND hwnd = NULL;
MSG msg = {0};
WNDCLASSEX wndclassex = {0};
// Init fields we care about
wndclassex.cbSize = sizeof(WNDCLASSEX); // Always set to size of WNDCLASSEX
wndclassex.style = CS_HREDRAW | CS_VREDRAW;
wndclassex.lpfnWndProc = WinProc;
wndclassex.hInstance = hinstance;
wndclassex.lpszClassName = kClassName;
wndclassex.hCursor = (HCURSOR)LoadImage(NULL, MAKEINTRESOURCE(IDC_ARROW),
IMAGE_CURSOR, 0, 0, LR_SHARED);
RegisterClassEx(&wndclassex); // Register the WNDCLASSEX
RECT rect = { 0, 0, kWinWid, kWinHgt }; // Desired window client rect
DWORD winStyleEx = WS_EX_CLIENTEDGE;
DWORD winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
// Adjust window rect so it gives us our desired client rect when we
// create the window
AdjustWindowRectEx(&rect, winStyle, false, winStyleEx);
// Create the window
hwnd = CreateWindowEx(winStyleEx, // Window extended style
kClassName,
"www.GameTutorials.com -- D3D Vertex Buffers",
winStyle, // Window style
CW_USEDEFAULT,
CW_USEDEFAULT,
rect.right - rect.left,
rect.bottom - rect.top,
NULL,
NULL,
hinstance,
NULL);
// Get the client rect and make sure our client is the size we want
GetClientRect(hwnd, &rect);
assert(rect.right == kWinWid && rect.bottom == kWinHgt);
// Init our global 3D object
if(g3D->init(hwnd) == false)
return EXIT_FAILURE; // There's been an error, lets get out of this joint
if(gTexture.load("Texture.jpg") == false)
return EXIT_FAILURE; // There's been an error, lets get out of this joint
// Create and set the vertex buffer in our CD3DMesh object
if(gQuad.setVertexData(gQuadVertexData, kMaxVerts) == false)
return EXIT_FAILURE; // This is bad! The tutorial is officially broken
// Set the perspective matrix once because it will never change
g3D->setProjMatrix(DEG2RAD(60), (float)rect.right / (float)rect.bottom, 1.0f, 8192.0f);
// We set up our view matrix once because it will never change
g3D->setViewMatrix(CPos(0.0f, 0.0f, -5.0f), CPos(0.0f, 0.0f, 0.0f));
ShowWindow(hwnd, ishow);
UpdateWindow(hwnd);
while(1) // While the app is running
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Handle messages from the OS
{
if(msg.message == WM_QUIT)
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else if(LockFrameRate()) // If it is time to draw, do so
{
g3D->begin(); // Begin the scene
g3D->clear(); // Clear the Z-buffer
gTexture.select(); // Select the texture to be used
// Render the textured quad
gQuad.render();
g3D->end(); // End the scene
}
else
Sleep(1); // Give the OS a slice of time to process other things
} // end of while(1)
g3D->deinit(); // Free up CD3DObj
UnregisterClass(kClassName, hinstance); // Free up WNDCLASSEX
return EXIT_SUCCESS; // Application was a success
}