I'm working on making a c# wrapper for freeglut and it was going smoothly until I hit an issue.
nativeGL.cpp:
extern "C"
{
FREEGLUTNATIVE_API void GL_DRAW_POLY(Vector2 *points, int count)
{
glBegin(GL_POLYGON);
glColor3b(0,255,255);
std::cout << count << " ";
for (int i = 0; i < count; i++)
{
//std::cout << points[i].x << " " << points[i].y << " ";
glVertex3d(points[i].x, points[i].y, 0);
}
std::cout << std::endl;
glEnd();
}
}
GL.cs:
public static class GL
{
[DllImport(dllName: "FREEGLUTNATIVE.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void GL_DRAW_POLY(Vector2[] points, int count);
public static void DrawPolygon(Vector2[] points) {
GL_DRAW_POLY(points, points.Length);
}
}
Other methods work such as GL.CreateWindow and that works but for some reason GL.DrawPolygon doesn't work. the cout
ing works and give the expected output, but nothing is appearing on the window.
PS. This is a learning experience