mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-11-03 22:51:06 +01:00 
			
		
		
		
	Examples: imgui_impl_opengl3.cpp Using #ifdef GL_SAMPLER_BINDING instead of if (glBindSampler) (#1985)
This commit is contained in:
		@@ -163,8 +163,9 @@ void    ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
 | 
			
		||||
    glUseProgram(g_ShaderHandle);
 | 
			
		||||
    glUniform1i(g_AttribLocationTex, 0);
 | 
			
		||||
    glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
 | 
			
		||||
    if (glBindSampler) glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
 | 
			
		||||
 | 
			
		||||
#ifdef GL_SAMPLER_BINDING
 | 
			
		||||
    glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
 | 
			
		||||
#endif
 | 
			
		||||
    // Recreate the VAO every time 
 | 
			
		||||
    // (This is to easily allow multiple GL contexts. VAO are not shared among GL contexts, and we don't track creation/deletion of windows so we don't have an obvious key to use to cache them.)
 | 
			
		||||
    GLuint vao_handle = 0;
 | 
			
		||||
@@ -220,7 +221,9 @@ void    ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
 | 
			
		||||
    // Restore modified GL state
 | 
			
		||||
    glUseProgram(last_program);
 | 
			
		||||
    glBindTexture(GL_TEXTURE_2D, last_texture);
 | 
			
		||||
    if (glBindSampler) glBindSampler(0, last_sampler);
 | 
			
		||||
#ifdef GL_SAMPLER_BINDING
 | 
			
		||||
    glBindSampler(0, last_sampler);
 | 
			
		||||
#endif
 | 
			
		||||
    glActiveTexture(last_active_texture);
 | 
			
		||||
    glBindVertexArray(last_vertex_array);
 | 
			
		||||
    glBindBuffer(GL_ARRAY_BUFFER, last_array_buffer);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user