diff --git a/Dot/Dot.vcxproj b/Dot/Dot.vcxproj
new file mode 100644
index 0000000..ec9bc70
--- /dev/null
+++ b/Dot/Dot.vcxproj
@@ -0,0 +1,159 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {58758496-b3f4-482c-93ba-740c847a58cb}
+ Dot
+ 10.0
+
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
+
+
+ Console
+ true
+ C:\Users\sigon\Documents\OpenGL\lib;%(AdditionalLibraryDirectories)
+ glfw3.lib;glew32.lib;soil2-debug.lib;opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
+
+
+ Console
+ true
+ true
+ true
+ C:\Users\sigon\Documents\OpenGL\lib;%(AdditionalLibraryDirectories)
+ glfw3.lib;glew32.lib;soil2-debug.lib;opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
+
+
+ Console
+ true
+ C:\Users\sigon\Documents\OpenGL\lib;%(AdditionalLibraryDirectories)
+ glfw3.lib;glew32.lib;soil2-debug.lib;opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
+
+
+ Console
+ true
+ true
+ true
+ C:\Users\sigon\Documents\OpenGL\lib;%(AdditionalLibraryDirectories)
+ glfw3.lib;glew32.lib;soil2-debug.lib;opengl32.lib;%(AdditionalDependencies)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Dot/Dot.vcxproj.filters b/Dot/Dot.vcxproj.filters
new file mode 100644
index 0000000..5166fef
--- /dev/null
+++ b/Dot/Dot.vcxproj.filters
@@ -0,0 +1,38 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+ Resource Files
+
+
+ Resource Files
+
+
+
\ No newline at end of file
diff --git a/Dot/ShaderError.h b/Dot/ShaderError.h
new file mode 100644
index 0000000..8ae7d47
--- /dev/null
+++ b/Dot/ShaderError.h
@@ -0,0 +1,39 @@
+#pragma once
+#include
+#include
+#include
+
+namespace ErrorCheck{
+ inline void printShaderLog(GLuint shader) {
+ int len = 0;
+ int chWrittn = 0;
+ char *log;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
+ if (len > 0) {
+ log = (char *)malloc(len);
+ glGetShaderInfoLog(shader, len, &chWrittn, log);
+ std::cout << "Shader Info Log: " << log << std::endl;
+ free(log);
+ } }
+ inline void printProgramLog(int prog) {
+ int len = 0;
+ int chWrittn = 0;
+ char *log;
+ glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
+ if (len > 0) {
+ log = (char *)malloc(len);
+ glGetProgramInfoLog(prog, len, &chWrittn, log);
+ std::cout << "Program Info Log: " << log << std::endl;
+ free(log);
+ } }
+ inline bool checkOpenGLError() {
+ bool foundError = false;
+ int glErr = glGetError();
+ while (glErr != GL_NO_ERROR) {
+ std::cout << "glError: " << glErr << std::endl;
+ foundError = true;
+ glErr = glGetError();
+ }
+ return foundError;
+ }
+}
\ No newline at end of file
diff --git a/Dot/fragShader.glsl b/Dot/fragShader.glsl
new file mode 100644
index 0000000..1da04d5
--- /dev/null
+++ b/Dot/fragShader.glsl
@@ -0,0 +1,11 @@
+#version 430
+out vec4 color;
+void main(void)
+{
+ color=vec4(
+ (gl_FragCoord.x) / 600.f,
+ 0.0,
+ 1-(gl_FragCoord.x) / 600.f,
+ 1.0
+ );
+}
\ No newline at end of file
diff --git a/Dot/glew32.dll b/Dot/glew32.dll
new file mode 100644
index 0000000..04f9381
Binary files /dev/null and b/Dot/glew32.dll differ
diff --git a/Dot/main.cpp b/Dot/main.cpp
new file mode 100644
index 0000000..29ad3ea
--- /dev/null
+++ b/Dot/main.cpp
@@ -0,0 +1,57 @@
+#include
+#include
+#include "utils.h"
+#include
+
+#define numVAOs 1
+
+GLuint renderingProgram;
+GLuint vao[numVAOs];
+
+void init(GLFWwindow* window) {
+ renderingProgram=utils::createShaderProgram("vertShader.glsl","fragShader.glsl");
+ glGenVertexArrays(numVAOs,vao);
+ glBindVertexArray(vao[0]);
+}
+
+float size=0;
+float inc=150;
+double lastTime=0;
+
+void display(GLFWwindow* window, double currentTime) {
+ double elapsedTime=currentTime-lastTime;
+ lastTime=currentTime;
+
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glClearColor(0,0,0.2,1);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glUseProgram(renderingProgram);
+ size+=inc*elapsedTime;
+ if(size>300||size<1){inc*=-1;size=std::clamp(size,1.f,300.f);}
+ glPointSize(size);
+
+ glDrawArrays(GL_POINTS,0,1);
+}
+
+int main(void) {
+ if (!glfwInit()) { exit(EXIT_FAILURE); }
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
+ GLFWwindow* window = glfwCreateWindow(300, 300, "Expanding Dot", NULL, NULL);
+ glfwMakeContextCurrent(window);
+ if (glewInit() != GLEW_OK) { exit(EXIT_FAILURE); }
+ glfwSwapInterval(1);
+
+ init(window);
+
+ while (!glfwWindowShouldClose(window)) {
+ display(window,glfwGetTime());
+ glfwSwapBuffers(window);
+ glfwPollEvents();
+ }
+
+ glfwDestroyWindow(window);
+ glfwTerminate();
+ exit(EXIT_SUCCESS);
+}
\ No newline at end of file
diff --git a/Dot/utils.h b/Dot/utils.h
new file mode 100644
index 0000000..c87e4e8
--- /dev/null
+++ b/Dot/utils.h
@@ -0,0 +1,74 @@
+#pragma once
+#include
+#include
+#include
+#include "ShaderError.h"
+
+class utils{
+ inline static std::string readShaderSource(const char *filePath){
+ std::string content;
+ std::ifstream fileStream(filePath, std::ios::in);
+ std::string line = "";
+ if(fileStream.fail()){
+ std::cout<<"Could not open shader "<WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
Console
@@ -94,6 +95,7 @@
WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
Console
@@ -111,6 +113,7 @@
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
Console
@@ -128,6 +131,7 @@
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
C:\Users\sigon\Documents\OpenGL\include;%(AdditionalIncludeDirectories)
+ stdcpp17
Console
diff --git a/OpenGLTemplate/main.cpp b/OpenGLTemplate/main.cpp
index b28e99c..656dfb9 100644
--- a/OpenGLTemplate/main.cpp
+++ b/OpenGLTemplate/main.cpp
@@ -1,6 +1,7 @@
#include
#include
#include "utils.h"
+#include
#define numVAOs 1
@@ -13,8 +14,8 @@ void init(GLFWwindow* window) {
glBindVertexArray(vao[0]);
}
-float x=0;
-float inc=0.01;
+float size=0;
+float inc=2;
double lastTime=0;
void display(GLFWwindow* window, double currentTime) {
@@ -26,11 +27,11 @@ void display(GLFWwindow* window, double currentTime) {
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(renderingProgram);
- x+=inc;//*elapsedTime;
- if(x>1||x<-1){inc*=-1;}
+ size+=inc*elapsedTime;
+ if(size>1||size<-1){inc*=-1;size=std::clamp(size,-1.f,1.f);}
GLuint offsetLoc=glGetUniformLocation(renderingProgram,"offset");
- glProgramUniform1f(renderingProgram,offsetLoc,x);
+ glProgramUniform1f(renderingProgram,offsetLoc,size);
glDrawArrays(GL_TRIANGLES,0,3);
}