How make 4 Viewports in 3D

Previous topic - Next topic

mentalthink

HI there,
I need to make 4 Viewports, like a 3d modeler, but I don´t have succes yet.

I think I made this some time ago, but I don´t rebember.

Anyone knows how to do it.

Thanks in advance,
Iván J.

Ruidesco

#1
I guess you want something like the following:

Code (glbasic) Select
CONSTANT X = 0, Y = 1

LOCAL appWidth = 640
LOCAL appHeight = 480
LOCAL appHalfWidth = appWidth / 2
LOCAL appHalfHeight = appHeight / 2

LOCAL viewports[]; DIM viewports[4][2]

// LEFT TOP
viewports[0][X] = 0; viewports[0][Y] = 0;

// RIGHT TOP
viewports[1][X] = appHalfWidth; viewports[1][Y] = 0;

// LEFT BOTTOM
viewports[2][X] = 0; viewports[2][Y] = appHalfHeight;

// RIGHT BOTTOM
viewports[3][X] = appHalfWidth; viewports[3][Y] = appHalfHeight;

SETSCREEN appWidth, appHeight, FALSE

LOCAL i

WHILE 1

FOR i = 0 TO LEN(viewports[]) - 1

VIEWPORT viewports[i][X], viewports[i][Y], appHalfWidth, appHalfHeight
X_MAKE3D 1, 1000, 45
X_CAMERA 0, 0, 10, 0, 0, 0

X_PRINT viewports[i][X] + "," + viewports[i][Y], 0, 0, 0, 0

NEXT

SHOWSCREEN

WEND

erico

I can only hope you are going for a hired guns remake...

Qube

Be careful relying on viewports as not all OpenGL drivers support them properly and end up ignoring them completely.

On my MacBook Pro, for example, they work in Windows via Parallels but not natively with Windows 7 via bootcamp.

mentalthink

Thanks for all replyes.

@Rudiesco, thanks for your code, works perfectlly...

Kinds Regards,
Iván J.