PDA

View Full Version : OpenGL BadMatch error



LastHorizon
04-19-2016, 03:14 AM
Hi there,

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 :)

Cheers

Alex

GClements
04-19-2016, 03:58 AM
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 ()

Opcode 34 is GLXCreateContextAtrribsARB().

The most common reason for BadMatch is that you requested an unsupported version.



I have run the glxinfo command but I'm not quite sure what this tells me!

Check the value for "OpenGL version string".

LastHorizon
04-19-2016, 09:51 AM
I think I have managed to set up my programme now. I have achieved this by doing a lot more pre-amble sort of stuff to set up the xwindows environment and not used the following commands:

glutInitDisplayMode()
glutInitWindowsPosition()
glutInitWindowSize()
glutCreateWindow()

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()

Has anyone got any ideas?

cheers,

alex

GClements
04-19-2016, 12:13 PM
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.

LastHorizon
04-20-2016, 07:48 AM
Thanks for the help! That appears to have solved my window creating issues.

It appears my code isn't loading the models I desire, which it does when debugging in visual studio. I would guess there are some file path problems somewhere in my code for me to deal with.

Thanks again for every ones help

Alex

kaufenpreis
08-07-2016, 04:38 AM
I am now experiencing a problem where my programme is breaking out of the glutMainLoop(); too. Please help.