Malwinder Singh
Malwinder Singh

Reputation: 7070

What does parameters mean for GLES20.glViewport(0, 0, width, height)?

Why do we pass 0 as first two parameters in GLES20.glViewport(0, 0, width, height) ? What does it signify?

Upvotes: 1

Views: 3284

Answers (1)

abcdef
abcdef

Reputation: 441

Have a look at the spec, it explains it all: Opengl spec.

The parameters x,y,width,height basically define a rectangle on the window with the OpenGL context that you want to use for OpenGL. It's typically the whole window but it doesn't have to be.

x,y is basically the bottom left coordinate of your rectangle.

Edit: you could draw an entire scene in the top half of your screen, change the viewport to the bottom half rectangle, then another scene in the bottom half or a different view of the first.

Upvotes: 3

Related Questions