Bonjour,

Voila, j'utilise SharpGl, afin de programmer une petite interface 3D dans une fenêtre OpenGl.
Mon problème : La fonction lookAt ne marche pas, l'objet reste tel qui est et la camera ne bouge pas, mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
        // Fenetre openGl
        float distance = 0f;
        private void OpenGLControl_OpenGLInitialized(object sender, OpenGLEventArgs args)
        {
            //  Enable the OpenGL depth testing functionality.
            args.OpenGL.Enable(OpenGL.GL_DEPTH_TEST);
            args.OpenGL.Enable(OpenGL.GL_TEXTURE_2D);
        }
        private void OpenGLControl_OpenGLDraw(object sender, OpenGLEventArgs args)
        {
            //  Get the OpenGL instance that's been passed to us.
            OpenGL gl = args.OpenGL;
 
            //  Clear the color and depth buffers.
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.ClearColor(255f, 255f, 255f, 0f);
 
            //  Use the 'look at' helper function to position and aim the camera.
            gl.LookAt(this.distance, 5, -5, 0, 0, 0, 0, 1, 0);
 
            foreach (Point point in this.scannerControl.scanActuel.pointsList)
                if(point.Byte != 0) // On vérifie que ce n'est pas un point nul
                    if(point == this.scannerControl.scanActuel.pointsDataGrid.SelectedItem) // Si c'est le point selectionner
                        this.genererGrosCube(gl, point); // On le grossi pour bien le distinguer
                    else
                        this.genererCube(gl, point);
 
            //  Flush OpenGL.
            gl.Flush();
            this.distance += 0.1f;
        }
        private void genererCube(OpenGL gl, Point point)
        {
            gl.LoadIdentity();
 
            //  Move into a more central position.
            gl.Translate(point.CooX, point.CooZ/2 - 4.5, -point.CooY - 15);
 
            //  Provide the cube colors and geometry.
            gl.Begin(OpenGL.GL_QUADS);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(0.02f, 0.02f, -0.02f);
            gl.Vertex(-0.02f, 0.02f, -0.02f);
            gl.Vertex(-0.02f, 0.02f, 0.02f);
            gl.Vertex(0.02f, 0.02f, 0.02f);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(0.02f, -0.02f, 0.02f);
            gl.Vertex(-0.02f, -0.02f, 0.02f);
            gl.Vertex(-0.02f, -0.02f, -0.02f);
            gl.Vertex(0.02f, -0.02f, -0.02f);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(0.02f, 0.02f, 0.02f);
            gl.Vertex(-0.02f, 0.02f, 0.02f);
            gl.Vertex(-0.02f, -0.02f, 0.02f);
            gl.Vertex(0.02f, -0.02f, 0.02f);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(0.02f, -0.02f, -0.02f);
            gl.Vertex(-0.02f, -0.02f, -0.02f);
            gl.Vertex(-0.02f, 0.02f, -0.02f);
            gl.Vertex(0.02f, 0.02f, -0.02f);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(-0.02f, 0.02f, 0.02f);
            gl.Vertex(-0.02f, 0.02f, -0.02f);
            gl.Vertex(-0.02f, -0.02f, -0.02f);
            gl.Vertex(-0.02f, -0.02f, 0.02f);
 
            gl.Color(0.0f, 0.0f, 0.0f);
            gl.Vertex(0.02f, 0.02f, -0.02f);
            gl.Vertex(0.02f, 0.02f, 0.02f);
            gl.Vertex(0.02f, -0.02f, 0.02f);
            gl.Vertex(0.02f, -0.02f, -0.02f);
 
            gl.End();
        }
        private void genererGrosCube(OpenGL gl, Point point)
        {
            gl.LoadIdentity();
 
            //  Move into a more central position.
            gl.Translate(point.CooX, point.CooZ / 2 - 4.5, -point.CooY - 15);
 
            //  Provide the cube colors and geometry.
            gl.Begin(OpenGL.GL_QUADS);
 
            gl.Color(0.0f, 1.0f, 0.0f);
            gl.Vertex(0.1f, 0.1f, -0.1f);
            gl.Vertex(-0.1f, 0.1f, -0.1f);
            gl.Vertex(-0.1f, 0.1f, 0.1f);
            gl.Vertex(0.1f, 0.1f, 0.1f);
 
            gl.Color(1.0f, 0.5f, 0.0f);
            gl.Vertex(0.1f, -0.1f, 0.1f);
            gl.Vertex(-0.1f, -0.1f, 0.1f);
            gl.Vertex(-0.1f, -0.1f, -0.1f);
            gl.Vertex(0.1f, -0.1f, -0.1f);
 
            gl.Color(1.0f, 0.0f, 0.0f);
            gl.Vertex(0.1f, 0.1f, 0.1f);
            gl.Vertex(-0.1f, 0.1f, 0.1f);
            gl.Vertex(-0.1f, -0.1f, 0.1f);
            gl.Vertex(0.1f, -0.1f, 0.1f);
 
            gl.Color(1.0f, 1.0f, 0.0f);
            gl.Vertex(0.1f, -0.1f, -0.1f);
            gl.Vertex(-0.1f, -0.1f, -0.1f);
            gl.Vertex(-0.1f, 0.1f, -0.1f);
            gl.Vertex(0.1f, 0.1f, -0.1f);
 
            gl.Color(0.0f, 0.0f, 1.0f);
            gl.Vertex(-0.1f, 0.1f, 0.1f);
            gl.Vertex(-0.1f, 0.1f, -0.1f);
            gl.Vertex(-0.1f, -0.1f, -0.1f);
            gl.Vertex(-0.1f, -0.1f, 0.1f);
 
            gl.Color(1.0f, 0.0f, 1.0f);
            gl.Vertex(0.1f, 0.1f, -0.1f);
            gl.Vertex(0.1f, 0.1f, 0.1f);
            gl.Vertex(0.1f, -0.1f, 0.1f);
            gl.Vertex(0.1f, -0.1f, -0.1f);
 
            gl.End();
        }
Une idée ?