Shift the center of the screen

  • Follow


Hello

I have an OpenGL fullscreen program and I hide the left part (let's say 
a rectangle from (0,0) to (200,resolution height-1)). Is it possible to 
shift the view axis (x=0,y=0,z=[-infinity,+infinity]) to the right so 
that it is centered not on the screen, but on the remaining rectangle?
I know I can render to texture then apply that texture to the remaining 
rectangle, but I was wondering if we can perform that directly.

Thanks

Cathy L.
0
Reply Cathy 8/4/2010 7:09:23 AM

On Aug 4, 9:09=A0am, "Cathy L." <n...@now.fr> wrote:
> Hello
>
> I have an OpenGL fullscreen program and I hide the left part (let's say
> a rectangle from (0,0) to (200,resolution height-1)). Is it possible to
> shift the view axis (x=3D0,y=3D0,z=3D[-infinity,+infinity]) to the right =
so
> that it is centered not on the screen, but on the remaining rectangle?
>

Use glViewport()

(And glScissor() - always use both these functions together)

0
Reply fungus 8/4/2010 7:55:24 AM


> Use glViewport()
> 
> (And glScissor() - always use both these functions together)

Ok thanks Fungus, I thought this just changed the clipping plane, but 
didn't move the central axis.
0
Reply Cathy 8/4/2010 8:44:18 AM

On Wed, 04 Aug 2010 10:44:18 +0200, Cathy L. wrote:

>> Use glViewport()
>> 
>> (And glScissor() - always use both these functions together)
> 
> Ok thanks Fungus, I thought this just changed the clipping plane, but 
> didn't move the central axis.

The concatentation of the modelview and projection matrices maps object
coordinates to normalised device coordinates. All primitives are
clipped[1] against the cube formed by the planes {x=-1, x=1, y=-1, y=1,
z=-1, z=1} in normalised device coordinates. The viewport maps this cube
to window coordinates.

[1] The clipping applies to geometry, not rasterisation. Consequently,
the result of rasterising points, wide lines and bitmaps can extend
outside of the viewport, hence the recommendation to also use glScissor
(which applies to rasterisation).

0
Reply Nobody 8/4/2010 9:31:24 PM

3 Replies
162 Views

(page loaded in 0.117 seconds)

Similiar Articles:
















6/21/2012 4:11:16 AM


Reply: