当前位置:网站首页>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&#
边栏推荐
- Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission
- Backup tidb cluster to persistent volume
- Jerry's fast pairing does not support canceling pairing [article]
- Preparing for the interview and sharing experience
- [open source] Net ORM accessing Firebird database
- JNI primary contact
- Oracle advanced (VI) Oracle expdp/impdp details
- An in-depth understanding of fp/fn/precision/recall
- Crawler (17) - Interview (2) | crawler interview question bank
- [JDBC Part 1] overview, get connection, CRUD
猜你喜欢
EasyCVR配置中心录像计划页面调整分辨率时的显示优化
客户案例|华律网,通过观测云大幅缩短故障定位时间
解决uni-app中uni.request发送POST请求没有反应。
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
Dry goods sharing | devaxpress v22.1 original help document download collection
Magic weapon - sensitive file discovery tool
建立自己的网站(18)
The latest Android interview collection, Android video extraction audio
NVR硬盤錄像機通過國標GB28181協議接入EasyCVR,設備通道信息不顯示是什麼原因?
[开源] .Net ORM 访问 Firebird 数据库
随机推荐
Tsconfig of typescript TS basics JSON configuration options
Use camunda to do workflow design and reject operations
Tcp/ip protocol stack
Tupu digital twin coal mining system to create "hard power" of coal mining
Ad domain group policy management
Jerry's key to initiate pairing [chapter]
An in-depth understanding of fp/fn/precision/recall
Win11时间怎么显示星期几?Win11怎么显示今天周几?
Use br to back up tidb cluster data to azure blob storage
Static test tool
Jerry's test box configuration channel [chapter]
[colmap] sparse reconstruction is converted to mvsnet format input
The strongest installation of the twin tower model, Google is playing "antique" again?
[open source] Net ORM accessing Firebird database
Devil daddy A0 English zero foundation self-improvement Road
The cyberspace office announced the measures for data exit security assessment, which will come into force on September 1
null == undefined
Node:504 error reporting
Jenkins user rights management
QT compile IOT management platform 39 alarm linkage