Bonjour, je suis un débutant de programmation. J'ai commencé sur xcode avec l'OpenGL. J'ai réussi à créer un fenêtre OpenGL mais je ne sais pas ou inscrire les code de dessin. (je n'ai pas utiliser GLUT)

Le 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
#import <OpenGL/gl.h>
#import "OpenGLView.h"
 
@implementation OpenGLView
 
-(id) initWithFrame:(NSRect)frameRect
{
    self = [super initWithFrame:frameRect];
    if (self) {
        //Installise things here
    }
 
    return self;
}
 
-(void) drawRect:(NSRect)dirtyRect
{
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    glClear(GL_COLOR_BUFFER_BIT);
 
    glFlush();
}
 
@end
en .h:

#import <Cocoa/Cocoa.h>

@interface OpenGLView : NSOpenGLView

@end