PureBasic

Forums PureBasic
Nous sommes le Sam 25/Mai/2013 13:20

Heures au format UTC + 1 heure




Poster un nouveau sujet Répondre au sujet  [ 14 messages ] 
Auteur Message
 Sujet du message: OpenGl Win X64
MessagePosté: Sam 04/Déc/2010 21:21 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Bonjour

Je continue ma découverte d'opengl et j' ai encore un souci, ce coup ci avec win7 x64

Le prog compile parfaitement mais j'obtiens un joili ecran tout noir.
Je charge la Demo du Cube fourni dans les examples et bing un ecran tout noir aussi, pas le moindre cube !

Y' a quoi qui change entre 32/64bits ?

Merci


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Sam 04/Déc/2010 21:43 
Hors ligne
Avatar de l’utilisateur

Inscription: Ven 08/Jan/2010 1:14
Messages: 810
Localisation: Québec, Canada
La démonstration du cube? Laquelle?


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Sam 04/Déc/2010 21:58 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Salut

Dans Exemples\Sources-advanced\OpenGl Cube.pb

Le rendu est Ok en 32bits mais Hs en 64bits

A+


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 5:56 
Hors ligne
Avatar de l’utilisateur

Inscription: Ven 08/Jan/2010 1:14
Messages: 810
Localisation: Québec, Canada
Hmmm...Je ne peux pas t'aider, je ne possède même pas ce dossier! :lol:
J'ai dû l'effacer en même de ma version x86. Désolé! :?


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 9:40 
Hors ligne
Avatar de l’utilisateur

Inscription: Lun 26/Avr/2004 0:40
Messages: 12957
je n'ai pas non plus ce dossier, je n'ai pourtant rien effacé (32 bits) 8O

_________________
Image


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 13:25 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Salut

Vous ne l'avez dans aucune version 32/64bits
Je l'ai dans les 2 versions Win mais pas sous linux

