当前位置: 首页 > news >正文

深圳定制网站制作厂家现代简约办公室设计

深圳定制网站制作厂家,现代简约办公室设计,WordPress禁用f12,网站建设公司东莞方法一:1.下载GLFW点击GLFW跳转2.下载后解压3.下载glad,解压后4.用vs2019新建Cmake项目5.在新建的Cmake项目下建立depend文件夹在depend里放置我们下载解压的glad和glfw-3.3.8.bin.WIN646.项目中可以看到我们加进来的文件7.编写我们项目的CMakeLists.txt…

方法一:

1.下载GLFW

点击GLFW跳转

2.下载后解压

3.下载glad,解压后

4.用vs2019新建Cmake项目

5.在新建的Cmake项目下建立depend文件夹

在depend里放置我们下载解压的glad和glfw-3.3.8.bin.WIN64

6.项目中可以看到我们加进来的文件

7.编写我们项目的CMakeLists.txt,把我们的头文件和lib库加进来

8.运行程序

cmakelist中已经把glad.h路径定到了/depend/glad/include/,所以我们下面的头文件直接从include下的glad查询就好了,即#include<glad/glad.h>;同理glfw3.h的路径已经定到了/depend/glfw-3.3.8.bin.WIN64/include/,所以我们下面的头文件直接从include下的GLFW开始就好了,即#include<GLFW/glfw3.h>

方法二:

  1. 用vs2019新建控制台应用

  1. 在项目下新建文件夹depend

depend中包含include、lib、src

include内容来自方法一中glad和glfw-3.3.8.bin.WIN64中include下

lib内容来自方法一中glfw-3.3.8.bin.WIN64中lib-vc2019下

src内容来自方法一中glad下

  1. 右键项目点击属性设置VC++目录下的“包含目录”和“库目录”

然后在“链接器”下的“输入”设置“附加依赖项”,加入glfw3.lib和opengl32.lib

  1. 右键头文件,将/depend/src/glad.c加入头文件中

  1. 编译运行

测试代码:

