De l'openGL sur le bureau

Alcantornet Messages postés 89 Date d'inscription mardi 8 février 2005 Statut Membre Dernière intervention 14 novembre 2007 - 8 déc. 2005 à 13:49
cs_tibur Messages postés 101 Date d'inscription samedi 9 février 2002 Statut Membre Dernière intervention 5 mai 2009 - 9 févr. 2006 à 16:41
Hello le peuple,



J'ai fait une petite horloge en openGL et j'aimerais pouvoir la mettre
à la place de l'arrière plan. Je pense qu'il faut que je lie mon HDC
avec le celui du bureau mais je sais pas comment faire.



Pour le moment mon application s'affiche dans une fenêtre. Voilà la
partie du code, qui à mon avis doit être modifié. Pourriez vous me dire
comment ??



void EnableOpenGL (HWND hWnd, HDC *hDC, HGLRC *hRC){

PIXELFORMATDESCRIPTOR pfd;

int iFormat;



/* get the device context (DC) */

*hDC = GetDC (hWnd);



/* set the pixel format for the DC */

ZeroMemory (&pfd, sizeof (pfd));

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 = 24;

pfd.cDepthBits = 16;

pfd.iLayerType = PFD_MAIN_PLANE;

iFormat = ChoosePixelFormat (*hDC, &pfd);

SetPixelFormat (*hDC, iFormat, &pfd);



/* create and enable the render context (RC) */

*hRC = wglCreateContext( *hDC );

wglMakeCurrent( *hDC, *hRC );



// Initialisation d'OpenGL

glClearColor(0.0,0.0,0.0,0.0);

glShadeModel(GL_SMOOTH);
// Enable Smooth Shading

glClearDepth(1.0f);

// Depth Buffer Setup

glEnable(GL_DEPTH_TEST);
// Enables Depth Testing
(important)


glDepthFunc(GL_LEQUAL);
// The Type Of Depth Testing To Do

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

glEnable(GL_COLOR_MATERIAL);

ReSizeGLScene(wx,wy);

}

1 réponse

cs_tibur Messages postés 101 Date d'inscription samedi 9 février 2002 Statut Membre Dernière intervention 5 mai 2009
9 févr. 2006 à 16:41
J'ai pas essayé, mais tu peux tester ca ...
tib

How do I draw on the Windows Desktop?


<!--[if !supportEmptyParas]--> <!--[endif]-->



<ol start="1" type="1"><li>MyDC =
GetWindowDC(GetDesktopWindow()) // now you can play with DC - MUST FORCE
Repaints on the window if you muck with it! </li><li>Attach
OGL to it here </li><li>Do OGL
stuff here </li><li>Release
OGL here </li><li>ReleaseDC(MyDC)</li></ol>

<!--[if !supportEmptyParas]--> <!--[endif]-->



[David Lannan - [mailto:dlannan@bigpond.com dlannan@bigpond.com]]
0
Rejoignez-nous