I'm just feeling bored from my daily coding routine, thus thinking to try out something new to get some new inspiration. I grab the piece from learnopengl.com hoping to get some sparkling idea:
const GLchar* vertexShaderSource = "#version 330 core\n" "layout (location = 0) in vec3 position;\n" "void main()\n" "{\n" "gl_Position = vec4(position.x, position.y, position.z, 1.0);\n" "}\0"; int main(int argc, char **argv) { ... GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertexShader, 1, &vertexShaderSource, NULL); glCompileShader(vertexShader); // Check for compile time errors GLint success; GLchar infoLog[512]; glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success); if (!success) { glGetShaderInfoLog(vertexShader, 512, NULL, infoLog); std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl; } ... }
But what's surprising me is that the program failed to run even though I have NVIDIA GT 610 installed. What even surprising me when I issue the following command:
kokhoe@KOKHOE:~$ lspci -vnn | grep -i VGA -A 12 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF119 [GeForce GT 610] [10de:104a] (rev a1) (prog-if 00 [VGA controller]) Subsystem: ASUSTeK Computer Inc. Device [1043:8496] Flags: bus master, fast devsel, latency 0, IRQ 45 Memory at f6000000 (32-bit, non-prefetchable) [size=16M] Memory at e8000000 (64-bit, prefetchable) [size=128M] Memory at f0000000 (64-bit, prefetchable) [size=32M] I/O ports at e000 [size=128] Expansion ROM at f7000000 [disabled] [size=512K] Capabilities: <access denied=""> Kernel driver in use: nouveau 01:00.1 Audio device [0403]: NVIDIA Corporation GF119 HDMI Audio Controller [10de:0e08] (rev a1) Subsystem: ASUSTeK Computer Inc. Device [1043:8496]Notice that the Kernel driver in use is showing nouveau?! That means I have not yet install the driver since the first day I got the NVIDIA card. To fix this error, I installed the driver (see here to see how I do the installation), make a final verification:
kokhoe@KOKHOE:~$ lspci -vnn | grep -i VGA -A 12 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GF119 [GeForce GT 610] [10de:104a] (rev a1) (prog-if 00 [VGA controller]) Subsystem: ASUSTeK Computer Inc. Device [1043:8496] Flags: bus master, fast devsel, latency 0, IRQ 46 Memory at f6000000 (32-bit, non-prefetchable) [size=16M] Memory at e8000000 (64-bit, prefetchable) [size=128M] Memory at f0000000 (64-bit, prefetchable) [size=32M] I/O ports at e000 [size=128] [virtual] Expansion ROM at f7000000 [disabled] [size=512K] Capabilities: <access denied=""> Kernel driver in use: nvidia 01:00.1 Audio device [0403]: NVIDIA Corporation GF119 HDMI Audio Controller [10de:0e08] (rev a1) Subsystem: ASUSTeK Computer Inc. Device [1043:8496]Ah ha~ now it shows nvidia is the current driver in use. Before I run the program, I just want to make sure the supported shader language is 3.3.
kokhoe@KOKHOE:~$ glxinfo | grep 'version' server glx version string: 1.4 client glx version string: 1.4 GLX version: 1.4 OpenGL core profile version string: 4.3.0 NVIDIA 352.63 OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler OpenGL version string: 4.5.0 NVIDIA 352.63 OpenGL shading language version string: 4.50 NVIDIANow my OpenGL info shows me version 4.5, it is far more advance than the expected version. This shouldn't be a problem with my program.