I'm currently trying to write a little program to display a openGl window using C++. I'm using VC++ 6.0.
When compiling I get this error:
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class GlWindow *' (or there is no acceptable conversion)
Code:
//GlWindow.h
#ifndef _GLWINDOW_H_
#define _GLWINDOW_H_
#include <GL/glui.h>
class GlWindow{
private:
int x, y, dimx, dimy, attr, ref;
char *title;
public:
GlWindow(char *_title);
GlWindow();
GlWindow& setPos(int _x, int _y);
GlWindow& setDim(int _dx, int _dy);
GlWindow& setAttr(int _attr);
int show();
};
#endif
//main.c
#include <GL/glui.h>
#include "GlWindow.h"
void display(void){
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glutSwapBuffers();
}
void keyb(unsigned char key, int x, int y){
if (key == 27) exit(0);
}
int main(int argc, char *argv[]){
GlWindow win;
win = new GlWindow("open Gl");
win.setPos(100, 100).setDim(300, 300);
win.show();
glutKeyboardFunc(keyb);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Thanks in advance.