first commit
This commit is contained in:
commit
a8b366277a
|
@ -0,0 +1 @@
|
|||
bin/
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"makefile.launchConfigurations": [
|
||||
{
|
||||
"cwd": "/home/joseph/Source/OpenGL",
|
||||
"binaryPath": "/home/joseph/Source/OpenGL/OpenGLTest",
|
||||
"binaryArgs": []
|
||||
},
|
||||
{
|
||||
"cwd": "/home/joseph/Source/OpenGL",
|
||||
"binaryPath": "/home/joseph/Source/OpenGL/OpenGLTest.out",
|
||||
"binaryArgs": []
|
||||
}
|
||||
],
|
||||
"files.associations": {
|
||||
"bit": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"cctype": "cpp",
|
||||
"clocale": "cpp",
|
||||
"cmath": "cpp",
|
||||
"compare": "cpp",
|
||||
"concepts": "cpp",
|
||||
"cstddef": "cpp",
|
||||
"cstdint": "cpp",
|
||||
"cstdio": "cpp",
|
||||
"cstdlib": "cpp",
|
||||
"cstring": "cpp",
|
||||
"cwchar": "cpp",
|
||||
"cwctype": "cpp",
|
||||
"exception": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"iosfwd": "cpp",
|
||||
"iostream": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"new": "cpp",
|
||||
"numbers": "cpp",
|
||||
"ostream": "cpp",
|
||||
"stdexcept": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"string": "cpp",
|
||||
"string_view": "cpp",
|
||||
"system_error": "cpp",
|
||||
"tuple": "cpp",
|
||||
"type_traits": "cpp",
|
||||
"typeinfo": "cpp"
|
||||
},
|
||||
"editor.insertSpaces": false
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
CXX = g++
|
||||
CFLAGS = -std=c++17
|
||||
LDFLAGS = -lglfw -lGLEW -lGL
|
||||
|
||||
TARGET = bin/OpenGLTest
|
||||
|
||||
$(TARGET): main.cpp | bin
|
||||
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
.PHONY: test clean
|
||||
|
||||
test: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
||||
bin:
|
||||
mkdir -p bin
|
|
@ -0,0 +1,66 @@
|
|||
#include <GLES3/gl3.h> // Include the OpenGL ES header
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
|
||||
|
||||
#include <glm/vec4.hpp>
|
||||
#include <glm/mat4x4.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
|
||||
|
||||
int main()
|
||||
{
|
||||
if (!glfwInit())
|
||||
{
|
||||
std::cerr << "Failed to initialize GLFW." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
#ifdef __APPLE__
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
#endif
|
||||
|
||||
GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL window", nullptr, nullptr);
|
||||
if (window == NULL)
|
||||
{
|
||||
const char* description;
|
||||
int errorCode = glfwGetError(&description);
|
||||
std::cout << "Failed to create GLFW window. Error code: " << errorCode << ", Description: " << description << std::endl;
|
||||
glfwTerminate();
|
||||
return -1;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glViewport(0, 0, 800, 600);
|
||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
||||
|
||||
glm::mat4 matrix;
|
||||
glm::vec4 vec;
|
||||
|
||||
auto test = vec * matrix;
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glfwPollEvents();
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
Loading…
Reference in New Issue