#include <glad/glad.h>
#include <GLFW/glfw3.h>#include <iostream>void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow* window);// settings
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;const char* vertexShaderSource = "#version 330 core\n"
"layout (location = 0) in vec3 aPos;\n"
"void main()\n"
"{\n"
"   gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\0";
const char* fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"void main()\n"
"{\n"
"   FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n\0";int main()
{// glfw: initialize and configure// ------------------------------glfwInit();glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);#ifdef __APPLE__glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif// glfw window creation// --------------------GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);if (window == NULL){std::cout << "Failed to create GLFW window" << std::endl;glfwTerminate();return -1;}glfwMakeContextCurrent(window);glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);// glad: load all OpenGL function pointers// ---------------------------------------if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)){std::cout << "Failed to initialize GLAD" << std::endl;return -1;}// build and compile our shader program// ------------------------------------// vertex shaderunsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);glCompileShader(vertexShader);// check for shader compile errorsint success;char infoLog[512];glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);if (!success){glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl;}// fragment shaderunsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);glCompileShader(fragmentShader);// check for shader compile errorsglGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);if (!success){glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);std::cout << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog << std::endl;}// link shadersunsigned int shaderProgram = glCreateProgram();glAttachShader(shaderProgram, vertexShader);glAttachShader(shaderProgram, fragmentShader);glLinkProgram(shaderProgram);// check for linking errorsglGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);if (!success) {glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);std::cout << "ERROR::SHADER::PROGRAM::LINKING_FAILED\n" << infoLog << std::endl;}glDeleteShader(vertexShader);glDeleteShader(fragmentShader);// set up vertex data (and buffer(s)) and configure vertex attributes// ------------------------------------------------------------------float vertices[] = {0.5f,  0.5f, 0.0f,  // top right0.5f, -0.5f, 0.0f,  // bottom right-0.5f, -0.5f, 0.0f,  // bottom left-0.5f,  0.5f, 0.0f   // top left };unsigned int indices[] = {  // note that we start from 0!0, 1, 3,  // first Triangle1, 2, 3   // second Triangle};unsigned int VBO, VAO, EBO;glGenVertexArrays(1, &VAO);glGenBuffers(1, &VBO);glGenBuffers(1, &EBO);// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).glBindVertexArray(VAO);glBindBuffer(GL_ARRAY_BUFFER, VBO);glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);glEnableVertexAttribArray(0);// note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbindglBindBuffer(GL_ARRAY_BUFFER, 0);// remember: do NOT unbind the EBO while a VAO is active as the bound element buffer object IS stored in the VAO; keep the EBO bound.//glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);// You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other// VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.glBindVertexArray(0);// uncomment this call to draw in wireframe polygons.//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);// render loop// -----------while (!glfwWindowShouldClose(window)){// input// -----processInput(window);// render// ------glClearColor(0.2f, 0.3f, 0.3f, 1.0f);glClear(GL_COLOR_BUFFER_BIT);// draw our first triangleglUseProgram(shaderProgram);glBindVertexArray(VAO); // seeing as we only have a single VAO there's no need to bind it every time, but we'll do so to keep things a bit more organized//glDrawArrays(GL_TRIANGLES, 0, 6);glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);// glBindVertexArray(0); // no need to unbind it every time // glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)// -------------------------------------------------------------------------------glfwSwapBuffers(window);glfwPollEvents();}// optional: de-allocate all resources once they've outlived their purpose:// ------------------------------------------------------------------------glDeleteVertexArrays(1, &VAO);glDeleteBuffers(1, &VBO);glDeleteBuffers(1, &EBO);glDeleteProgram(shaderProgram);// glfw: terminate, clearing all previously allocated GLFW resources.// ------------------------------------------------------------------glfwTerminate();return 0;
}// process all input: query GLFW whether relevant keys are pressed/released this frame and react accordingly
// ---------------------------------------------------------------------------------------------------------
void processInput(GLFWwindow* window)
{if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)glfwSetWindowShouldClose(window, true);
}// glfw: whenever the window size changed (by OS or user resize) this callback function executes
// ---------------------------------------------------------------------------------------------
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
{// make sure the viewport matches the new window dimensions; note that width and // height will be significantly larger than specified on retina displays.glViewport(0, 0, width, height);
}
http://www.yayakq.cn/news/443988/

相关文章:

  • 伊犁建设网站公司熊掌号接入wordpress
  • 免费关键词挖掘网站做美食网站的特点
  • 做网站宣传图的网站长沙网站推广和优化
  • 投标网站建设服务承诺wordpress 图片尺寸
  • 做php网站会员开店代码如何编写网站logo怎么做动态图
  • 哈尔滨制作网站价格佛山网站推广优化公司
  • 网站建设项目步骤百度营稍
  • 站长怎么添加网站内容优化培训学校
  • 网站建设与运营公司部门结构wordpress html音乐
  • 网站建设佰金手指科杰二郑州市科协网站
  • 天河网站建设餐饮小程序模板
  • 有没有转门做乐器演奏的网站安居客网站是用什么程序做的
  • 企业网站框架图asp企业网站开发技术
  • 网站人多怎么优化以下哪些软件不是网页制作软件
  • 四川德阳做网站和app网站建设公司咨询电话
  • 禅城建网站仿制型模板网站
  • sns网站需求网站开发招标文件
  • 网站外链如何建设句容网站建设
  • 潍坊商城网站建设建e网室内设计网官网全景图库
  • 黄山市非遗网站策划书东莞企业免费建站
  • iis7.5添加php网站seo网站建设接单
  • 开发app和微网站有哪些功能wordpress 用户主页
  • 概述网站建设的流程互联网+创新创业大赛项目计划书
  • 做除尘骨架的网站做餐厅logo什么网站素材多
  • 做国外网站什么好深圳网站建设哪家便宜
  • 好的网站收入邯郸市中考管理平台官网
  • 大气的门户网站3d家装效果图制作软件
  • 动易 网站文章东莞浩智网站建设开发
  • 快速开发网站苏州知名网站建设设计
  • 做二手网站有哪些徐州小学网站建设