瀏覽代碼

GLContext implemented in win

mikymod 12 年之前
父節點
當前提交
78f702b856
共有 2 個文件被更改,包括 19 次插入1 次删除
  1. 17 1
      src/renderers/gl/wgl/GLContext.cpp
  2. 2 0
      src/renderers/gl/wgl/GLContext.h

+ 17 - 1
src/renderers/gl/wgl/GLContext.cpp

@@ -39,23 +39,39 @@ void set_win_handle_window(HWND win)
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-GLContext::GLContext()
+GLContext::GLContext() :
+	m_win_context(NULL)
 {
 {
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void GLContext::create_context()
 void GLContext::create_context()
 {
 {
+	wglMakeCurrent(s_handle_window, m_win_context);
+
+	CE_ASSERT(m_win_context != NULL, "Unable to create a rendering context.");
+
+	//mFull = fullscreen;
+	//mX = x;
+	//mY = y;
+	//mWidth = width;
+	//mHeight = height;
+	//mCreated = true;
+	//SetVisible(true);
+	//GetDevice()->GetRenderer()->ResizeRenderTarget(width, height);
+	//return true;
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void GLContext::destroy_context()
 void GLContext::destroy_context()
 {
 {
+	wglMakeCurrent(NULL, NULL);
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 void GLContext::swap_buffers()
 void GLContext::swap_buffers()
 {
 {
+	SwapBuffers(GetDC(s_handle_window));
 }
 }
 
 
 } // namespace crown
 } // namespace crown

+ 2 - 0
src/renderers/gl/wgl/GLContext.h

@@ -45,6 +45,8 @@ public:
 
 
 private:
 private:
 
 
+	HGLRC 			m_win_context;
+
 };
 };
 
 
 } // namespace crown
 } // namespace crown