当前位置:网站首页>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&#边栏推荐
- What if the win11u disk does not display? Solution to failure of win11 plug-in USB flash disk
- Matplotlib drawing interface settings
- Restapi version control strategy [eolink translation]
- Win11游戏模式怎么开启?Win11开启游戏模式的方法
- Reinforcement learning - learning notes 9 | multi step TD target
- 解决uni-app中uni.request发送POST请求没有反应。
- Dry goods sharing | devaxpress v22.1 original help document download collection
- Navicat connect 2002 - can't connect to local MySQL server through socket '/var/lib/mysql/mysql Sock 'solve
- Build your own website (18)
- null == undefined
猜你喜欢
![Jerry's test box configuration channel [chapter]](/img/d4/fb67f5ee0fe413c22e4e5cd5037938.png)
Jerry's test box configuration channel [chapter]

Implementation method of data platform landing
![[advanced MySQL] index details (I): index data page structure](/img/e7/fe4591a721a71c3c38d6e4448af6af.png)
[advanced MySQL] index details (I): index data page structure

How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525

How to turn on win11 game mode? How to turn on game mode in win11

Win11时间怎么显示星期几?Win11怎么显示今天周几?

L2:ZK-Rollup的现状,前景和痛点

建立自己的网站(18)

null == undefined

Use blocconsumer to build responsive components and monitor status at the same time
随机推荐
Display optimization when the resolution of easycvr configuration center video recording plan page is adjusted
JNI primary contact
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Reinforcement learning - learning notes 8 | Q-learning
如何选择合适的自动化测试工具?
ByteDance Android interview, summary of knowledge points + analysis of interview questions
Use camunda to do workflow design and reject operations
SAR影像质量评估
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
[C language] advanced pointer --- do you really understand pointer?
强化学习-学习笔记9 | Multi-Step-TD-Target
PDF文档签名指南
Index summary (assault version)
Jerry's test box configuration channel [chapter]
Jerry's power on automatic pairing [chapter]
Meta force force meta universe system development fossage model
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
谈谈制造企业如何制定敏捷的数字化转型策略
[advanced MySQL] index details (I): index data page structure
Have you ever been confused? Once a test / development programmer, ignorant gadget C bird upgrade