void Init(HWND hwnd) { // 初期化 // DX9 InitDX(hwnd); }
BOOL CEditRoadLineDlg::OnInitDialog() { CDialog::OnInitDialog(); RECT cRect; cRect.left = (GetSystemMetrics(SM_CXSCREEN) - 1324) >> 1; cRect.right = cRect.left + 1324; cRect.top = (GetSystemMetrics(SM_CYSCREEN) - 836 - 10) >> 1; cRect.bottom = cRect.top + 836; MoveWindow(&cRect, TRUE); cRect.left = 5; cRect.right = 1026; cRect.top = 5; cRect.bottom = 791; GetDlgItem(IDC_STATIC_MAP)->MoveWindow(&cRect, TRUE); cRect.left = 1031; cRect.right = 1319; cRect.top = 2; cRect.bottom = 791; m_ListLoca.MoveWindow(&cRect, TRUE); m_ListLoca.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT); m_ListLoca.InsertColumn(0, "断面名称", LVCFMT_LEFT, 100); m_ListLoca.InsertColumn(1, "所属数据站名", LVCFMT_LEFT, 100); m_ListLoca.InsertColumn(2, "终点数", LVCFMT_LEFT, 100); if(InitDX() != TRUE) { MessageBox("路径编辑界面初始化失败!", "ERROR", MB_OK|MB_ICONERROR); OnCancel(); return FALSE; } UpDateLocaList(); if(m_ListLoca.GetItemCount() > 0) { m_iCurrentIndex = 0; } return TRUE; }
/////////////////////////////////////////////////////////////////////////////////////////////////// /// CelShadeApp::Init /////////////////////////////////////////////////////////////////////////////////////////////////// bool CelShadeApp::Init() { bool success = IvyApp::Init(); if (CelShadeAppUseGL) { #if !(IVY_GL_ES) IVY_PRINT("GLTestApp OpenGL 2.0 Path"); static PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format 32, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 32, // 16Bit Z-Buffer (Depth Buffer) 8, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; m_hDC = GetDC(m_pWindow->GetHwnd()); int PixelFormat = ChoosePixelFormat(m_hDC,&pfd); BOOL setPixFmt = SetPixelFormat(m_hDC, PixelFormat, &pfd); m_hGLRC = wglCreateContext(m_hDC); wglMakeCurrent(m_hDC, m_hGLRC); if( glewInit() != GLEW_OK) { exit(1); } // Error Setup // glDebugMessageCallbackAMD((GLDEBUGPROCAMD)DebugCallbackAMD, NULL); // glDebugMessageEnableAMD(0, 0, 0, NULL, TRUE); //glDebugMessageInsertAMDattribute vec2 in_Position; //attribute vec3 in_Color; ////////////glGetDebugMessageLogAMD const GLubyte* pString = glGetString(GL_VERSION); GLint majorVersion, minorVersion; glGetIntegerv(GL_MAJOR_VERSION, &majorVersion); glGetIntegerv(GL_MINOR_VERSION, &minorVersion); const GLubyte* pExtension = glGetString(GL_EXTENSIONS); IvyLog(reinterpret_cast<const char*>(pExtension)); #endif // !(IVY_GL_ES) } else { InitDX(); DxShader* pVertexShader = DxShader::CreateFromSource(m_pDxData->pD3D11Device, "IvyVsPosTex", IvyVsPosTex,PosTexVertexDesc, PosTexElements); // Setup Camera m_pCamera->Position().x = 0; m_pCamera->Position().y = -3; m_pCamera->Position().z = 4; } return success; }