{"id":804,"date":"2009-09-03T12:11:21","date_gmt":"2009-09-03T03:11:21","guid":{"rendered":"http:\/\/miku39.jp\/blog\/wp\/?p=804"},"modified":"2009-09-03T12:11:21","modified_gmt":"2009-09-03T03:11:21","slug":"opengl%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0%e6%ba%96%e5%82%99","status":"publish","type":"post","link":"http:\/\/miku39.jp\/blog\/wp\/?p=804","title":{"rendered":"OpenGL\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0(\u6e96\u5099)"},"content":{"rendered":"<p>Direct3D\u3068OpenGL\u3069\u3063\u3061\u306b\u3057\u3088\u3046\u3068\u8ff7\u3063\u305f\u3042\u3052\u304fOpenGL\u3067\u904a\u3076\u3053\u3068\u306b\u3002\u306a\u3093\u304b\u306e\u62cd\u5b50\u306bPS3\u30673D\u3084\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u30cd\u3002<br \/>\nOpenGL\u306f\u6614\u306b\u3061\u3087\u308d\u3063\u3068\u30dd\u30ea\u30b4\u30f3\u51fa\u3057\u305f\u304f\u3089\u3044\u306e\u521d\u5fc3\u8005\u540c\u7136\u306a\u306e\u3067\u3001OpenGL\u672c\u5bb6\u30b5\u30a4\u30c8\u3084Google\u983c\u308a\u306b\u57fa\u672c\u304b\u3089\u3002<br \/>\n<!--more--><br \/>\n\u307e\u305aWindows\u3067OpenGL\u3092\u4f7f\u3046\u305f\u3081\u306b\u5fc5\u8981\u306a\u6e96\u5099\u3068\u3057\u3066\u3001\u30ec\u30f3\u30c0\u30fc\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u306e\u4f5c\u6210\u304b\u3089\u3002<br \/>\n\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u4f5c\u308b\u2192\u30d4\u30af\u30bb\u30eb\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3092\u9078\u629e\u3059\u308b\u2192OpenGL\u30ec\u30f3\u30c0\u30fc\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u4f5c\u308b\u306e\u6d41\u308c\u3002<br \/>\n\u30a6\u30a3\u30f3\u30c9\u30a6\u4f5c\u6210\u306fWindows\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u66f8\u304f\u3068\u304d\u306b\u306f\u3042\u305f\u308a\u307e\u3048\u306e\u884c\u70ba\u306a\u306e\u3067\u30b9\u30eb\u30fc\u3059\u308b\u3068\u3057\u3066\u3001\u4ee5\u964d\u306e\u624b\u7d9a\u304d\u306f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u30b5\u30a4\u30c8\u304b\u3089\u30b3\u30d4\u30da\u3002<\/p>\n<pre>void EnableOpenGL(HWND hWnd, HDC * hDC, HGLRC * hRC)\n{\n    PIXELFORMATDESCRIPTOR pfd;\n    int iFormat;\n\n    \/\/ get the device context (DC)\n    *hDC = GetDC( hWnd );\n\n    \/\/ set the pixel format for the DC\n    ZeroMemory( &pfd, sizeof( pfd ) );\n    pfd.nSize = sizeof( pfd );\n    pfd.nVersion = 1;\n    pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;\n    pfd.iPixelType = PFD_TYPE_RGBA;\n    pfd.cColorBits = 32;\n    pfd.cDepthBits = 16;\n    pfd.iLayerType = PFD_MAIN_PLANE;\n    iFormat = ChoosePixelFormat( *hDC, &pfd );\n    SetPixelFormat( *hDC, iFormat, &pfd );\n\n    \/\/ create and enable the render context (RC)\n    *hRC = wglCreateContext( *hDC );\n    wglMakeCurrent( *hDC, *hRC );\n}\n\nvoid DisableOpenGL(HWND hWnd, HDC hDC, HGLRC hRC)\n{\n    wglMakeCurrent( NULL, NULL );\n    wglDeleteContext( hRC );\n    ReleaseDC( hWnd, hDC );\n}\n<\/pre>\n<p>\u3042\u3068\u306f\u3001\u666e\u901a\u306bOpenGL API\u3092\u4f7f\u3046\u3060\u3051\u3067\u304a\uff4b\u3002<\/p>\n<pre>\n\tglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );\n\tglClear( GL_COLOR_BUFFER_BIT );\n\tglPushMatrix();\n\tglBegin(GL_TRIANGLES);\n\tglVertex2f( 0.0, 0.5);\n\tglVertex2f(-0.5, -0.5);\n\tglVertex2f( 0.5, -0.5);\n\tglEnd();\n\tglPopMatrix();\n\tglFlush();\n\tSwapBuffers( dc );\n<\/pre>\n<p>\u3067\u3001\u3053\u3046\u66f8\u304f\u3068\u4e09\u89d2\u5f62\u304c\u30a6\u30a3\u30f3\u30c9\u30a6\u5185\u306b\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3002<\/p>\n<p>OpenGL\u306e\u521d\u671f\u72b6\u614b\u306f\u3001\u30ab\u30e1\u30e9\u5ea7\u6a19\u539f\u70b9\u3067-Z\u65b9\u5411\u306b\u5411\u3044\u3066\u3044\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u305d\u306e\u4ed6\u3082\u308d\u3082\u308d\u3082\u542b\u3081\u3066\u30d3\u30e5\u30fc\u30dd\u30fc\u30c8\u306b\u8868\u793a\u3055\u308c\u308b\u7bc4\u56f2\u304c+1\uff5e-1\u306e\u7bc4\u56f2\u3002\u3061\u306a\u307f\u306b\u5ea7\u6a19\u7cfb\u306f\u53f3\u624b\u7cfb( +X \u304c\u53f3\u3001+Y\u304c\u4e0a\u3001+Z\u304c\u624b\u524d )\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Direct3D\u3068OpenGL\u3069\u3063\u3061\u306b\u3057\u3088\u3046\u3068\u8ff7\u3063\u305f\u3042\u3052\u304fOpenGL\u3067\u904a\u3076\u3053\u3068\u306b\u3002\u306a\u3093\u304b\u306e\u62cd\u5b50\u306bPS3\u30673D\u3084\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u3057\u30cd\u3002 OpenGL\u306f\u6614\u306b\u3061\u3087\u308d\u3063\u3068\u30dd\u30ea\u30b4\u30f3\u51fa\u3057\u305f\u304f\u3089\u3044\u306e\u521d\u5fc3\u8005\u540c\u7136\u306a\u306e\u3067\u3001OpenGL\u672c\u5bb6\u30b5 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[32],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p82ahK-cY","jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=\/wp\/v2\/posts\/804"}],"collection":[{"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=804"}],"version-history":[{"count":0,"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=\/wp\/v2\/posts\/804\/revisions"}],"wp:attachment":[{"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=804"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miku39.jp\/blog\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}