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)); }

Linking GLEW with CMake

Typical CMake scripts like FindGLEW will define variables that specify the paths and files that your project needs. If the script can’t automatically identify the correct paths (usually because of nonstandard install location, which is fine), then it leaves these variables up to you to fill in. With command line CMake, you use the -D … Read more

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

difference of freeglut vs glew?

The OpenGL Extension Wrangler (GLEW) is used to access the modern OpenGL API functions(version 3.2 up to latest version).If we use an ancient version of OpenGL then we can access the OpenGL functions simply including as #include <GL/gl.h>.But in modern OpenGL, the API functions are determined at run time, not compile time. GLEW will handle … Read more

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