Stupid OpenGL question
Posted: 20 Feb 2008, 23:38
Um... if I have vertexes at positions XYZ (1,1,1), (-1,1,1), (1,1,-1), (-1,1,-1) and I want to draw a line strip between them, how do I do that? The few examples I've seen are using functions, but I don't want to call a function, I just want to give it vertex locations. How do I feed it some raw numbers? Sorry in advance, if this seems stupid or whatever, but the LUA OpenGL stuff doesn't look at all like the OpenGL reference materials I could find.
To put this into perspective, the reference I found for drawing lines with C++ was written like this:
glBegin(GL_LINE_STRIP);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f(-0.5f, 0.5f, 0.0f);
glVertex3f(-0.7f, 0.5f, 0.0f);
glEnd();
However, the LUA OpenGL API requires that it be written like this:
gl.BeginEnd( number GLType, function [, arg1,... ] ) -> nil
... which I'm finding totally confusing. Why does it require a function?
What I want, basically, is to do some lines from positions XYZ --> XYZ, then do another set of lines, but with a different alpha value, and so on.
To put this into perspective, the reference I found for drawing lines with C++ was written like this:
glBegin(GL_LINE_STRIP);
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f(-0.5f, 0.5f, 0.0f);
glVertex3f(-0.7f, 0.5f, 0.0f);
glEnd();
However, the LUA OpenGL API requires that it be written like this:
gl.BeginEnd( number GLType, function [, arg1,... ] ) -> nil
... which I'm finding totally confusing. Why does it require a function?
What I want, basically, is to do some lines from positions XYZ --> XYZ, then do another set of lines, but with a different alpha value, and so on.