and an object out of this bounds does it still draws?
Define “draws”? In general, fragments generated outside of the viewport are still ignored. However, the triangles will still have to go through all of the vertex processing before clipping.
In general, you should try not to draw too much stuff outside the viewport. But you shouldn’t try culling at the level of triangles. Just do a viewport test to see if the object as a whole is at least partially in view before drawing it.
Yes, thats what I want to chekc if a triangle is inside the viewport, but how can I do that?
the viewport coordinates are just a reference, not global coordinates, I want to check for each object I have if its inside the viewport, and drawing only the ones that are
You need to look up “frustum culling” for this. The general theory is - as Alfonse said - that you don’t cull on the level of triangles. Instead you take groups of triangles - say a model of something, or each object on your list - and cull on that level.
Yes, it does consume some extra CPU, but it’s a tradeoff versus consuming extra GPU resources, and more often than not that tradeoff is worth it. Even Quake did this, so it’s been a known-good technique for almost 15 years.
Mmh, Quake did this because this was mandatory for performance on a software rasterizer …
Now a GPU can eat a lot of triangles, so do not spend too much time culling few triangles. Instead cull complex objects with simple tests.
Measure rendering time with and without culling, to verify assumptions are correct.