Render specified amount of pixels to framebuffer


Is there any way, to render only specified amount of pixels to a framebuffer? Something, like using glViewport, that would crop the scene.
Such thing, would be used in checking which object was clicked, by color picking, but instead of rendering the whole scene, that would be for example 800x600, we would just render one pixel, just where cursor is, to prevent unneccesary data usage.

You can use glScissor with an area of 1 pixel at the specified mouse coords. That will crop the render to a single pixel. While this will save on fragment writes, you’ll still pay for all vertex computation (vertex, tessellation, geometry shaders). If you have a vertex bottleneck, you may want to additionally consider implementing frustum culling to reject draw calls entirely.

Thank you, I will use that function. The vertex processing should not be a problem, because I only render a simple cube object, made of 8 vertices.