glfw

threading this method produces a segfault, why?

早过忘川 提交于 2019-12-13 02:23:03
问题 So im using GLFW and the following method works when called in my main method void Display::run() { while (!glfwWindowShouldClose(window)) { /* Render here */ /* Swap Buffers And Poll */ glfwSwapBuffers(window); glfwPollEvents(); } } but when i try to run it on a separate thread i get a segfault std::thread t1(&Display::run, this); any ideas? ask if you want any more of the code Edit: main.cpp #include "src/support/Display.h" int main() { Display* d; d->start(); return 0; } Display.h #include

C++11 <thread> multithreads rendering with OpenGL prevents main thread reads stdin

纵饮孤独 提交于 2019-12-12 10:37:17
问题 It seems to be platform related (works with Ubuntu 12.04 on my laptop, doesn't work with another Ubuntu 12.04 on my workstation). This is a sample code about what I am doing with two threads. #include <iostream> #include <thread> #include <chrono> #include <atomic> #include <GL/glfw.h> using namespace std; int main() { atomic_bool g_run(true); string s; thread t([&]() { cout << "init" << endl; if (!glfwInit()) { cerr << "Failed to initialize GLFW." << endl; abort(); } glfwOpenWindowHint(GLFW

DLL-linking via Windows cgo->gcc->ld gives “undefined-reference-to-(function)” errors [closed]

落爺英雄遲暮 提交于 2019-12-12 10:28:34
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . (Very detailed problem report -- tl;dr at the bottom!) I really prefer GLFW to Glut and want to get its Golang binding working under Windows 64-bit with

GLFW SetWindowIcon

二次信任 提交于 2019-12-12 09:51:22
问题 So, I am trying to set the window icon for my glfw window (obviously) but I am having trouble doing so because I don't know how to set an icon using GLFWimage. The code in the docs is as shown: GLFWimage images[2]; images[0] = load_icon("my_icon.png"); images[1] = load_icon("my_icon_small.png"); glfwSetWindowIcon(window, 2, images); But there, it doesn't show how to use or create a "load_icon" function. So, can anyone help cause I have been searching for months. 回答1: glfwSetWindowIcon

How to build GLFW3 project on Linux?

 ̄綄美尐妖づ 提交于 2019-12-12 08:10:51
问题 I've compiled glfw3 and the included examples using cmake and make without problems. Onto writing my first project. Being new to opengl and glfw, and unexperienced with C and CMake, i'm struggling to understand the example build files, or even which libraries to link and/or compiler parameters to use in my project. Let's say i have just one folder with one file, boing.c for now. How would i compile it? Simply running gcc -lglfw3 -lm -lGL -lGLU boing.c gives a wall of undefined references,

Installing GLFW on OSX

拈花ヽ惹草 提交于 2019-12-12 07:34:28
问题 I've been all over the internet and I simply cannot find a way to install GLFW for OSX and use it with Xcode. A lot of articles use cmake for this, which I tried to install but I still can't access it from the terminal. I just need a simple step-by-step guide for installing it because I'm going to lose my mind. Thanks 回答1: I use homebrew to install GLFW. Once brew has been configured, use the commands brew tap homebrew/versions brew install --build-bottle --static glfw2 回答2: If you are still

Problems using GLFW and XCode : won't compile

Deadly 提交于 2019-12-12 05:11:58
问题 I have been programming in C for a while, but now I come to GLFW and OpenGL and everything goes wrong. I am using OSX Snow Leopard and XCode, compiling with GCC. I added to the project the following frameworks to be sure everything is there : Cocoa, OpenGL, GLUT, AGL and Carbon. Under XCode, I put under the Header search paths: /usr/local/include And I put under the Library search paths : /usr/local/lib , /usr/local/lib/pkgconfig and /Users/Arkady/Desktop/glfw-2.7.2/lib (I know it is probably

Color passed to shaders doesn't work

青春壹個敷衍的年華 提交于 2019-12-12 04:34:37
问题 I am pretty new to OpenGL and have a simple program that I am messing with at the moment. The issue that I am running into is when I pass an array to represent the color of points, the color just ends up being black. It works fine if I just explicitly define a color in the fragment shader, and if I switch the indices of the data in the VAO, the triangle is moved to the points that are the colors. I tried using API trace and got the following: 6872: message: major api error 1282: GL_INVALID

Configuring glfw for Python in Eclipse

心已入冬 提交于 2019-12-12 00:28:26
问题 I'm trying to get OpenGL to work with Python. I'm using a python binding of glfw to display the window/configure the keyboard and such. The Sourceforge page for pyglfw has a download link containing a .pyd file and a dll. On the git page, pyglfw contains a bunch of folders. I downloaded both, and referenced them with PyDev in Eclipse, in the Eclipse "External Libraries" section. I wrote some code: import glfw glfw.Init(); if (glfw.OpenWindow(800, 600, 5, 6, 5, 0, 8, 0, glfw.FULLSCREEN) !=

glfwGetPrimaryMonitor is returning 0

时光总嘲笑我的痴心妄想 提交于 2019-12-11 23:29:02
问题 If I call long rslt = glfwGetPrimaryMonitor(); the result is 0. The glfw library can't pick up my monitors for some unknown reason. Also, if I try: PointerBuffer rslt = glfwGetMonitors(); the result is null... My monitors work fine. I have seen some suggestions that I should uninstall my monitors and let windows reinstall the appropriate drivers. This seems like an inadequate workaround to me. I can't expect users to have to do this if they run my application. I'd much prefer to at least get