Open Gl uchwyt do komponentu

0

Witam walcze z Open GL i poszukuje sposobu na obsługę go nie na obszarze formy ale komponentu.
mam np.:

  private
    { Private declarations }
    uchwytDC : HDC;
.
.
.
uchwytDC:=GetDC(Handle);
GL_UstalFormatPikseli(uchwytDC);
uchwytRC:=wglCreateContext(uchwytDC);

ten kod tworzy uchwyt do formy a jak zrobić coś takiego np do panelu?

0

panel też ma swoje .Handle

, ale nie wiem czy to tak zadziała.
0

Kiedyś miałem taki programik, i jego kod źródłowy.
Inicjował i rysował on OpenGL w panelu, więc to możliwe.
Nie pamiętam niestety, jak on inicjował to. :>

0

void __fastcall TFCOpenGL::TWORZ_GL()
{
angle 	= 0;
ppp 	= 0;
PIXELFORMATDESCRIPTOR pfd;
 int pf;




 dc = GetDC( FCOpenGL->Handle );	//wsadz tutaj panel1->Handle				//identyfikator (uchwyt) okna Windows

 ZeroMemory( &pfd, sizeof( pfd));					//ustalenie typu koloru, buforowania grafiki,
 pfd.nSize = sizeof( pfd);
 pfd.nVersion = 1;
 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
 pfd.iPixelType = PFD_TYPE_RGBA;
 pfd.cColorBits = 32;
 pfd.cDepthBits = 32;  pfd.cStencilBits    = 8;
 pfd.iLayerType = PFD_MAIN_PLANE;

 


  pf = ChoosePixelFormat(dc, &pfd);   // Returns format that most closely matches above pixel format
  SetPixelFormat(dc, pf, &pfd);

  rc = wglCreateContext(dc);    // Rendering Context = window-glCreateContext
  wglMakeCurrent(dc,rc);        // Make the DC (Form1) the rendering Context



  // Initialist GL environment variables
  glInit();


 // Panel1Resize(NULL);    // sets up the perspective
   OnResize(NULL);
  AppStart = GetTickCount();


}

1 użytkowników online, w tym zalogowanych: 0, gości: 1