C Wrapper for GLM library

Submitted by Dickens A S on Fri, 12/13/2019 - 14:46

GLM is one the GL library used for 2d 3d operation 

But it is written in C++ 

This project wraps the functions using C struct and function pointers

Example C code

GSL Library usage Kotlin Native

Submitted by Dickens A S on Wed, 12/11/2019 - 13:52

GSL library can be used for advanced math operations and vector, stats, sort, permute, fitting, matrix, fourier transform, blas integration

This code demonstration a simple matrix addition and diagonal addition in kotlin using GSL

Kotlin OSMesa offscreen rendering

Submitted by Dickens A S on Tue, 12/10/2019 - 17:31

A simple example of OSMesa driver offscreen rendering to a buffer binary array

This explains OpenGL functions can be used to indirectly manipulate a numeric array

Kotlin Code

Compiling GTK4 in windows with Vulkan

Submitted by Dickens A S on Sat, 12/07/2019 - 10:06

GTK4 is already available for download as "mingw-w64-x86_64-gtk4" you can type "pacman -S mingw-w64-x86_64-gtk4" to install it

Below steps are useful if you want to customize and install GTK4 with vulkan

Step 1 download and install MSYS2

Step 3 Install toolchains

GTK4 + GSK Cairo / Vulkan

Submitted by Dickens A S on Sat, 12/07/2019 - 09:52

Cairo is a ancient 2D library to draw shapes on linux platform.

It can be used in windows with proper library DLL extensions.

There a few software still uses cairo.

This demo kotlin code explains how to render a cairo+graphene rectangle region using GSK

Kotlin Code

Kotlin AVR Atmega8 [Experimental]

Submitted by Dickens A S on Mon, 12/02/2019 - 17:17

This is a small experiment for AVR Atmega8 

A simple swap function which is possibly re-used inside actual avr "C/C++" code as library

import platform.avr.*
import kotlinx.cinterop.internal.*
import kotlinx.cinterop.*

fun swap(a:uint8_tVar, b:uint8_tVar) = memScoped {
    var temp = a
    a.value = b.value
    b.value = temp.value
}

Install mingw64 dependencies as below

GLEW + GTK3 using Kotlin [Experimental]

Submitted by Dickens A S on Sun, 12/01/2019 - 17:59

This is an experimental code with few glitches

it allows Cygwin+Mingw to use GTK3 from cygwin to render opengl GLEW

Kotlin code

GTK3 and Glade3 using Kotlin

Submitted by Dickens A S on Sat, 11/30/2019 - 14:13

GTK windows design using glade builder

This code explains how to use Kotlin to program GTK3 and Glade3 using Cygwin Glade designer

Install cygwin with below dependencies

mingw64-x86_64-gtk3    3.22.28-1
glade                                 3.20.3-1
xorg-server                       1.20.4-1
xinit                                   1.4.1-1

launch cygwin and export the PATH as

Call OpenCL from Kotlin or embed OpenCL inside Kotlin

Submitted by Dickens A S on Fri, 11/29/2019 - 17:29

Embedded OpenCL inside Kotlin

OpenCL code which runs from kotlin

#pragma OPENCL EXTENSION cl_khr_byte_addressable_store : enable
__constant char hw[] = "Hello World";
__kernel void hello(__global char * A) {
    size_t tid = get_global_id(0);
    A[tid] = hw[tid];
}

 

Kotlin code which runs OpenCL

Call TCL from Kotlin or embed TCL inside Kotlin

Submitted by Dickens A S on Fri, 11/29/2019 - 08:37

Embedded TCL inside Kotlin

TCL code which runs from kotlin

puts "Hello, world!"

Kotlin code which run TCL

package plot

import kotlinx.cinterop.*
import tcl.*

fun main() 
{
    var tcli = Tcl_CreateInterp()
    if(Tcl_Eval(tcli, "set a 1")==TCL_OK) {
        Tcl_EvalFile(tcli, "hello.tcl")
    }
    Tcl_DeleteInterp(tcli)
}

You need to install MSYS2 and tcl using below command