glfw

C++ - using glfwGetTime() for a fixed time step

荒凉一梦 提交于 2019-12-10 17:33:31
问题 After doing some research and debugging in my C++ project with glfwGetTime(), I'm having trouble making a game loop for my project. As far as time goes I really only worked with nanoseconds in Java and on the GLFW website it states that the function returns the time in seconds . How would I make a fixed time step loop with glfwGetTime()? What I have now - while(!glfwWindowShouldClose(window)) { double now = glfwGetTime(); double delta = now - lastTime; lastTime = now; accumulator += delta;

Can't link GLFW3: undefined references

僤鯓⒐⒋嵵緔 提交于 2019-12-10 17:13:51
问题 I realize something similar has been asked before (glfw3 compiling undefined references), but I still can't get it to work unfortunately. Any help is welcome! Below is the compiler output when running make : g++ -std=c++11 -Wall -Wextra -Werror -pedantic-errors -I/usr/local/include -c -o Main.o Main.cpp g++ -std=c++11 -Wall -Wextra -Werror -pedantic-errors -I/usr/local/include -L/usr/local/lib -lglfw3 -lGL Main.o -o modernogl Main.o: In function `main': Main.cpp:(.text+0x9): undefined

GLFW 3 initialized, yet not?

寵の児 提交于 2019-12-10 13:48:27
问题 I'm struggling with creating a window with the GLFW 3 function, glfwCreateWindow. I have set an error callback function, that pretty much just prints out the error number and description, and according to that the GLFW library have not been initialized, even though the glfwInit function just returned success? Here's an outtake from my code // Error callback function prints out any errors from GFLW to the console static void error_callback( int error, const char *description ) { cout << error

CMake - get_filename_component Unknown component directory

主宰稳场 提交于 2019-12-10 11:40:31
问题 I am having a bit of trouble with CMake. I am trying to link with GLFW and include multiple source files of my own project . (I'm switching from Visual Studio to make my project cross-platform). GLFW is in the folder deps/glfw-3.1.1 and my source code is in the folder src Here is my CMakeLists.txt file: # Tell CMake to use a minimum of version 3.2 cmake_minimum_required(3.2) project(Sparky) # TODO: Versions # Add all of our source code to the project file(GLOB_RECURSE Sparky_SOURCES "src/*

Removing the maximize button from a window created using glfw

安稳与你 提交于 2019-12-10 11:11:09
问题 How do you remove the maximize button from a window created usingg the glfwopenWindow functionn call ? Currently, what I'm doing is: windowHandle = GetForegroundWindow(); long Style = GetWindowLong(windowHandle, GWL_STYLE); Style ^= WS_MAXIMIZEBOX; SetWindowLong(windowHandle, GWL_STYLE, WS_MAXIMIZEBOX); Where, I get the window handle and then toggle the maximize bit. Then I re-apply the window style. But this doesn't work an it makes the window completely blank without any buttons or title

C++ OpenGL, GLFW Drawing a simple cube

旧城冷巷雨未停 提交于 2019-12-09 11:57:29
问题 So, I am trying to draw a simple cube in openGL and GLFW. In the code below, I can draw the cube, but it just appears as a simple rectangle. what is happening here? I've tried "glTransformf(0,0,-10);", but if I do anything less than -2, than the cube dissappears. at -2, the front face side appears. at the default position of 0, I can see the back side of the cube. also, when I try to rotate it, all that shows up is a rectangle moving from the top of the window, to the bottom. Seems very odd.

issues with freeglut on mac os snow leopard (it builds fine via macports)

别等时光非礼了梦想. 提交于 2019-12-09 03:18:45
问题 im on mac os snow leopard gcc 4.5.4 | gcc 4.2.1, trying to build the tutorials http://www.arcsynthesis.org/gltut/ one needs to build dir glsdk first. I install freeglut (prerequisite) via macports freeglut @2.8.0_1 (active) and manually copy and paste its lib and include folders in dir glsdk so that ls ..../Tutorial_0_3_8/glsdk/freeglut -> include lib (I couldn't build the freeglut provided that's why I replace it with the one from macports) after fixing many errors (mostly due to legacy

CMake: GLFW as ExternalProject

≯℡__Kan透↙ 提交于 2019-12-08 21:40:39
问题 Issue I am trying to make a project that uses GLFW. For this project I am using CMake as a build system. I would like to make it so the user just has to build my project with CMake, and as part of the process GLFW will get built and linked appropriately. To do this I am adding GLFW as a ExternalProject in my CMake file: EXTERNALPROJECT_ADD(glfw GIT_REPOSITORY https://github.com/glfw/glfw.git GIT_TAG 3.1 INSTALL_DIR "${PROJECT_BINARY_DIR}/libs/glfw" ) However when I generate the project(For

I need help trying to compile a simple example for GLFW with MinGW

☆樱花仙子☆ 提交于 2019-12-08 20:01:43
问题 I am trying to compile an example from GLFW's documentation. My folder structure for the libraries and source files are: C:\cpp\ glfw3.dll glfw3dll.a libglfw3.a test.cpp include\ GLFW\ glfw3.h glfw3native.h #include <GLFW/glfw3.h> int main(void) { GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) return -1; /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); if (!window) { glfwTerminate(); return -1; } /*

GLFW Toggling Windowed-Fullscreen Mode

允我心安 提交于 2019-12-08 19:11:37
问题 I am using GLFW and I would like to know how to toggle full-screen windowed mode. Not changing the resolution, but instead setting the window to be on top and without decoration. If GLFW is not capable of doing this, then what cross platform library do you suggest to achieve this? 回答1: You can tell glfw to open your window fullscreen. glfwOpenWindow( width, height, 0, 0, 0, 0, 0, 0, GLFW_FULLSCREEN ) As far as I know you would have to close and reopen this window to switch between a window