openGL_a1 笔记

【GLuint】 unsigned binary integer(in "glad.h", typedef unsigned int GLuint;)

【::】在类外部,定义成员函数;在类外部,引用静态成员函数

【#ifdef】如果定义了LINUX,则执行#endif前的语句(用于根据环境选择是否用这些文件) 

【宏】= Macro 对批处理的一种称谓。例如,在C中,宏预处理=文本搜索和替换

【批处理】 = Batch 对一个东西进行批量处理,比如一个脚本,.bat文件

【sprintf(char *str, const char *format, ...)】发送格式化输出 -> str 所指向的字符串 in stdio.h

【strdup(char *s)】拷贝字符串->新建的位置处; 返回一个指针;因为调用了malloc(), 所以要用free()释放空间,不然就内存泄漏 in string.h

【内存泄漏】程序中,动态分配的内存没有得到释放,造成内存浪费,程序会因此减慢运行或崩溃

【GLFW】Graphics Library Framework 

【缓冲区】暂时保留输入输出的空间

Mac上glfw的设置

int main( int argc, char **argv )
{

  // Set up GLFW (= Graphics Library Framework)
  GLFWwindow* window;

  if (!glfwInit())
    return 1;

  // Open window (ask for OpenGL ES 3.0 or better)
  //glfwWindowHint( GLFW_CLIENT_API, GLFW_OPENGL_ES_API );
  //glfwWindowHint( GLFW_CONTEXT_VERSION_MAJOR, 3 );
  //glfwWindowHint( GLFW_CONTEXT_VERSION_MINOR, 0 );

 // settings for Mac
  glfwWindowHint(GLFW_SAMPLES, 4);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // To make MacOS happy; should not be needed
  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

  window = glfwCreateWindow( 800, 600, "Demo 1", NULL, NULL);

  if (!window) {

    glfwTerminate();

    return 1;
  }
//......
}

  

 

资料及链接:

双冒号

https://www.runoob.com/cplusplus/cpp-intro.html

https://www.runoob.com/w3cnote/cpp-two-colon-usage.html

https://www.runoob.com/cprogramming/c-function-sprintf.html

缓冲区

https://www.zfl9.com/c-buffer.html

posted @ 2020-01-23 15:03  溪边老圃  阅读(136)  评论(0)    收藏  举报