OpenGL: how glScissors works?

I’m trying to replace my canvas to an OpenGL based class in my app (mainly because clipping is bugged in canvas). Can anybody post me an example how OpenGL.glScissor should work?
I’ve this piece of code:

if (IsClip) then
    OpenGL.glEnable(opengl.GL_SCISSOR_TEST)
    OpenGL.glScissor(clipX,clipY,clipWidth,clipHeight)
end

[drawing happens here]

if (IsClip) then
    opengl.glDisable(opengl.GL_SCISSOR_TEST)
end

Where clipX,clipY,clipWidth,clipHeight are valid coordinates of the clipping region, but with the above code it doesn’t display anything if IsClip is true (otherwise works fine)

What’s buggy about canvas clipping? You can only clip 1 level and accounting for that clipping has worked for me.

Your OpenGL code looks correct. The 2 possibilites I can think of are scissoring can’t be changed inside a begin/end and coordinates are Y-up. This code (which is your code with brute force drawing) should draw a green block in the lower left corner, unless it’s inside a begin/end.

[code]OpenGL.glEnable(OpenGL.GL_SCISSOR_TEST)
OpenGL.glScissor(10, 10, 200, 100)

OpenGL.glClearColor(0, 1, 0, 0)
OpenGL.glClear(OpenGL.GL_COLOR_BUFFER_BIT)

OpenGL.glDisable(OpenGL.GL_SCISSOR_TEST)[/code]

Thanks for the help, the Y coordinates were wrong (as for Scissor y=0 means the lower edge).
Nested clips are not working with Xojo (see: <https://xojo.com/issue/26289>)