当前位置:网站首页>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&#边栏推荐
- Tcp/ip protocol stack
- Oracle advanced (VI) Oracle expdp/impdp details
- NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
- 【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
- Leetcode SQL first day
- Demon daddy B2 breaks through grammar and completes orthodox oral practice
- Backup tidb cluster to persistent volume
- EasyCVR配置中心录像计划页面调整分辨率时的显示优化
- The little money made by the program ape is a P!
- Static test tool
猜你喜欢

PDF文档签名指南

The whole network "chases" Zhong Xuegao

cv2.resize函数报错:error: (-215:Assertion failed) func != 0 in function ‘cv::hal::resize‘

Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?

DNS series (I): why does the updated DNS record not take effect?

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

【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式

Use json Stringify() to realize deep copy, be careful, there may be a huge hole
![Restapi version control strategy [eolink translation]](/img/65/decbc158f467ab8c8923c5947af535.png)
Restapi version control strategy [eolink translation]

Virtual machine network configuration in VMWare
随机推荐
强化学习-学习笔记9 | Multi-Step-TD-Target
Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
Dry goods sharing | devaxpress v22.1 original help document download collection
Crawler (17) - Interview (2) | crawler interview question bank
Interview question 01.02 Determine whether it is character rearrangement - auxiliary array algorithm
Relationship between URL and URI
Win11游戏模式怎么开启?Win11开启游戏模式的方法
An overview of the latest research progress of "efficient deep segmentation of labels" at Shanghai Jiaotong University, which comprehensively expounds the deep segmentation methods of unsupervised, ro
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
PDF文档签名指南
The maximum number of meetings you can attend [greedy + priority queue]
Jenkins user rights management
【JDBC Part 1】概述、获取连接、CRUD
South China x99 platform chicken blood tutorial
Implementation method of data platform landing
L2: current situation, prospects and pain points of ZK Rollup
Open source OA development platform: contract management user manual
Overseas agent recommendation
2022 how to evaluate and select low code development platforms?
How polardb-x does distributed database hotspot analysis