Jump to content

  • Log In with Google      Sign In   
  • Create Account

sidv1210

Member Since 11 May 2012
Offline Last Active Jun 13 2012 12:36 AM

Posts I've Made

In Topic: OpenGL and MFC

13 June 2012 - 12:28 AM

actually the code s big... i have used many classes.... this is the part where i have used wglMakeCurrent


void COpenGL::Init(HDC the_device_context)
{
// Initialise OpenGL

// Get a DC for the OpenGL render window
m_hDC = the_device_context;

// Set the pixel format for this DC
static PIXELFORMATDESCRIPTOR pfd =
{
sizeof (PIXELFORMATDESCRIPTOR), // strcut size
1, // Version number
PFD_DRAW_TO_WINDOW | // Flags, draw to a window,
PFD_SUPPORT_OPENGL | // use OpenGL
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA pixel values
32, // 32-bit color
0, 0, 0, // RGB bits & shift sizes.
0, 0, 0, // Don't care about them
0, 0, // No alpha buffer info
0, 0, 0, 0, 0, // No accumulation buffer
32, // 32-bit depth buffer
0, // No stencil buffer
0, // No auxiliary buffers
PFD_MAIN_PLANE, // Layer type
0, // Reserved (must be 0)
0, // No layer mask
0, // No visible mask
0 // No damage mask
};

int nMyPixelFormatID = ChoosePixelFormat( m_hDC, &pfd );

SetPixelFormat( m_hDC, nMyPixelFormatID, &pfd );

// get a render context for OpenGL
m_hRC = wglCreateContext(m_hDC);
wglMakeCurrent (m_hDC, m_hRC);
}

this is the initialization of my opengl class........ whatelse is required please let me know....

In Topic: OpenGL and MFC

11 June 2012 - 08:53 AM

thank you for your help.... but i have already used wglMakeCurrent function.... m not facing any error... its just that i am not able to render opengl in my 2nd window....

PARTNERS