Why does glGetString(GL_VERSION) return null / zero instead of the OpenGL version?

glutInit() doesn’t create a GL context or make one current. You need a current GL context for glewInit() and glGetString() to work. Try this: #include <GL/glew.h> #include <GL/glut.h> #include <cstdio> int main(int argc, char **argv) { glutInit(&argc, argv); glutCreateWindow(“GLUT”); glewInit(); printf(“OpenGL version supported by this platform (%s): \n”, glGetString(GL_VERSION)); }

Cmake link library target link error

The syntax for target_link_libraries is: target_link_libraries(your_executable_name libraries_list) And you don’t have to add add_definition statements (target_link_libraries adds this options) There are also some useful variables provided by OpenGL and GLEW packages. Your CMakeLists.txt should be like: cmake_minimum_required (VERSION 2.6) project (test) find_package(OpenGL REQUIRED) find_package(GLEW REQUIRED) include_directories(${OPENGL_INCLUDE_DIR} ${GLEW_INCLUDE_DIRS}) add_executable(test main.cpp ) target_link_libraries(test ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES}) One important … Read more

PyOpenGL glutInit NullFunctionError

According to the link below the problem was with the glut installation rather than pip install. It seems glut files are not part of PyOpenGL or PyOpenGL_accelerate package. You have to download them seperately. https://stackoverflow.com/a/39181193/7030177 Windows user can use the link below to download glut as mentioned in the given link. ftp://ftp.sgi.com/opengl/glut/glut3.html.old#windows Linux Users can … Read more

Using the mouse scrollwheel in GLUT

Freeglut’s glutMouseWheelFunc callback is version dependant and not reliable in X. Use standard mouse function and test for buttons 3 and 4. The OpenGlut notes on glutMouseWheelFunc state: Due to lack of information about the mouse, it is impossible to implement this correctly on X at this time. Use of this function limits the portability … Read more

GLUT exit redefinition error

Cause: The stdlib.h which ships with the recent versions of Visual Studio has a different (and conflicting) definition of the exit() function. It clashes with the definition in glut.h. Solution: Override the definition in glut.h with that in stdlib.h. Place the stdlib.h line above the glut.h line in your code. #include <stdlib.h> #include <GL/glut.h>

Initializing OpenGL without GLUT

As luke noted, the code to create and bind the context is specific to each windowing platform. Here are some functions to get you started in terms of initializing OpenGL on specific platforms: Windows (a tutorial is here) wglCreateContext(hDC) Mac OS X — OS X has essentially three options: Carbon, Cocoa, and the underlying Core … Read more

How to compile for Windows on Linux with gcc/g++?

mingw32 exists as a package for Linux. You can cross-compile and -link Windows applications with it. There’s a tutorial here at the Code::Blocks forum. Mind that the command changes to x86_64-w64-mingw32-gcc-win32, for example. Ubuntu, for example, has MinGW in its repositories: $ apt-cache search mingw […] g++-mingw-w64 – GNU C++ compiler for MinGW-w64 gcc-mingw-w64 – … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)