Comment initialiser OpenGL (pas OGRE) sur MacOSX ?

Programmation d'applications complexes
Good07
Messages : 308
Inscription : ven. 23/avr./2004 18:08
Localisation : Hérault 34190 Laroque

Message par Good07 »

djes à écrit:
Qu'est-ce que vous me faites, là! Moi pas y en avoir les moyens, ça se voit, sinon j'achèterais un vrai mac! Moi y'en a vouloir monter une machine pas trop chère qui accepte sans trop de difficulté l'install de makko, un truc déjà testé par des bons bidouilleurs
Sinon pour te dépanner il y a ça aussi:

http://materialboys.fr/2008/12/tutoriel ... xperience/

Si mes souvenirs sont bons ça doit faire 128€

Maintenant il faudrait tester car je ne sais pas si ça marche sur toutes les configurations et surtout processeur Intel oblige.
De plus c'est impossible a monter sur un portable puisqu'il faut obligatoirement une prise usb sur carte mère, a moins de pouvoir bricoler un raccord...
Avatar de l’utilisateur
Mindphazer
Messages : 694
Inscription : mer. 24/août/2005 10:42

Message par Mindphazer »

Sinon, tu peux aller ici :
http://maconpc.niloo.fr/
Y'a pas mal de tutoriaux, et c'est en français.

Pour les anglophones, y'a Hackint0sh :
http://www.hackint0sh.org/forum/f104/

ou le site insanelymac :
http://www.insanelymac.com/forum/index.php?showforum=95

En général, la la config est "standard", on arrive à faire tourner Mac OS X sur un PC sans -trop- de problèmes.....
Avatar de l’utilisateur
djes
Messages : 4252
Inscription : ven. 11/févr./2005 17:34
Localisation : Arras, France

Message par djes »

Merci beaucoup! :)
Niffo
Messages : 108
Inscription : dim. 29/août/2004 15:51

Message par Niffo »

Et voici le minimum pour initialiser OpenGL dans une fenêtre PB sans utiliser GLUT :

Code : Tout sélectionner

EnableExplicit

ImportC "/System/Library/Frameworks/OpenGL.framework/OpenGL"
   glClear(mask.l)
   glClearColor(red.f, green.f, blue.f, alpha.f)
EndImport

;IncludeFile "gl.pbi"
#GL_COLOR_BUFFER_BIT               = $00004000
#GL_DEPTH_BUFFER_BIT               = $00000100

ImportC "/System/Library/Frameworks/AGL.framework/AGL"
   aglChoosePixelFormat.l(*gdevs, ndev.i, *attribs.i)
   aglDestroyContext.b(ctx.l);
   aglDestroyPixelFormat(pix.l) 
   aglCreateContext.l(pix.l, share.l)
   aglSetDrawable.b(ctx.l, draw.l)
   aglSetCurrentContext.b(ctx.l)
   aglSwapBuffers(ctx.l)   
EndImport

;IncludeFile "agl.pbi"
#AGL_NONE = 0
#AGL_RGBA = 4
#AGL_DOUBLEBUFFER = 5
#AGL_DEPTH_SIZE = 12

ImportC "/System/Library/Frameworks/Carbon.framework/Carbon"
   GetWindowPort.l(window.l) 
EndImport

OpenWindow (0, 100, 100, 256, 256, "OpenGL Window")

Dim attributes.i(4)
attributes(0) = #AGL_RGBA
attributes(1) = #AGL_DOUBLEBUFFER
attributes(2) = #AGL_DEPTH_SIZE
attributes(3) = 24
attributes(4) = #AGL_NONE
Define.l myAGLContext = #Null
Define.l myAGLPixelFormat
myAGLPixelFormat = aglChoosePixelFormat(#Null, 0, @attributes())
If myAGLPixelFormat
   myAGLContext = aglCreateContext(myAGLPixelFormat, #Null)
   aglSetDrawable(myAGLContext, GetWindowPort(WindowID(0)))
   aglSetCurrentContext(myAGLContext)
   aglDestroyPixelFormat(myAGLPixelFormat)
EndIf

Repeat
   Select WaitWindowEvent(10)
      Case #PB_Event_CloseWindow
         Break
   
      Default
         glClearColor(1, 0, 0, 0)
         glClear(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT) 
         aglSwapBuffers(myAGLContext)
   EndSelect
ForEver
Good07
Messages : 308
Inscription : ven. 23/avr./2004 18:08
Localisation : Hérault 34190 Laroque

Message par Good07 »

Bonjour Niffo,
Ca marche impeccable, magnifique carré rouge. :D
C'est peut-être subjectif mais il me semble que c'est moins rapide qu'avec GLUT.
En tout cas aucun problème.
bombseb
Messages : 445
Inscription : jeu. 25/août/2005 22:59
Localisation : 974
Contact :

Re: Comment initialiser OpenGL (pas OGRE) sur MacOSX ?

Message par bombseb »

Salut,
interressant ce topic
Pour ma part, ce qui me dérange dans PB sur mac ce sont les touches de raccourci qui ne respecte pas le standard du mac
par exemple :
alt+droite -> ne passe pas au mot suivant dans le code
donc alt+shift+droite ne sélectionne pas le mot suivant
pomme+droite ne vas pas à la fin de la ligne

sinon, j'ai eu aussi le problème du startdrawing qui ne voulais pas foncionner, puis j'ai laché l'affaire en me disant que PB était plus adapté à windows malheureusement
d'ailleurs, un autre exemple : Il n'y a pas d'éditeur d'interface pour pb sur Mac.... :cry:
Répondre