Announcement

Collapse
No announcement yet.

Vấn đề sử dụng class cho đồ họa trong c++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [C++] Vấn đề sử dụng class cho đồ họa trong c++

    Không biết sử dụng hàm như này có đúng ko nữa
    HTML Code:
    glutDisplayFunc(p1.Display);
    mà nó cứ báo lỗi Funtion call missing argument list;use '&Point:isplay' to create a pointer member

    HTML Code:
    #include<glut.h>
    
    using namespace std;
    
    class Point
    {
    	float X, Y;
    public:
    	void InPut(float, float);
    	void Display();
    	float GetX();
    	float GetY();
    };
    void Point::InPut(float X, float Y)
    {
    	this->X = X;
    	this->Y = Y;
    }
    float Point::GetX()
    {
    	return X;
    }
    float Point::GetY()
    {
    	return Y;
    }
    void Point::Display()
    {
    	glBegin(GL_POINTS);
    	glVertex2f(X, Y);
    	glEnd();
    	glFlush();
    }
    int main()
    {
    	Point p1;
    	p1.InPut(0.5, 0.5);
    	glutCreateWindow("Ve Diem");
    	glutDisplayFunc(p1.Display);
    	glutMainLoop();
    	return 0;
    }
    Phú quý vinh hoa như ảo mộng
    Tiền tài danh vọng tựa phù du....

  • #2
    Mình làm mà cũng không được ! không hiểu add thế nào nữa ! :sosad:
    Có bạn nào biết chỉ cách sử dụng cái này với !

    Comment


    • #3
      :shy:cái này là vẽ 1 điểm màn hình mà. 1 điểm làm sao thấy
      :funny::brick::beauty::what:

      Comment

      LHQC

      Collapse
      Working...
      X