Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. OpenGL and VC++ 2005 EE

OpenGL and VC++ 2005 EE

Scheduled Pinned Locked Moved Graphics
helpc++visual-studiographicsgame-dev
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Newbie00
    wrote on last edited by
    #1

    Hi, i'm not sure if i've chosen correct place for my post, but I'm writing an app in VC++ 2005 EE which is going to display some 3D figures on System::Windows::Forms::Panel^ panel The problem: I've written my own class which handles all OpenGL stuff. So all I have to do is: Create new 3D figure object, and draw it with panel's Paint method. Constructor needs panel's HWND, so i did something like this: TFigure *Figure; //pointer to my base class objects Figure = new TCuboid( (HWND)panel->Handle.ToPointer() , panel->Width, panel->Height, 3, 3, 7 ); But this solution doesn't work properly. When i'm trying to initialize OpenGl machine with this code (inside TCuboid construcor): m_gHDC = GetDC( hwnd ); //identifier (window HWND) SetupPixelFormat(); m_hRC = wglCreateContext( m_gHDC ); //identifier (OpenGL graphic context) the variable: m_hRC is NULL and it shouldn't be. GetLastError() returns 2000, which is ERROR_INVALID_PIXEL_FORMAT. I've tried my class code with other IDE and all was fine. This is SetupPixelFormat() definition: void TFigure::SetupPixelFormat() { int nPixelFormat = 0; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0,0,0, 16, 0, 0, PFD_MAIN_PLANE, 0, 0, 0, 0 }; nPixelFormat = ChoosePixelFormat( m_gHDC, &pfd ); SetPixelFormat( m_gHDC, nPixelFormat, &pfd ); } ChoosePixelFormat( m_gHDC, &pfd ); returns 7 Can somebody help me please?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups