diff --git a/ic3/.ic3_history b/ic3/.ic3_history
index 0020cd2..6d55dd6 100644
--- a/ic3/.ic3_history
+++ b/ic3/.ic3_history
@@ -23,3 +23,12 @@ quote (Void) 0
type((Void) 0)
quote (Void) 0
%GL.Point2D{}
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/.libs/libc3_window.so.0.0")
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/sdl2/.libs/libc3_window_sdl2.so.0.0")
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/.libs/libc3_window.so.0.0")
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/sdl2/.libs/libc3_window_sdl2.so.0.0")
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/.libs/libc3_window.so.0.0")
+dlopen("/home/dx/c/thodg/c3-lang/c3/libc3/window/sdl2/.libs/libc3_window_sdl2.so.0.0")
+(Ptr) 0x193a838c800
+type((Ptr) 0x193a838c800)
+type(0x193a838c800)
diff --git a/lib/c3/0.1/c3.facts b/lib/c3/0.1/c3.facts
index 65f6c01..7d0c3b6 100644
--- a/lib/c3/0.1/c3.facts
+++ b/lib/c3/0.1/c3.facts
@@ -191,4 +191,4 @@ replace {C3.facts_next_id, :cfn, cfn Uw "c3_facts_next_id" (Result)}
add {C3, :symbol, C3.getenv}
replace {C3.getenv, :cfn, cfn Str "c3_getenv" (Str, Result)}
add {C3, :symbol, C3.dlopen}
-replace {C3.dlopen, :cfn, cfn Ptr "c3_dlopen" (Char*)}
+replace {C3.dlopen, :cfn, cfn Ptr "c3_dlopen" (Str, Result)}
diff --git a/lib/c3/0.1/ptr.facts b/lib/c3/0.1/ptr.facts
new file mode 100644
index 0000000..05ec535
--- /dev/null
+++ b/lib/c3/0.1/ptr.facts
@@ -0,0 +1,5 @@
+%{module: C3.Facts.Dump,
+ version: 1}
+replace {Ptr, :is_a, :module}
+replace {Ptr, :symbol, Ptr.cast}
+replace {Ptr.cast, :cfn, cfn Ptr "ptr_init_cast" (Result, Tag)}
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index 9efdc7f..d982471 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -1564,7 +1564,7 @@ sw buf_inspect_ptr (s_buf *buf, const u_ptr_w *ptr)
sw r;
sw result = 0;
assert(buf);
- if ((r = buf_write_1(buf, "(Ptr) ")) < 0)
+ if ((r = buf_write_1(buf, "(Ptr) 0x")) < 0)
return r;
result += r;
if ((r = buf_inspect_uw_hexadecimal(buf, (uw *) &ptr->p)) < 0)
@@ -1578,7 +1578,7 @@ sw buf_inspect_ptr_free (s_buf *buf, const u_ptr_w *ptr_free)
sw r;
sw result = 0;
assert(buf);
- if ((r = buf_write_1(buf, "(PtrFree) ")) < 0)
+ if ((r = buf_write_1(buf, "(PtrFree) 0x")) < 0)
return r;
result += r;
r = buf_inspect_uw_hexadecimal(buf, (uw *) &ptr_free->p);
@@ -1592,7 +1592,7 @@ sw buf_inspect_ptr_free_size (const u_ptr_w *ptr)
{
sw result;
(void) ptr;
- result = strlen("(PtrFree) ");
+ result = strlen("(PtrFree) 0x");
result += sizeof(uw) / 4;
return result;
}
@@ -1601,7 +1601,7 @@ sw buf_inspect_ptr_size (const u_ptr_w *ptr)
{
sw result;
(void) ptr;
- result = strlen("(Ptr) ");
+ result = strlen("(Ptr) 0x");
result += sizeof(uw) / 4;
return result;
}
diff --git a/libc3/c3.c b/libc3/c3.c
index 44ba7c4..f7b18c8 100644
--- a/libc3/c3.c
+++ b/libc3/c3.c
@@ -44,10 +44,13 @@ void c3_clean (s_env *env)
sym_delete_all();
}
-void * c3_dlopen (const s_str *path)
+void ** c3_dlopen (const s_str *path, void **dest)
{
assert(path);
- return dlopen(path->ptr.pchar, RTLD_GLOBAL);
+ assert(dest);
+ printf("dlopen %s -> %p\n", path->ptr.pchar, (void *) dest);
+ *dest = dlopen(path->ptr.pchar, RTLD_GLOBAL);
+ return dest;
}
void c3_exit (sw code)
diff --git a/libc3/window/sdl2/gl_ortho.c b/libc3/window/sdl2/gl_ortho.c
index 161f373..3689554 100644
--- a/libc3/window/sdl2/gl_ortho.c
+++ b/libc3/window/sdl2/gl_ortho.c
@@ -22,23 +22,23 @@ static const char * g_gl_ortho_vertex_shader_src =
"layout (location = 0) in vec3 iPos;\n"
"layout (location = 1) in vec3 iNormal;\n"
"layout (location = 2) in vec2 iTexCoord;\n"
- "out vec3 oFragNormal;\n"
"out vec2 oTexCoord;\n"
+ "out vec3 oFragNormal;\n"
"uniform mat4 uProjectionMatrix;\n"
"uniform mat4 uViewMatrix;\n"
"uniform mat4 uModelMatrix;\n"
"void main() {\n"
" gl_Position = vec4(uProjectionMatrix * uViewMatrix * \n"
" uModelMatrix * vec4(iPos, 1.0));\n"
+ " oTexCoord = iTexCoord;\n"
" oFragNormal = vec3(mat3(transpose(inverse(uModelMatrix))) *\n"
" iNormal);\n"
- " oTexCoord = iTexCoord;\n"
"}\n";
static const char * g_gl_ortho_fragment_shader_src =
"#version 330 core\n"
- "in vec3 iFragNormal;\n"
"in vec2 iTexCoord;\n"
+ "in vec3 iFragNormal;\n"
"out vec4 oFragColor;\n"
"uniform vec4 uColor;\n"
"uniform bool uEnableTex2D;\n"
@@ -118,7 +118,7 @@ s_gl_ortho * gl_ortho_init (s_gl_ortho *ortho)
ortho->position.x = 0.0f;
ortho->position.y = 0.0f;
ortho->position.z = 0.0f;
- ortho->rotation.x = M_PI;
+ ortho->rotation.x = 0.0f;
ortho->rotation.y = 0.0f;
ortho->rotation.z = 0.0f;
ortho->scale.x = 1.0f;