c++ - Rendering 2D image using OpenGL -


i trying render 2d image using opengl(for rendering) , devil(for loading image). nothing gets rendered. upon error checking have found opengl throws invalid operation on wglmakecurrent call.

following initialization function

void cimagemainview::initializeopengl() {     m_pdc = new cclientdc(this);     m_hdc = m_pdc->getsafehdc();      setuppixelformat();     m_hrc = ::wglcreatecontext(m_hdc);      bool ret = ::wglmakecurrent(m_hdc, m_hrc);     if(!ret){         printf("error making current context\n");     }     printf("wglmakecurrent ");     checkglerror();     getopenglextendedinformation();     ::wglmakecurrent(null, null);     printf("wglmakecurrent null");     checkglerror();      return; } 

setuppixelformat function looks following

void cimagemainview::setuppixelformat() {     static pixelformatdescriptor pfd =      {         sizeof(pixelformatdescriptor),  // size of pfd         1,                              // version number         pfd_draw_to_window |            // support window         pfd_support_opengl |            // support opengl         pfd_doublebuffer,               // double buffered         pfd_type_rgba,                  // rgba type         24,                             // 24-bit 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,                     // accum bits ignored         32,                             // 32-bit z-buffer         0,                              // no stencil buffer         0,                              // no auxiliary buffer         pfd_main_plane,                 // main layer         0,                              // reserved         0, 0, 0                         // layer masks ignored     };      m_pixelformat = ::choosepixelformat(m_hdc, &pfd);     ::setpixelformat(m_hdc, m_pixelformat, &pfd);      return; } 

and lastly error checking function is

void cimagemainview::checkglerror() {  const glenum err = glgeterror(); printf("glerror: %s\n", gluerrorstring(err));  } 

i have view in application renders 3d stuff using opengl. reason?


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -