opengl 回调函数调用类中的成员函数
来源:互联网 发布:淘宝店铺开店教程视频 编辑:程序博客网 时间:2024/04/29 05:40
介绍:如何使用静态库,以及静态函数。
This article introduces static and its Function,IF you want to know more , you can visit - - - > 李sir
example follows:
line.h
//line.h#pragma once#include <gl/glut.h>class Line{public: void init(); static void display(); /* * 如果写成 void displayer(), 错误如下: * C3867 “Line::display”: 非标准语法;请使用 "&" 来创建指向成员的指针 */};
line.cpp
//line.cpp#include "line.h"void Line::init(){ glClearColor(1.0, 1.0, 1.0, 0); glMatrixMode(GL_PROJECTION); gluOrtho2D(0, 300, 0, 400);}void Line::display(){ GLdouble de1[2] = { 50, 50 }; GLdouble de2[2] = { 200, 200 }; glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.3, 0.5, 0.7); glLineWidth(50); glBegin(GL_LINES); glVertex2dv(de1); glVertex2dv(de2); glEnd(); glFlush();}
main.cpp
//main.cpp#include "line.h"int main(int acgr, char** acgv){ glutInit(&acgr, acgv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(300, 400); glutInitWindowPosition(0, 0); glutCreateWindow("he,judy"); Line line; line.init(); /**************/ glutDisplayFunc(line.display); // 回调函数 /**************/ glutMainLoop(); return 0;}
0 0
- opengl 回调函数调用类中的成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数中调用类中的非静态成员变量或非静态成员函数
- 回调函数调用类成员函数的方法 -转贴
- 回调函数调用类成员函数的方法
- 回调函数调用类成员函数的方法
- 回调函数调用类成员函数的方法
- 回调函数调用类成员函数的方法
- 回调函数调用类成员函数的方法
- C++线程回调函数调用类成员函数方法
- Qt中让子窗体不继承副窗体的方法
- View.INVISIBLE和View.GONE的区别
- 文本格式化
- 关于Java是强类型语言的相关解释
- CCF-201509-3 模板生成系统
- opengl 回调函数调用类中的成员函数
- Android开发屏幕适配方案
- JS动态添加div,然后在div中添加元素
- python-MySQL学习笔记-第一章链接到并创建数据库
- 深入理解javascript原型和闭包系列 深入理解javascript原型和闭包(15)——闭包
- java学习系列----反射
- 记录一个时间,说一下自己的感受
- 网易笔试题 路灯
- 设计模式之观察者模式浅析