Mon but est de creer une class me permettant d'afficher une sphere.
Mais le constructeur me pose problème. Il n'y a pas de problème lors du build, le problème survient lors du deguger.

J'y comprend pas grand chose au debugeur et j’espère que quelqu’un pourra m'aider sur ce point là, il me sort
Unhandled exception at 0x77CC016E (ntdll.dll) in gravitation.exe: 0x00000000: L’opération a réussi.
et il me "relie" à mlock.c (qqch lier au multi-thread locking) et dbgheap.c (qui semble lier au debugeur).

Je suis débutant en openGL donc si vous trouvez que je fait n'importe quoi hésiter pas à me le dire ^^

le header
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
#include <GL/glew.h>
 
#include "Matrice.h"
#include "Shader.h"
 
class Sphere
{
    public:
 
    Sphere(float rayon, int precision_horizon, int precision_verticale);
    ~Sphere();
 
    void afficher(Matrice &projection, Matrice &modelview);
 
 
    private:
 
    Shader m_shaderCouleur;
    float *m_vertices;
    unsigned int *m_indices;
	unsigned int *indices_size;
 
    float *m_rouge;
    float *m_vert;
    float *m_bleu;
};

le constructeur du cpp
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
Sphere::Sphere( float rayon, int precision_horizon, int precision_verticale) : m_shaderCouleur("Shaders/couleurs.vert", "Shaders/couleurs.frag"), m_vertices(0), m_indices(0), m_rouge(0), m_vert(0), m_bleu(0), indices_size(0)
{
    // Initialisation du shader
 
    m_shaderCouleur.initialiser();
 
	int r , s;
	float const R = 1./(float)(precision_verticale-1);
    float const S = 1./(float)(precision_horizon-1);
 
	float *vertices=new float[precision_horizon*precision_verticale*3];
 
	 for(r = 0; r < precision_verticale; r++) for(s = 0; s < precision_horizon; s++) {
                float const z = sin( -(M_PI/2) + M_PI * r * R );
                float const x = cos(2*M_PI * s * S) * sin( 2*M_PI * r * R );
                float const y = sin(2*M_PI * s * S) * sin( 2*M_PI * r * R );
 
				*vertices++=x*rayon;
				*vertices++=y*rayon;
				*vertices++=z*rayon;
	 }
 
	 // Indices
 
	 int *indices= new int[precision_horizon*precision_verticale*4];
 
 
	         for(r = 0; r < precision_verticale-1; r++) for(s = 0; s < precision_horizon-1; s++) {
                *indices++ = r * precision_horizon + s;
                *indices++ = r * precision_horizon + (s+1);
                *indices++ = (r+1) * precision_horizon + (s+1);
                *indices++ = (r+1) * precision_horizon + s;
                 }
 
			 int *indices_size= new int[1];
			 indices_size[0]=precision_horizon*precision_verticale*4;
 
    // Taille des différents tableaux
 
    unsigned int const tailleTabVertices(precision_horizon*precision_verticale*3);
    unsigned int const tailleTabIndices(precision_horizon*precision_verticale*4);
 
    // Allocation des différents attributs
 
    m_vertices = new float[tailleTabVertices];
    m_indices = new unsigned int[tailleTabIndices];
 
    // Copie des vertices
 
    for(int i(0); i < tailleTabVertices; i++)
        m_vertices[i] = vertices[i];
 
    // Copie des indices
 
    for(int i(0); i < tailleTabIndices; i++)
        m_indices[i] = indices[i];
}