le voila
Code:
;
; Native OpenGL Test
;
; (c) Fantaisie Software
;
; This source is based on an ASM source code found on the web (can't remember which one).
;
; Axis explainations:
;
;             +
;             y
;
;             |
;             |
;  +          |
;  x ---------\
;              \
;               \
;                \
;                  z+
;
; So a rotate on the y axis will take the y axis as center. With OpenGL, we can specify
; positive And negative value. Positive values are always in the same sens as the axis
; (like described on the schmatic, with '+' signs)
;

IncludeFile "OpenGL.pbi"

Global RollAxisX.f
Global RollAxisY.f
Global RollAxisZ.f

Global RotateSpeedX.f
Global RotateSpeedY.f
Global RotateSpeedZ.f

Global ZoomFactor.f

Procedure DrawCube(hdc)
  glPushMatrix_()                  ; Save the original Matrix coordinates
  glMatrixMode_(#GL_MODELVIEW)

  glTranslatef_(0, 0, ZoomFactor)  ;  move it forward a bit

  glRotatef_ (RollAxisX, 1.0, 0, 0) ; rotate around X axis
  glRotatef_ (RollAxisY, 0, 1.0, 0) ; rotate around Y axis
  glRotatef_ (RollAxisZ, 0, 0, 1.0) ; rotate around Z axis

  RollAxisX + RotateSpeedX
  RollAxisY + RotateSpeedY
  RollAxisZ + RotateSpeedZ

  ; clear framebuffer And depth-buffer

  glClear_ (#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)

  ; draw the faces of a cube
 
  ; draw colored faces

  glDisable_(#GL_LIGHTING)
  glBegin_  (#GL_QUADS)
 
  ; Build a face, composed of 4 vertex !
  ; glBegin() specify how the vertexes are considered. Here a group of
  ; 4 vertexes (GL_QUADS) form a rectangular surface.

  ; Now, the color stuff: It's r,v,b but with float values which
  ; can go from 0.0 To 1.0 (0 is .. zero And 1.0 is full intensity)
 
  glNormal3f_ (0,0,1.0)
  glColor3f_  (0,0,1.0)
  glVertex3f_ (0.5,0.5,0.5)   
  glColor3f_  (0,1.0,1.0)         
  glVertex3f_ (-0.5,0.5,0.5)
  glColor3f_  (1.0,1.0,1.0)
  glVertex3f_ (-0.5,-0.5,0.5)
  glColor3f_  (0,0,0)
  glVertex3f_ (0.5,-0.5,0.5)

  ; The other face is the same than the previous one
  ; except the colour which is nice blue To white gradiant

  glNormal3f_ (0,0,-1.0)
  glColor3f_  (0,0,1.0)
  glVertex3f_ (-0.5,-0.5,-0.5)
  glColor3f_  (0,0,1.0)
  glVertex3f_ (-0.5,0.5,-0.5)
  glColor3f_  (1.0,1.0,1.0)
  glVertex3f_ (0.5,0.5,-0.5)
  glColor3f_  (1.0,1.0,1.0)
  glVertex3f_ (0.5,-0.5,-0.5)
 
  glEnd_()
 
  ; draw shaded faces

  glEnable_(#GL_LIGHTING)
  glEnable_(#GL_LIGHT0)
  glBegin_ (#GL_QUADS)

  glNormal3f_ (   0, 1.0,   0)
  glVertex3f_ ( 0.5, 0.5, 0.5)
  glVertex3f_ ( 0.5, 0.5,-0.5)
  glVertex3f_ (-0.5, 0.5,-0.5)
  glVertex3f_ (-0.5, 0.5, 0.5)

  glNormal3f_ (0,-1.0,0)
  glVertex3f_ (-0.5,-0.5,-0.5)
  glVertex3f_ (0.5,-0.5,-0.5)
  glVertex3f_ (0.5,-0.5,0.5)
  glVertex3f_ (-0.5,-0.5,0.5)

  glNormal3f_ (1.0,0,0)
  glVertex3f_ (0.5,0.5,0.5)
  glVertex3f_ (0.5,-0.5,0.5)
  glVertex3f_ (0.5,-0.5,-0.5)
  glVertex3f_ (0.5,0.5,-0.5)

  glNormal3f_ (-1.0,   0,   0)
  glVertex3f_ (-0.5,-0.5,-0.5)
  glVertex3f_ (-0.5,-0.5, 0.5)
  glVertex3f_ (-0.5, 0.5, 0.5)
  glVertex3f_ (-0.5, 0.5,-0.5)

  glEnd_()

  glPopMatrix_()
  glFinish_()

  SwapBuffers_(hdc)
EndProcedure


Procedure HandleError (Result, Text$)
  If Result = 0
    MessageRequester("Error", Text$, 0)
    End
  EndIf
EndProcedure


pfd.PIXELFORMATDESCRIPTOR

FlatMode = 0         ; Enable Or disable the 'Flat' rendering

WindowWidth  = 600   ; The window & GLViewport dimensions
WindowHeight = 600

RotateSpeedX = 5.0   ; The speed of the rotation For the 3 axis
RotateSpeedY = 0
RotateSpeedZ = 5.0

ZoomFactor = 1       ; Distance of the camera. Negative value = zoom back

hWnd = OpenWindow(0, 10, 10, WindowWidth, WindowHeight, "First OpenGL Test")

hdc = GetDC_(hWnd)

pfd\nSize        = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion     = 1
pfd\dwFlags      = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\dwLayerMask  = #PFD_MAIN_PLANE
pfd\iPixelType   = #PFD_TYPE_RGBA
pfd\cColorBits   = 16
pfd\cDepthBits   = 16

pixformat = ChoosePixelFormat_(hdc, pfd)

HandleError( SetPixelFormat_(hdc, pixformat, pfd), "SetPixelFormat()")

hrc = wglCreateContext_(hdc)

HandleError( wglMakeCurrent_(hdc,hrc), "vglMakeCurrent()")

glMatrixMode_(#GL_PROJECTION)

gluPerspective_(30.0, WindowWidth/WindowHeight, 1.0, 10.0)

; position viewer
glMatrixMode_(#GL_MODELVIEW)

glTranslatef_(0, 0, -5.0)

If (FlatMode)
  glShadeModel_(#GL_FLAT)
Else
  glShadeModel_(#GL_SMOOTH)
EndIf

glEnable_(#GL_DEPTH_TEST)   ; Enabled, it slowdown a lot the rendering. It's to be sure than the
                            ; rendered objects are inside the z-buffer.

glEnable_(#GL_CULL_FACE)    ; This will enhance the rendering speed as all the back face will be
                            ; ignored. This works only with CLOSED objects like a cube... Singles
                            ; planes surfaces will be visibles only on one side.

glViewport_(0, 0, WindowWidth-30, WindowHeight-30)

Repeat

  Repeat
    Event = WindowEvent()
   
    Select Event
      Case #PB_Event_CloseWindow
        Quit = 1
    EndSelect
 
  Until Event = 0
 
  DrawCube(hdc)
  Delay(20)
Until Quit = 1


Y' a aussi un include avec les constantes OGL

A+


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 13:37 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Bon, je viens de re-télécharger le fichier purebasic x64, refaire une install propre, et j'ai bien ce fichier.

J'ai cru un instant être tombé dans une faille temporelle :wink:

Peu etre que Fred a fait une modif de l'archive entre votre download et maintenant

A+


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 14:28 
Hors ligne
Avatar de l’utilisateur

Inscription: Dim 09/Oct/2005 16:51
Messages: 5229
Scrat a écrit:
Salut
Dans Exemples\Sources-advanced\OpenGl Cube.pb
Le rendu est Ok en 32bits mais Hs en 64bits



dans la 4.51 j'ai OpenGL.pb et OpenGL.pbi mais pas openGL Cube.pb
Que ce soit pour la x32 ou la x64 windows

_________________
.: Ar-S :. - Windows 8 x64 - Radeon HD 7870 - PB 5.11
LDV MULTIMEDIA : Assistance informatique Isère (38) Oyeu
PURE BASIC forum non officiel : Forum PB


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 14:59 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Oui c'est OpenGl.pb et OpenGl.pbi dans le repertoire "OpenGl Cube"

Et il fonctionne cet exemple en X64 chez toi


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 16:54 
Hors ligne
Avatar de l’utilisateur

Inscription: Dim 09/Oct/2005 16:51
Messages: 5229
Effectivement il ne fonctionne pas sous win7 x64 avec pb x64 4.51
L'écran reste noir.

_________________
.: Ar-S :. - Windows 8 x64 - Radeon HD 7870 - PB 5.11
LDV MULTIMEDIA : Assistance informatique Isère (38) Oyeu
PURE BASIC forum non officiel : Forum PB


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 17:43 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
merci pour la confirmation

Encore un truc bizarre :roll:

le plus etonnant c'est que les exemples de demo ne soient pas testés !

A+


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Dim 05/Déc/2010 23:23 
Hors ligne

Inscription: Mer 21/Jan/2004 18:24
Messages: 1086
c'est peut être lié à une histoire de droit, le système détecte un accès non autorisé à la mémoire vidéo et bloque…

est ce que ça marche en mode fenêtré ? fonction -> glcreate(…)

pat


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Lun 06/Déc/2010 18:26 
Hors ligne
Avatar de l’utilisateur

Inscription: Jeu 29/Juil/2004 16:33
Messages: 2119
Localisation: . <------ ici
Chez moi ça se compile bien,
j'ai installer PureBasic x86 sur mon Windows 7 x64 :D
je vais tester sous purebasic x64



[EDIT]
en effet purebasic x64 lance un écran noir. 8O




@++

_________________
Windows 8 x64, processeur core i7 2.93ghz, mémoire ram 10Go, 2x ati radeon hd 5750 1Go chacune
PureBasic 5.11 x86 & x64 DirectX 11


Haut
 Profil  
 
 Sujet du message: Re: OpenGl Win X64
MessagePosté: Mar 07/Déc/2010 10:10 
Hors ligne

Inscription: Sam 15/Mar/2008 16:00
Messages: 86
Apres pas mal de lecture sur le forum english, j'arrive a afficher un quad sur win32/64 et linux en recuperant le context opengl crée par Purebasic lors de l'utilisation du mode screen/windowedscreen.

pour plaquer les textures c'est un peu plus chaud.
il faut utiliser un import mystere
Code:
Import ""
  PB_Screen_Target
EndImport


et juste apres l'ouverture du context Ogl affecter
Code:
PB_Screen_Target = #GL_TEXTURE_2D


Ensuite avant chaque appel a glEnable(#GL_TEXTURE_2D) il faut faire un glDisable(#GL_TEXTURE_RECTANGLE_ARB)

et enfin pour linux
if faut reinitialiser le viewport apres chaque FlipBuffers()

Bon ...........

A+


Haut
 Profil  
 
Afficher les messages postés depuis:  Trier par  
Poster un nouveau sujet Répondre au sujet  [ 14 messages ] 

Heures au format UTC + 1 heure


Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 0 invités


Vous ne pouvez pas poster de nouveaux sujets
Vous ne pouvez pas répondre aux sujets
Vous ne pouvez pas éditer vos messages
Vous ne pouvez pas supprimer vos messages

Rechercher:
Aller à:  

 


Powered by phpBB © 2008 phpBB Group | Traduction par: phpBB-fr.com
subSilver+ theme by Canver Software, sponsor Sanal Modifiye