I'm trying to change the render mode for selection using glRenderMode
, below is the code I use to do this.
glSelectBuffer(size, buffer);
int before = glRenderMode(GL_SELECT);
std::cout << "before:" << before << std::endl;
GLint mode;
glGetIntegerv(GL_RENDER_MODE, &mode);i
std::cout << "mode:" << mode << std::endl;
std::cout << "gl_select:" << GL_SELECT << std::endl;
std::cout << "gl_render:" << GL_RENDER << std::endl;
The output is
before: 0
mode:7168
gl_select:7170
gl_render:7168
Which tells me that the mode is not changing, since by default it is in GL_RENDER
edit: changed code to verify it returns 0 before glRenderMode, as per @Axalo comment.
Also I noticed that running glGetError()
before the above block of code returns 0
But the following code will give me 1282
error code again
glRenderMode(GL_RENDER);
std::cout << glGetError() << std::endl;
From the docs for glRendMode, possible cause is runnning in between glBegin
and glEnd
but I do not have a call to glBegin
EDIT opengl picking is depricated in 3.1. I am using opgenl version >3.1 therefore this is not working.