i have to problem with rendering context.
iam using DGLOpengl Header and i found some Sample code.
and i am create Redering context with this code. its Render to a Tpanel
Code:
FDC:=GetDC(fChwnd);
InitOpenGL;
fpfd.dwFlags := PFD_DRAW_TO_WINDOW OR PFD_SUPPORT_OPENGL OR PFD_DOUBLEBUFFER;
SetPixelFormat ( fDC, ChoosePixelFormat ( fDC, @fpfd ), @fpfd );
fhlgrc:=wglCreateContext ( fDC );
ActivateRenderingContext( fDC, fhlgrc, TRUE );
fStart := GetTickCount;
fElapsedTime:=1;
//load simple glsl shader
fglslsimpleprog := TGLSLProgram.Create();
fglslsimplevert := TGLSLShader.Create('Resources\Shaders\simple.vert');
fglslsimplefrag := TGLSLShader.Create('Resources\Shaders\simple.frag', GL_FRAGMENT_SHADER_ARB);
fglslsimpleprog.Attach(fglslsimplevert);
fglslsimpleprog.Attach(fglslsimplefrag);
fglslsimpleprog.Link;
fglslsimpleprog.Enable;
fglslsimpleprog.Set2F('resolution',fwidth*2,fheight*2);
when Docking or unDocking i call this this code
Code:
fpaint:=false;
fglslsimpleprog.Disable;
DeactivateRenderingContext;
ReleaseDC(fChwnd, fDC);
fchwnd:=hwnd;
fdc:=GetDC(FChwnd);
InitOpenGL;
fpfd.dwFlags := PFD_DRAW_TO_WINDOW OR PFD_SUPPORT_OPENGL OR PFD_DOUBLEBUFFER;
SetPixelFormat ( fDC, ChoosePixelFormat ( fDC, @fpfd ), @fpfd );
fhlgrc:=wglCreateContext ( fDC );
ActivateRenderingContext( fDC, fhlgrc, TRUE );
fglslsimpleprog.Enable;
fpaint:=true;
while Panel Docking There isnt any Problem. But When Undock this Panel its not Render on Panel
What is wrong i dont understand . How i should change rendering Context ?
Bookmarks