Views est un simple exemple de multiples vues en open Gl
(grâce à différents cadrages avec glViewport)
Source / Exemple :
le code intéressant;
----------------
AffichScene proc
LOCAL Q1:QWORD
LOCAL Q45:QWORD
LOCAL proche:QWORD
LOCAL loin:QWORD
LOCAL quadric:dword
LOCAL quadric1:dword
;initialisation des variables
mov DWORD PTR[ebp-4],3FF00000h ;Q1=1.0f en qword
mov DWORD PTR[ebp-8],0h
mov DWORD PTR[ebp-12],40468000h ;Q45=45.0f en qword
mov DWORD PTR[ebp-16],0h
mov DWORD PTR[ebp-20],3FB99999h ;proche=0.1 f en qword
mov DWORD PTR[ebp-24],9999999Ah
mov DWORD PTR[ebp-28],43960000h;loin=300.0f
mov DWORD PTR[ebp-32],0h
;effacement des buffers
invoke glClear,GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
;ecran n°1 cadre sup gauche d'une fenetre 600/420
invoke glMatrixMode,GL_MODELVIEW
invoke glLoadIdentity
invoke glViewport,0,210,300,210
invoke glColor3f,P0,P1,P0 ;vert
invoke glTranslatef,P0,P0,Zpos
invoke glBegin,GL_TRIANGLES
invoke glVertex3f,P0,P0V25,P0
invoke glVertex3f,P0V25,M0V25,P0
invoke glVertex3f,M0V25,M0V25,P0
invoke glEnd
fld Zpos
fadd delta1
fstp Zpos
invoke glMatrixMode,GL_PROJECTION
invoke glLoadIdentity
invoke gluPerspective,DWORD PTR Q45,DWORD PTR Q45+4,
DWORD PTR Q1,DWORD PTR Q1+4,DWORD PTR proche,
DWORD PTR proche+4,DWORD PTR loin,DWORD PTR loin+4
;ecran n°2 cadre sup droit
invoke glMatrixMode,GL_MODELVIEW
invoke glLoadIdentity
invoke glViewport,300,210,300,210 ;cadre sup droit
invoke glColor3f,P1,P0,P0 ;rouge
invoke glTranslatef,P0,P0,M7
invoke glBegin,GL_TRIANGLES
invoke glVertex3f,P0,P0V25,P0
invoke glVertex3f,P0V25,M0V25,P0
invoke glVertex3f,M0V25,M0V25,P0
invoke glEnd
invoke glMatrixMode,GL_PROJECTION
invoke glLoadIdentity
invoke gluPerspective,DWORD PTR Q45,DWORD PTR Q45+4,
DWORD PTR Q1,DWORD PTR Q1+4,DWORD PTR proche,
DWORD PTR proche+4,DWORD PTR loin,DWORD PTR loin+4
;ecran n°3 cadre inf droit
invoke glMatrixMode,GL_MODELVIEW
invoke glLoadIdentity
invoke glViewport,300,0,300,210 ;cadre inf droit
invoke glColor3f,P1,P0,P1 ;bleu
invoke glTranslatef,P0,P0,M7
invoke glRotatef,angle,P1,P0,P0
invoke gluNewQuadric
mov quadric,eax
invoke gluQuadricDrawStyle,quadric,GLU_LINE
invoke gluSphere,quadric,ray,meri,para
fld angle
fadd delta
fstp angle
invoke glMatrixMode,GL_PROJECTION
invoke glLoadIdentity
invoke gluPerspective,DWORD PTR Q45,DWORD PTR Q45+4,
DWORD PTR Q1,DWORD PTR Q1+4,DWORD PTR proche,
DWORD PTR proche+4,DWORD PTR loin,DWORD PTR loin+4
;ecran n°4 cadre inf gauche
invoke glMatrixMode,GL_MODELVIEW
invoke glLoadIdentity
invoke glViewport,0,0,300,210 ;cadre inf gauche
invoke glColor3f,P1,P1,P1 ;blanc
invoke glTranslatef,P0,P0,M05
invoke glRotatef,P90,P0,P1,P0
invoke glRotatef,angle1,P0,P1,P0
invoke gluNewQuadric
mov quadric1,eax
invoke gluQuadricDrawStyle,quadric1,GLU_LINE
invoke gluCylinder,quadric1,rayBase,raySommet,longCylindre,meri,para
fld angle1
fadd delta
fstp angle1
invoke glMatrixMode,GL_PROJECTION
invoke glLoadIdentity
invoke gluPerspective,DWORD PTR Q45,DWORD PTR Q45+4,
DWORD PTR Q1,DWORD PTR Q1+4,DWORD PTR proche,
DWORD PTR proche+4,DWORD PTR loin,DWORD PTR loin+4
;-----------------------------
invoke SwapBuffers,FGL.Hdl_GetDc
ret
AffichScene endp
;---------------
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.