I’m relatively new to using OpenGL and whereas I’ve been successful on a windows platform, I now wish to port my code to an NVIDIA Jetson tk1 board.
I’ve managed to make the code compile but when I run it, I’m getting the error
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 155 (GLX)
Minor opcode of failed request: 34 ()
Serial number of failed request: 30
current serial number in output stream: 31
The code is using FreeGLUT, GLEW, and glm libraries and I will want to use SOIL once I have managed to get this project working!
I’m attempting to work with OpenGL version 4.5 (which I think is supported on the Jetson TK1 board) I attempted a basic test with the glewIsSupported command which seemed to verify support for 4.5
I have run the glxinfo command but I’m not quite sure what this tells me!
I’ll admit I’m a bit of a novice when it comes to linux, but any help to get me up and running would be much appreciated
I have done a check and my system seems to support OpenGL 4.4 which I have set my system to and my shaders are using #version 440 core
I am now experiencing a problem where my programme is breaking out of the glutMainLoop();
So, let me expand on this further:
I set up my window parameters and initialise glew and glut. ]
I then have a routine that reads my external shaders.
Next i create my object (in this instance i am making a simple cube that shall be rotated by the shader)
Then i attempt to run the programme by calling glutMainLoop();
My programme gets to this point and calls the function but then immediately leaves the main loop and hits my ‘delete engine;’ and ‘return 0’ commands in my main()
With the original GLUT library, glutMainLoop() never returns.
FreeGLUT and OpenGLUT added the glutLeavMainLoop() function which allows the main loop to be terminated, and also added support for glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS), which causes glutMainLoop() to return if a window is closed.
If you don’t call either of these, glutMainLoop() shouldn’t return. The default behaviour on closing a window is to terminate the process.
The main thing to bear in mind is that all OpenGL functions require a current context. This includes the functions which GLEW uses to query implementation details. In GLUT, each window has an associated context. Creating a window automatically makes its context current, as does glutSetWindow(); GLUT itself performs an implicit glutSetWindow() before invoking any of the window callbacks.
In terms of initialisation, you need to have called glutCreateWindow() before initialising GLEW, otherwise no context will be bound. Similarly, object creation needs to wait until after this point. Note that the contexts created by GLUT don’t share data, so if you have more than one window, you need to create any textures, buffers, etc separately for each window.