défilement de texture 2D appliquer sur un cube (opengl)
salut
j'ai créer un cube 3D dont j'ai appliquer une texture par face donc six textures ,maintenant je voudrais appliquer 10 textures par exemple et les faire défiler une à une, la même sur les six faces, et 10 secondes plus ou moins par texture
j'utilise une fenetre windows+opengl
j'ai essayer en profitant du rafraichissement de WM_PAINT en passant la fonction "temps()"dans" case WM_PAINT" mais cela ne marche pas :cry:
excuser moi d'être débutant en la matière
comment faire :?:
merci d'avance :D
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void temps()
{
i++;
if(i>0&&i<2)
{
glBindTexture (GL_TEXTURE_2D, texName[0]);
}
else
{
if(i>10&&i<12)
{
glBindTexture (GL_TEXTURE_2D, texName[1]);
}
}
}; |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
LRESULT CALLBACK WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_CREATE:
DC=GetDC (hWnd);
InitPixelFormat (DC);
RC = wglCreateContext (DC);
wglMakeCurrent (DC, RC);
glEnable (GL_DEPTH_TEST);
glClearColor (0,0,1,0);
glEnable(GL_TEXTURE_2D);
LoadTexture1("photo1.bmp");
LoadTexture2("photo2.bmp");
LoadTexture3("photo3.bmp");
LoadTexture4("photo4.bmp");
LoadTexture5("photo5.bmp");
LoadTexture6("photo6.bmp");
break;
case WM_CLOSE:
wglMakeCurrent (NULL, NULL);
wglDeleteContext (RC);
ReleaseDC (hWnd,DC);
PostQuitMessage (0);
break;
case WM_SIZE:
glViewport (0,0,LOWORD (lParam),HIWORD (lParam));
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
gluPerspective (45,(float)(LOWORD(lParam))/(float)(HIWORD(lParam)),1,100);
break;
case WM_PAINT:
temps(); <----------------------
RePaint ();
break;
return 0;
break;
default:
return DefWindowProc (hWnd,uMsg,wParam,lParam);
break;
}
return 0;
} |