当前位置:网站首页>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&#边栏推荐
- Win11U盘不显示怎么办?Win11插U盘没反应的解决方法
- How to make agile digital transformation strategy for manufacturing enterprises
- How polardb-x does distributed database hotspot analysis
- NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
- SAR image quality evaluation
- Time standard library
- Win11游戏模式怎么开启?Win11开启游戏模式的方法
- Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
- Virtual machine network configuration in VMWare
- 三元表达式、各生成式、匿名函数
猜你喜欢

How to make agile digital transformation strategy for manufacturing enterprises

Dry goods sharing | devaxpress v22.1 original help document download collection

Qt编写物联网管理平台39-报警联动

Overseas agent recommendation
![Jerry's manual matching method [chapter]](/img/92/74281c29565581ecb761230fbfd0f3.png)
Jerry's manual matching method [chapter]

Wechat official account oauth2.0 authorizes login and displays user information

Index summary (assault version)

2022 how to evaluate and select low code development platforms?
![[C language] advanced pointer --- do you really understand pointer?](/img/ee/79c0646d4f1bfda9543345b9da0f25.png)
[C language] advanced pointer --- do you really understand pointer?

Win11游戏模式怎么开启?Win11开启游戏模式的方法
随机推荐
How to turn on win11 game mode? How to turn on game mode in win11
Restore backup data on persistent volumes
The essence of analog Servlet
Jerry's test box configuration channel [chapter]
谈谈制造企业如何制定敏捷的数字化转型策略
Overseas agent recommendation
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Take the intersection of two sets
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
Use br to back up tidb cluster data to azure blob storage
强化学习-学习笔记9 | Multi-Step-TD-Target
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
Use blocconsumer to build responsive components and monitor status at the same time
Preparing for the interview and sharing experience
Ten thousand word summary data storage, three knowledge points
解决uni-app中uni.request发送POST请求没有反应。
Jerry's fast pairing does not support canceling pairing [article]
反爬通杀神器
【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
Tsconfig of typescript TS basics JSON configuration options