Bonjour tout le monde !
Voilà, j'utilise OpenGL et la librairie glfw et je voulais savoir s'il était possible de tracer une sphère avec ?
Sans faire une fonction soit même ;)
(si y a pas je le ferais moi même lol)
Merci d'avance ;)
Version imprimable
Bonjour tout le monde !
Voilà, j'utilise OpenGL et la librairie glfw et je voulais savoir s'il était possible de tracer une sphère avec ?
Sans faire une fonction soit même ;)
(si y a pas je le ferais moi même lol)
Merci d'avance ;)
La réponse m'intéresserai aussi pas mal... ;)
Personne n'a d'idée ?
Pas que je sache et mon ami :google: n'a rien sur ce genre d'information. La bibliothèque GLU est faite pour ce genre de chose....
Jc
Ok dommage, parce qu'utiliser une nouvelle lib juste pr les sphères... Mais je suis sur qu'on lui trouvera d'autres utilités ;)
Mais sinon on peut ne prendre que les fonctions utiles pr tracer la sphère ?
Bonjour,
glut trace une sphère très bien.
OuiCitation:
Envoyé par NiuAge
Exact :Citation:
Bonjour,
glut trace une sphère très bien.
Et ce sera sûrement plus simple. Par contre, à tester si GLUT accepte de le faireCode:
1
2 void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks); void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
avec glfw qui gére la fenêtre.
Jc
Sinon j'ai trouvé ca : (delphi)
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
47
48
49
50 procedure CreateSphere(CX, CY, CZ, Radius : glFloat; N : Integer); {N = précision} var I, J : Integer; theta1,theta2,theta3 : glFloat; X, Y, Z, px, py, pz : glFloat; begin SphereDL :=glGenLists(1); glNewList(SphereDL, GL_COMPILE); if Radius < 0 then Radius :=-Radius; if n < 0 then n := -n; if (n < 4) OR (Radius <= 0) then begin glBegin(GL_POINTS); glVertex3f(CX, CY, CZ); glEnd(); exit; end; for J :=0 to N DIV 2 -1 do begin theta1 := J*2*PI/N - PI/2; theta2 := (J+1)*2*PI/n - PI/2; glBegin(GL_QUAD_STRIP); For I :=0 to N do begin theta3 := i*2*PI/N; x := cos(theta2) * cos(theta3); y := sin(theta2); z := cos(theta2) * sin(theta3); px := CX + Radius*x; py := CY + Radius*y; pz := CZ + Radius*z; glTexCoord2f(1-I/n, 2*(J+1)/n); glVertex3f(px,py,pz); X := cos(theta1) * cos(theta3); Y := sin(theta1); Z := cos(theta1) * sin(theta3); px := CX + Radius*X; py := CY + Radius*Y; pz := CZ + Radius*Z; glTexCoord2f(1-i/n, 2*j/n); glVertex3f(px,py,pz); end; glEnd(); end; glEndList(); end;
Oui c'est le calcul et rendu à la main, je me demande si c'est plus efficace que les versions glut/glu...
Faudrait tester,
Jc