Window View Port Mapping Computer Graphics
Window View Port Mapping Computer Graphics
2DViewing
ClippingWindowvs.Viewport
Butitcanbemodifiedsothatonlyapartofthe displaywindowisusedforOpenGLdisplay
Rectangular Window
y world y0
Rotated Window
1.constructsceneinworldcoordinate(attributes,o/p primitives)
Viewportsdefinedinunitsquares(normalized coordinates) Itseperatesview&othertransformationfromdevice specifico/pdevrequirements,sographicpkgsislargely deviceindependent. Oncescenetransferredtonc,unitsquareissimply mappedtodisplayareaforparticularo/pdevinuseat thattime. Whenallcoordinatetransformationcompleted viewportclippingwithnormalizedcoordinates Reducecomputationbyconcatenationofvarious transformationmatrices.
x view y
view
x world
x view
T x 0 , y 0
Mwc,vc= RT
Normalization
(yv-yvmin)/yvmax-yvmin)=(yw-ywmin)/(ywmax-ywmin)
Thiscanalsobeaccomplishedin2steps: 1.Scaleoverthefixedpoint(xwmin,ywmin)
2.Translatelowerleftcorneroftheclippingwindowtothelower leftcorneroftheviewport
Relativeproportionsofobjsmaintained,ifsx=sy.Otherwiseworld objsstretchedorcontractedeitherinxorydir
OpenGL2DViewingFunctions
Setting up a Viewport
glViewport (xvmin, yvmin, vpWidth, vpHeight); All the parameters are given in integer screen coordinates relative to the lower-left corner of the display window. If we do not invoke this function, by default, a viewport with the same size and position of the display window is used (i.e., all of the GLUT window is used for OpenGL display)
2DViewingFunctions
evaluateViewOrientationMatrix(x0,y0,xV,yV, error,viewMatrix)
x0,y0coordinatesofviewingorigin xV,yVworldcoordinatesforviewupvector
error(integer)Errorcodegeneratedifi/pargsareinerro
OtherwisetheviewMatrixworldtoviewtransformation calculated.
ToSetupelementsinwindow viewportmappingmatrix
evaluateViewMappingMatrix(xwmin,xwmax,ywmin ,ywmax,xvmin,xvmax,yvmin,yvmax,error,viewMa ppingMatrix) xwmin,xwmax,ywmin,ywmaxWindowlimits xvmin,xvmax,yvmin,yvmaxViewportlimits ViewMappingMatrixforcreatingwindowviewport pairs&usetoprojectvariouspartstosceneto differentareas
wso/pdevice(workstation) ValueofviewIndexsetsintegeridforparticular
Tosetparticularsetofoptions fromviewingtable
setViewIndex(viewIndex) ViewIndexselectionappliedtosubsequento/pprimitives& associatedattributes&generatesdisplayoneach workstation. lastworkstationtransformationbyselectingaworkstation windowviewportpair setWorkstationWindow(ws,xwsWindmin,xsWindmax,yw sWindmin,ywsWindmax) setWorkstationViewport(ws,xwsVPortmin,xwsVportma x,ywsVportmin,ywsVportmax)
wsworkstationnumber Windowcoordinatesextendsarespecified(0to1) Viewportlimitsintegerdevicecoordinates Ifworkstationviewportnotspecified,unitsquareof normalizedref.Frameismappedontolargestsquare areapossibleono/pdevice. Coordinateoriginofnormalizedspacemappedto originofdevicecoordinates. Aspectratioisretainedbytransformingunitsquare ontosquareareaono/pdevice.
THANKYOU!!!!