Category : glfw

This is to request a full code that works for drawing a polygon using a VBO. My code structure is like below. int main(void){ GLFWwindow* window; if (!glfwInit()) return -1; { int argc = 1; char *argv[1] = { (char*)"Something" }; glutInit(&argc, argv); } glfwSwapInterval(1); window = glfwCreateWindow(WINDOW_INI_WIDTH, WINDOW_INI_HEIGHT, "Marine Traffic Modelling", NULL, NULL); glfwSetWindowPos(window, ..

Read more

#include <iostream> // cout, cerr #include <cstdlib> // EXIT_FAILURE #include <GL/glew.h> // GLEW library #include <GLFW/glfw3.h> // GLFW library // GLM Math Header inclusions #include <glm/glm.hpp> #include <glm/gtx/transform.hpp> #include <glm/gtc/type_ptr.hpp> #include <camera.h> // Camera class using namespace std; // Standard namespace /*Shader program Macro*/ #ifndef GLSL #define GLSL(Version, Source) "#version " #Version " core n" ..

Read more

I am trying to follow this tutorial: https://www.youtube.com/watch?v=Bcs56Mm-FJY&list=PLlrATfBNZ98foTJPJ_Ev03o2oq3-GGOS2&index=12 Specifically, this is the function that causes the problem: // Initializes window and libraries and returns pointer to window. GLFWwindow *initWindowAndLibs(int width, int height, const char *name) { GLFWwindow* window; if (!glfwInit()) exit(-1); glfwWindowHint(GLFW_VERSION_MAJOR, 4); glfwWindowHint(GLFW_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Window opens without this line. window = ..

Read more

I’m running glfw on Windows 7 64-bit but I’m running the 32-bit version of glfw and 32-bit version of mingw, and I have also tried 64-bit version in vs 2019. The thing is glfw successfully initialized but the create window function fails(i can guarantee) and searching on the internet, I can’t find the right solution. ..

Read more

I used this: int texture(char *filename) { glGenTextures(1, &activeTexture); glBindTexture(GL_TEXTURE_2D, activeTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); int width, height, nrChannels; stbi_set_flip_vertically_on_load(true); unsigned char *data = stbi_load(filename, &width, &height, &nrChannels, 0); if (data) { glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data); glGenerateMipmap(GL_TEXTURE_2D); } stbi_image_free(data); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, activeTexture); ..

Read more

I’m new to glfw and I’m trying to encapsulate it in a class to make my code cleaner. So in my class, I’ve made the basic window creation but when I execute the program, it always enter in the if statement where I check if the initialization went right or not and I don’t know ..

Read more