Hi, I've just discovered that it is possible to use OpenGL in Shake (the more I get to know Shake the more I love it) and I want to make a 3D grid that matches the Move3D movement of a character, sort of a virtual set but very basic.
After browsing the forum for a while I came up with a macro for a grid but I can't give it any perspective, i am using nglVertex3f points to draw the lines but the z attribute doesn't seem to affect the perspective of the lines.
I found allmost no information, of all the macros I've checked only Julien's macro for importing OBJ files uses 3d vertex. Can anyone point me in the right direction? Any macro i can check?
I've read about some Emannuel folk that seems to be an eminence on OpenGL and Shake, but I couldn't find any of his macros, can anyone give some links.
Thanks
Any help apreciated.
Here's my macro sketch:
image GridGL(
image In=0,
float value=1,
float width = GetDefaultWidth(),
float height = GetDefaultHeight(),
int pointSize = 2,
int gridSize = 100,
int timesX = 5,
int timesY = 10,
float red = 0,
float green = 1,
float blue = 0,
float alpha = 1
)
{
int x1 = 10;
int x2 = 20;
int planeWidth = width * timesX;
int planeHeight = height * timesY;
guides = NGLRender(width, height, 1, "
nglColor4f(red, green, blue, alpha);
int yStart = -width;
int yEnd = width*4;
int xStart = 10;
int xEnd = planeHeight;
nglMatrixMode(NGL\_PROJECTION);
nglPushMatrix();
//nglPerspective(126.0, 1.0, 100.0, 0.0, 1000.0, (float)(height/2));
//Draw vertical lines
for (int i = yStart; i < yEnd; i += gridSize) {
nglBegin(NGL\_LINES);
nglPointSize(pointSize);
nglVertex3f(yStart+i, 0, 0);
nglVertex3f(yStart+i, xEnd, 0);
nglEnd();
};
int zHorizontal = 0;
int hPerspective = 100;
//Draw horizontal lines
for (float j = xStart; j < xEnd; j += gridSize) {
zHorizontal += hPerspective;
nglBegin(NGL\_LINES);
nglPointSize(pointSize);
nglVertex3f(yStart, xStart+j, zHorizontal);
nglVertex3f(yEnd, xStart+j, 0);
nglEnd();
};
nglPopMatrix();
"
);
return guides;
}