glViewport use/misuse question

Just say I have a render target of say 512x512 is it valid OpenGL code to set a viewport like:

glViewport(-512,-512,2048,2048);

It seems that there is nothing in the spec to dis-allow this (and my current thinking is that it works on Nvidia) but I was wondering if it was a mis-use of the call.

To more precisely describe what I am doing, I am magnifying a part of scene - and I can’t easily modify the perspective matrix. (My code is not the code that creates/sets or uses the matrix)

So in summary, is it standard/valid to set viewport limits outside the current render target area?

The spec only imposes constraints on the width and height of the viewport, not on the origin. More specifically, it states that the width and height are clamped to the maximum viewport dimensions, and that they must not be negative. Since nothing is said about the viewport origin, I would say your code is valid.

I can’t imagine why it would ever be considered a problem, it’s just a simple scale/bias no matter what numbers are fed in.

Thanks guys,I only asked as “some other” 3D API has problems with viewports outside the render area.