当前位置:网站首页>OpenGL homework - Hello, triangle
OpenGL homework - Hello, triangle
2022-07-07 22:08:00 【qq_ fifty-seven million two hundred and fifty-one thousand thre】
1. use glDrawArrays() Generate two connected triangles
#include<iostream>
#define GLEW_STATIC
#include <GL/glew.h>
#include<GLFW\glfw3.h>
using namespace std;
float vertices[] = {
// first triangle
-0.9f, -0.5f, 0.0f, // left
-0.0f, -0.5f, 0.0f, // right
-0.45f, 0.5f, 0.0f, // top
// second triangle
0.0f, -0.5f, 0.0f, // left
0.9f, -0.5f, 0.0f, // right
0.45f, 0.5f, 0.0f, // top
};
void processInput(GLFWwindow* window) {
// Check if... Is pressed ESC
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS) {
// close window
glfwSetWindowShouldClose(window, true);
}
}
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&#
边栏推荐
- Win11时间怎么显示星期几?Win11怎么显示今天周几?
- What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
- Node:504 error reporting
- L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
- The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
- 反爬通杀神器
- Leetcode SQL first day
- Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
- Jerry's manual matching method [chapter]
- PDF文档签名指南
猜你喜欢
NVR hard disk video recorder is connected to easycvr through the national standard gb28181 protocol. What is the reason why the device channel information is not displayed?
South China x99 platform chicken blood tutorial
【JDBC Part 1】概述、获取连接、CRUD
Node:504 error reporting
客户案例|华律网,通过观测云大幅缩短故障定位时间
Ad domain group policy management
Reinforcement learning - learning notes 9 | multi step TD target
为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
Jerry's test box configuration channel [chapter]
The latest Android interview collection, Android video extraction audio
随机推荐
Tsconfig of typescript TS basics JSON configuration options
Jerry's power on automatic pairing [chapter]
Record a garbled code during servlet learning
怎样写一个增广矩阵到txt文件中
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
Debugging and handling the problem of jamming for about 30s during SSH login
为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
Code of "digital image processing principle and Practice (matlab version)" part2[easy to understand]
[开源] .Net ORM 访问 Firebird 数据库
2022 how to evaluate and select low code development platforms?
DBSync新增对MongoDB、ES的支持
23. Merge K ascending linked lists -c language
[C language] advanced pointer --- do you really understand pointer?
L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?
JNI primary contact
MIT6.S081-Lab9 FS [2021Fall]
100million single men and women "online dating", supporting 13billion IPOs
PKPM 2020软件安装包下载及安装教程
Devil daddy A0 English zero foundation self-improvement Road
Jerry's fast pairing does not support canceling pairing [article]