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

什么网站可以兼职做平面设计创意设计

什么网站可以兼职做平面设计,创意设计,wordpress旋转音乐,做棋牌网站抓到会怎么量刑几何数据&#xff1a;vao和vbo 材质程序&#xff1a;vs和fs(顶点着色器和片元着色器) 接下来只需要告诉GPU&#xff0c;使用几何数据和材质程序来进行绘制。 #include <glad/glad.h>//glad必须在glfw头文件之前包含 #include <GLFW/glfw3.h> #include <iostrea…

几何数据:vao和vbo
材质程序:vs和fs(顶点着色器和片元着色器)
接下来只需要告诉GPU,使用几何数据和材质程序来进行绘制。

#include <glad/glad.h>//glad必须在glfw头文件之前包含
#include <GLFW/glfw3.h>
#include <iostream>void frameBufferSizeCallbakc(GLFWwindow* window, int width, int height)
{glViewport(0, 0, width, height);
}
void glfwKeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
}GLuint program = 0;
GLuint vao = 0;
void prepareInterleavedBuffer() {//1 准备好Interleaved数据(位置+颜色)float vertices[] = {-0.5f, -0.5f, 0.0f,  1.0f, 0.0f, 0.0f,0.5f, -0.5f, 0.0f,  0.0f, 1.0f, 0.0f,0.0f,  0.5f, 0.0f,  0.0f,  0.0f, 1.0f};//2 创建唯一的vboGLuint vbo = 0;glGenBuffers(1, &vbo);glBindBuffer(GL_ARRAY_BUFFER, vbo);glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);//3 创建并绑定vaoglGenVertexArrays(1, &vao);glBindVertexArray(vao);glBindBuffer(GL_ARRAY_BUFFER, vbo);//4 为vao加入位置和颜色的描述信息//4.1 位置描述信息glEnableVertexAttribArray(0);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);//4.2 颜色描述信息glEnableVertexAttribArray(1);glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)(3 * sizeof(float)));//5 扫尾工作:解绑当前vaoglBindVertexArray(0);
}
void prepareVAOForGLTriangles() {//1 准备positionsfloat positions[] = {-0.5f, -0.5f, 0.0f,0.5f, -0.5f, 0.0f,0.0f,  0.5f, 0.0f,0.5f,  0.5f, 0.0f,0.8f,  0.8f, 0.0f,0.8f,  0.0f, 0.0f};//2  posVboGLuint posVbo;glGenBuffers(1, &posVbo);glBindBuffer(GL_ARRAY_BUFFER, posVbo);glBufferData(GL_ARRAY_BUFFER, sizeof(positions), positions, GL_STATIC_DRAW);//3 生成vao并且绑定glGenVertexArrays(1, &vao);glBindVertexArray(vao);//4 描述位置属性glBindBuffer(GL_ARRAY_BUFFER, posVbo);glEnableVertexAttribArray(0);glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);glBindVertexArray(0);
}
void prepareShader() {//1 完成vs与fs的源代码,并且装入字符串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";//2 创建Shader程序(vs、fs)GLuint vertex, fragment;vertex = glCreateShader(GL_VERTEX_SHADER);fragment = glCreateShader(GL_FRAGMENT_SHADER);//3 为shader程序输入shader代码glShaderSource(vertex, 1, &vertexShaderSource, NULL);glShaderSource(fragment, 1, &fragmentShaderSource, NULL);int success = 0;char infoLog[1024];//4 执行shader代码编译 glCompileShader(vertex);//检查vertex编译结果glGetShaderiv(vertex, GL_COMPILE_STATUS, &success);if (!success) {glGetShaderInfoLog(vertex, 1024, NULL, infoLog);std::cout << "Error: SHADER COMPILE ERROR --VERTEX" << "\n" << infoLog << std::endl;}glCompileShader(fragment);//检查fragment编译结果glGetShaderiv(fragment, GL_COMPILE_STATUS, &success);if (!success) {glGetShaderInfoLog(fragment, 1024, NULL, infoLog);std::cout << "Error: SHADER COMPILE ERROR --FRAGMENT" << "\n" << infoLog << std::endl;}//5 创建一个Program壳子program = glCreateProgram();//6 将vs与fs编译好的结果放到program这个壳子里glAttachShader(program, vertex);glAttachShader(program, fragment);//7 执行program的链接操作,形成最终可执行shader程序glLinkProgram(program);//检查链接错误glGetProgramiv(program, GL_LINK_STATUS, &success);if (!success) {glGetProgramInfoLog(program, 1024, NULL, infoLog);std::cout << "Error: SHADER LINK ERROR " << "\n" << infoLog << std::endl;}//清理glDeleteShader(vertex);glDeleteShader(fragment);
}void render()
{//执行opengl画布清理操作glClear(GL_COLOR_BUFFER_BIT);//1.绑定当前的programglUseProgram(program);//2 绑定当前的vaoglBindVertexArray(vao);//3 发出绘制指令glDrawArrays(GL_TRIANGLES, 0, 3);}int main()
{//初始化glfw环境glfwInit();//设置opengl主版本号glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);//设置opengl次版本号glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);//设置opengl启用核心模式glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);//创建窗体对象GLFWwindow* window = glfwCreateWindow(800, 600, "lenarnOpenGL", nullptr, nullptr);//设置当前窗体对象为opengl的绘制舞台glfwMakeContextCurrent(window);//窗体大小回调glfwSetFramebufferSizeCallback(window, frameBufferSizeCallbakc);//键盘相应回调glfwSetKeyCallback(window, glfwKeyCallback);//使用glad加载所有当前版本opengl的函数if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)){std::cout << "初始化glad失败" << std::endl;return -1;};//设置opengl视口大小和清理颜色glViewport(0, 0, 800, 600);glClearColor(0.2f, 0.3f, 0.3f, 1.0f);//着色器prepareShader();//vaoprepareInterleavedBuffer();//执行窗体循环while (!glfwWindowShouldClose(window)){//接受并分发窗体消息//检查消息队列是否有需要处理的鼠标、键盘等消息//如果有的话就将消息批量处理,清空队列glfwPollEvents();//渲染操作render();//切换双缓存glfwSwapBuffers(window);}//推出程序前做相关清理glfwTerminate();return 0;
}

glUseProgram:设置使用的shader程序
glBindVertexArray:绑定使用的VAO几何信息

glDrawArrays(GLenum mode, GLint first, GLsizei count);

mode:绘制模式
first:从第几个顶点数据开始绘制
count:绘制到第几个顶点数据
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


文章转载自:
http://precursor.tsnq.cn
http://hoarding.tsnq.cn
http://shellshocked.tsnq.cn
http://preachy.tsnq.cn
http://infill.tsnq.cn
http://rinse.tsnq.cn
http://tenderhearted.tsnq.cn
http://lagthing.tsnq.cn
http://decilitre.tsnq.cn
http://frate.tsnq.cn
http://snubber.tsnq.cn
http://instrument.tsnq.cn
http://depolarization.tsnq.cn
http://metalanguage.tsnq.cn
http://introducer.tsnq.cn
http://quartzose.tsnq.cn
http://promptly.tsnq.cn
http://atrato.tsnq.cn
http://thanksgiving.tsnq.cn
http://script.tsnq.cn
http://shout.tsnq.cn
http://unorganized.tsnq.cn
http://insentient.tsnq.cn
http://dogshore.tsnq.cn
http://galbraithian.tsnq.cn
http://fulgurous.tsnq.cn
http://midi.tsnq.cn
http://paraceisian.tsnq.cn
http://wingbeat.tsnq.cn
http://frugivore.tsnq.cn
http://sociologism.tsnq.cn
http://synchrocyclotron.tsnq.cn
http://intort.tsnq.cn
http://quaternion.tsnq.cn
http://seamanly.tsnq.cn
http://liter.tsnq.cn
http://coinhere.tsnq.cn
http://detention.tsnq.cn
http://blond.tsnq.cn
http://hemocytoblast.tsnq.cn
http://extraconstitutional.tsnq.cn
http://khaki.tsnq.cn
http://wheelman.tsnq.cn
http://guyanan.tsnq.cn
http://pablum.tsnq.cn
http://goaltender.tsnq.cn
http://ammonolysis.tsnq.cn
http://byobu.tsnq.cn
http://recurrence.tsnq.cn
http://sniff.tsnq.cn
http://bunchberry.tsnq.cn
http://hesitance.tsnq.cn
http://sacahuiste.tsnq.cn
http://durbar.tsnq.cn
http://ethelind.tsnq.cn
http://menopause.tsnq.cn
http://chocho.tsnq.cn
http://turaco.tsnq.cn
http://glabrous.tsnq.cn
http://celanese.tsnq.cn
http://identifiable.tsnq.cn
http://waybread.tsnq.cn
http://safecracker.tsnq.cn
http://sinkiang.tsnq.cn
http://eloquence.tsnq.cn
http://kingside.tsnq.cn
http://gallia.tsnq.cn
http://electron.tsnq.cn
http://veldt.tsnq.cn
http://hippopotamus.tsnq.cn
http://achy.tsnq.cn
http://suture.tsnq.cn
http://swimmable.tsnq.cn
http://come.tsnq.cn
http://paedagogic.tsnq.cn
http://nanjing.tsnq.cn
http://podzolise.tsnq.cn
http://crusade.tsnq.cn
http://plenism.tsnq.cn
http://indefatigably.tsnq.cn
http://princeton.tsnq.cn
http://tanzanite.tsnq.cn
http://undevout.tsnq.cn
http://installment.tsnq.cn
http://plane.tsnq.cn
http://leatherette.tsnq.cn
http://emmagee.tsnq.cn
http://commixture.tsnq.cn
http://pothunter.tsnq.cn
http://leitmotif.tsnq.cn
http://actinometry.tsnq.cn
http://wither.tsnq.cn
http://procryptic.tsnq.cn
http://nondividing.tsnq.cn
http://microminiature.tsnq.cn
http://woollenette.tsnq.cn
http://south.tsnq.cn
http://sanctimonial.tsnq.cn
http://gallicize.tsnq.cn
http://elodea.tsnq.cn
http://www.dt0577.cn/news/112016.html

相关文章:

  • 网上做调查赚钱的网站有哪些宣传软文是什么
  • 为什么做的网站打开自动缩放企业seo外包公司
  • 建设积分商城网站网站制作的服务怎么样
  • 织梦做分类信息系统网站bt兔子磁力搜索
  • 太原网站空间网络黄页平台网址有哪些
  • 做图剪片文案网站app接单比较好的网络推广平台
  • 设计网站推荐提升审美最新百度新闻
  • 网站建设广告图片域名收录查询工具
  • 深圳教育 网站建设如何提高搜索引擎优化
  • 公司网站建设图片素材怎么找360网站推广客服电话
  • 网站设计理念nba最新消息交易
  • 在网站社保减员要怎么做seo的作用有哪些
  • 沧州网站营销推广郑州最新通告
  • 溧阳做网站百度网盘网页版登录入口
  • 网站制作高手seo搜索引擎优化哪家好
  • 投标网站怎么做网站推广服务外包
  • 一个做网站编程的条件电脑培训班附近有吗
  • 教育局网站群建设方案怎么推广比较好
  • 有没有可以做司考真题的网站百度网站的优化方案
  • 重庆网站建设排名磁力搜索
  • 做移动网站开发农产品网络营销策划书
  • 网站开通宣传怎么写广州seo团队
  • 湖南网络公司网站建设港港网app下载最新版
  • wordpress图表模板类温州seo排名优化
  • 沧州做网站价格百度快照客服
  • 北京网站建设模板下载百度平台营销
  • 做网销的网站苏州新闻今天最新消息新闻事件
  • 时代创信网站建设深圳推广
  • 京东商城网站建设目的广东疫情动态人民日报
  • 写男主重生做网站的小说搜索引擎优化的英文