标签:工程 var creat java edit ble ali list 1.0
1、下载和安装HomeBrew
打开terminal,输入下面的命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
x
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
可能在下载的过程中遇到如下问题,不要慌,可能是网络问题导致的,重新执行一遍安装命令即可
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
//常用命令:
//安装软件,如:brew install oclint
//卸载软件,如:brew uninstall oclint
//搜索软件,如:brew search oclint
//更新软件,如:brew upgrade oclint
//查看安装列表, 如:brew list
//更新Homebrew,如:brew update
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
//常用命令:
//安装软件,如:brew install oclint
//卸载软件,如:brew uninstall oclint
//搜索软件,如:brew search oclint
//更新软件,如:brew upgrade oclint
//查看安装列表, 如:brew list
//更新Homebrew,如:brew update
很过教程都是基于GLUT的,但Xcode上会显示deprecate的warning,主要因为GLUT从1998年不再更新了,使用也有一定隐患。现在使用的一般为GLEW,GLFW,FreeGLUT(兼容GLUT),在terminal中输入
brew install glew
brew install glfw
brew install freeglut
brew install glew
brew install glfw
brew install freeglut
freeglut: XQuartz 2.7.11 (or newer) is required to install this formula. X11Requirement unsatisfied!
You can install with Homebrew-Cask:
brew cask install xquartz
You can download from:
https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.
freeglut: XQuartz 2.7.11 (or newer) is required to install this formula. X11Requirement unsatisfied!
You can install with Homebrew-Cask:
brew cask install xquartz
You can download from:
https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.
#include <stdio.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
int main(int argc, const char * argv[]) {
GLFWwindow *window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello OpenGL", NULL, NULL);
if (!window) {
glfwTerminate();
return -1;
}
/* Make the window‘s context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window)) {
/* Render here */
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0); // Red
glVertex3f(0.0, 1.0, 0.0);
glColor3f(0.0, 1.0, 0.0); // Green
glVertex3f(-1.0, -1.0, 0.0);
glColor3f(0.0, 0.0, 1.0); // Blue
glVertex3f(1.0, -1.0, 0.0);
glEnd();
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
x
int main(int argc, const char * argv[]) {
GLFWwindow *window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello OpenGL", NULL, NULL);
if (!window) {
glfwTerminate();
return -1;
}
/* Make the window‘s context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window)) {
/* Render here */
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0); // Red
glVertex3f(0.0, 1.0, 0.0);
glColor3f(0.0, 1.0, 0.0); // Green
glVertex3f(-1.0, -1.0, 0.0);
glColor3f(0.0, 0.0, 1.0); // Blue
glVertex3f(1.0, -1.0, 0.0);
glEnd();
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">
标签:工程 var creat java edit ble ali list 1.0
原文地址:https://www.cnblogs.com/leojason/p/9619193.html