• W

    No i think my dedicated graphics does nothing.
    glxinfo | grep OpenGL
    OpenGL vendor string: Intel Open Source Technology Center
    OpenGL renderer string: Mesa DRI Intel(R) HD Graphics (Whiskey Lake 3x8 GT2)
    OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.7
    OpenGL core profile shading language version string: 4.50
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile
    OpenGL core profile extensions:
    OpenGL version string: 3.0 Mesa 18.2.7
    OpenGL shading language version string: 1.30
    OpenGL context flags: (none)
    OpenGL extensions:
    OpenGL ES profile version string: OpenGL ES 3.2 Mesa 18.2.7
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
    OpenGL ES profile extensions:

    inxi -G -C -S
    System: Host: zenbook Kernel: 4.19.0-1-amd64 x86_64 bits: 64 Desktop: Gnome 3.30.1
    Distro: Debian GNU/Linux buster/sid
    CPU: Topology: Quad Core model: Intel Core i7-8565U bits: 64 type: MT MCP L2 cache: 8192 KiB
    Speed: 700 MHz min/max: 400/4600 MHz Core speeds (MHz): 1: 745 2: 744 3: 795 4: 705 5: 766
    6: 798 7: 791 8: 748
    Graphics: Device-1: Intel driver: i915 v: kernel
    Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] driver: nouveau v: kernel
    Display: wayland server: X.Org 1.20.3 driver: nouveau resolution: 1920x1080~60Hz
    OpenGL: renderer: Mesa DRI Intel HD Graphics (Whiskey Lake 3x8 GT2) v: 4.5 Mesa 18.2.7

    sorry i mean, copy the executable to my old Laptop and it works:)

    posted in Kode read more
  • W


    with my new laptop the kore taget give me this error:
    Initializing Haxe libraries
    Starting Kore
    X Error of failed request: GLXBadFBConfig
    Major opcode of failed request: 151 (GLX)
    Minor opcode of failed request: 34 ()
    Serial number of failed request: 23
    Current serial number in output stream: 23

    I can copy the build to my old Laptop and everything runs fine.
    The html5 target has no problem.
    I get the same error when i use kore without kha.

    My new laptop has a dedicated graphics card, and after hours of installation i get a working hardware and X configuration.
    uname -a
    Linux zenbook 4.19.0-1-amd64 #1 SMP Debian 4.19.12-1 (2018-12-22) x86_64 GNU/Linux

    Maybe I have not yet configured my system correctly, I'll ask first here because other opengl applications work properly.
    If necessary, I like to send more information about my system.

    posted in Kode read more
  • W

    Hallo Robert, i have upload to github
    uname -a:
    Linux twist 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64 GNU/Linux
    clang --version:
    clang version 7.0.0-svn345401-1~exp1~20181026173536.34 (branches/release_70)
    node <path to kore>/make.js --compile
    node <path to kore>/make.js --onlyshaders
    I use the latest kore version, but it should work, all the gametech-examples (with G4) compile and run without any errors (with very small change - third parameter from VertexBuffer has a default and is no more int)
    I can validate the shaders with glslangValidator without errors. But i am not sure about the pch.h. I have tried everything without success...

    posted in Kode read more
  • W

    hi, i use the Empty project from Kore and would have some uniforms in the fragment shader.
    I put a vec2 variable in the shader.frag.glsl:
    uniform vec2 iMouse;
    Add a line in the kore function of the Shader.cpp after pipeline->compile():
    mousePos = pipeline->getConstantLocation("iMouse");
    And after Graphics4::setPipeline(pipeline) in the update function add a line:
    Graphics4::setFloat2(mousePos, (float)mouseX, (float)mouseY);
    I get always this error message:
    Uniform iMouse not found.

    The program compile without errors, mouseX and mouseY are valid integers and mousePos is a Graphics4::ConstantLocation.
    Hope for help after hours with trial and error.

    posted in Kode read more
  • W

    hello romamik ,

    first many thanks for the zui update.
    After removing one of the System.notifyOnRender calls the model appears again, no matter if i call g2.begin(false) or not. I am happy, but not too long.
    I have a class which splits a icosahedron for me. Now I wanted to test the performance of my video card. After 33 splits (one face of the icosahedron ), these are only 23120 triangles for the entire model, i get a strange result.

    (file:///bla/bla/do not know how i can upload files/Bildschirmfoto%20vom%202016-09-24%2021-06-50.png)

    That could not be, and I thought that is due to the javascript float type (or what ever). I test my program with the cpp target and now the model disappears again. After removing the g2 render calls from zui, the model is drawn and i can go up to 230 splits ca. 1,2 million triangles without the ugly hole in my sphere. Now a simple example with zui and graphics4.

    private var vertices:Array<Float> = [
        0, Math.sqrt(3) / 2, 0,
        -0.5, 0, -1 / 3,
        0.5, 0, -1 / 3,
        0, 0, -1 / 3 + Math.sqrt(3) / 2,
        0, -Math.sqrt(3) / 2, 0];
    private var colors:Array<Float> = [
        1, 1, 0,
        0, 1, 0,
        0, 0, 1,
        1, 0, 0,
        1, 0, 1];
    private var indices:Array<Int> = [
        0, 1, 2,
        0, 2, 3,
        0, 3, 1,
        4, 2, 1,
        4, 3, 2,
        4, 1, 3];
    private var font:Font;
    private var structure:VertexStructure;
    private var structureLength:Int;
    private var vertexBuffer:VertexBuffer;
    private var indexBuffer:IndexBuffer;
    private var pipeline:PipelineState;
    private var mvpID:ConstantLocation;
    private var projection:FastMatrix4 = FastMatrix4.perspectiveProjection(45.0, 4.0 / 3.0, 0.1, 100.0);
    private var view:FastMatrix4 = FastMatrix4.lookAt(
        new FastVector3(2, 0, 0), // Camera is at (2, 0, 0), in World Space
        new FastVector3(0, 0, 0), // and looks at the origin
        new FastVector3(0, 1, 0)); // Head is up (set to (0, -1, 0) to look upside-down)
    private var model:FastMatrix4 = FastMatrix4.identity();
    private var mvp:FastMatrix4;
    private var lastTime:Float;
    private var rotX:Float = 0;
    private var rotY:Float = 0;
    private var rotZ:Float = 0;
    private var ui:Zui;
    private var width:Int;
    private var height:Int;
    private function loadingFinish():Void {
        font = Assets.fonts.DroidSans;
        ui = new Zui(font);
        // Define vertex structure
        structure = new VertexStructure();
        structure.add("pos", VertexData.Float3);
        structure.add("col", VertexData.Float3);
        structureLength = 6;
        // Compile pipeline state
        pipeline = new PipelineState();
        pipeline.inputLayout = [structure];
        pipeline.vertexShader = Shaders.simple_vert;
        pipeline.fragmentShader = Shaders.simple_frag;
        // Set depth mode
        pipeline.depthWrite = true;
        pipeline.depthMode = CompareMode.Less;
        pipeline.cullMode = CullMode.CounterClockwise;
        // Get a handle for our "MVP" uniform
        mvpID = pipeline.getConstantLocation("MVP");
        mvp = FastMatrix4.identity();
        mvp = mvp.multmat(projection);
        mvp = mvp.multmat(view);
        mvp = mvp.multmat(model);
        vertexBuffer = new VertexBuffer(
            /* Vertex count - 5 vertices * 6 floats */ 30,
            /* Vertex structure */ structure,
            /* Vertex data will stay the same */ Usage.StaticUsage);
        var vbData = vertexBuffer.lock();
        for (i in 0...Std.int(vbData.length / structureLength)) {
            vbData.set(i * structureLength, vertices[i * 3]);
            vbData.set(i * structureLength + 1, vertices[i * 3 + 1]);
            vbData.set(i * structureLength + 2, vertices[i * 3 + 2]);
            vbData.set(i * structureLength + 3, colors[i * 3]);
            vbData.set(i * structureLength + 4, colors[i * 3 + 1]);
            vbData.set(i * structureLength + 5, colors[i * 3 + 2]);
        // Create index buffer
        indexBuffer = new IndexBuffer(
            /* Number of indices for tetraeder */ indices.length,
            /* Index data will stay the same*/ Usage.StaticUsage);
        // Copy indices to index buffer
        var iData = indexBuffer.lock();
        for (i in 0...iData.length) {
            iData[i] = indices[i];
        width = System.windowWidth();
        height = System.windowHeight();
        lastTime = 0;
        Scheduler.addTimeTask(update, 0, 1 / 60);
    public function new() {
    public function update():Void {
        model = FastMatrix4.rotation(rotY, rotX, rotZ);
        mvp = FastMatrix4.identity();
        mvp = mvp.multmat(projection);
        mvp = mvp.multmat(view);
        mvp = mvp.multmat(model);
    public function render(framebuffer:Framebuffer):Void {
        var g = framebuffer.g4;
        g.clear(Color.fromFloats(0.05, 0.0, 0.15), 1.0);
        g.setMatrix(mvpID, mvp);
        var g2 = framebuffer.g2; // g2.begin(false);
        if (ui.window("", 0, 0, width, height)) {
            if (ui.node(Id.node(), "Rotations", true)) {
                ui.row([1/3, 1/3, 1/3]);
                rotX = ui.slider(Id.slider(), "X", -Math.PI, Math.PI);
                rotY = ui.slider(Id.slider(), "Y", -Math.PI, Math.PI);
                rotZ = ui.slider(Id.slider(), "Z", -Math.PI, Math.PI);
        ui.end(); //g2.end();

    It works with the html target, but the cpp target does not show the model.
    It flickers a little bit if i move the sliders. Maybe it's because of my onboard Intel graphics card, but in fact I have no idea what's wrong.

    posted in Kode read more
  • W

    Hi lubos,
    thanks for the links.
    But befor i dares to bullet stuff, I want to understand the capabilities of verletkha.
    That is enough funny physic stuff for the first time.
    But surfing from your link, I found this tutorial:
    Jamie King
    and the git repo
    Since I have fast internet, i like youtube. And this guy is really entertaining.
    Best wishes

    posted in Kode read more
  • W

    Hallo lubos,
    shame on me, i never touch my Main.hx:

    public static function main() {
    	System.init({title:"Sphere", width:800, height:600}, function(){
    			var game = new LookAtCam();
    			Scheduler.addTimeTask(game.update, 0, 1 / 60);

    And then copy and paste your tutorial, but there is always a System.notifyOnRender call in your code. Remove one of these calls and everything runs smoothly.

    I have one more question, specially to you. I know that your day has also only 24 hours, but can you make a last tutorial 09 wich covers picking behavior. Go from window coordinates to model coordinates is such a common task. I have played around with this, but only with software rendering (kha.graphics1). I have my model coordinates my view (only a vec3) and a projection plane wich i cover with rays. Then working with barycentric coordinates from the triangle (my great model;-) and if one ray target the triangle then calculate the depth. That works, but the real transforming pipeline with all the 4X4 matrices (especially the lookAt-matrix) overwhelms me a bit.

    No problem if you have no time for such a tutorial.
    And many thanks for negativ values in sliders.

    posted in Kode read more
  • W


    i try something like this:

        var g = framebuffer.g4;
        g.clear(Color.fromFloats(0.0, 0.0, 0.3), 1.0);  ...
        var g2 = framebuffer.g2;
        zui.begin(g2); ...

    But unfortunately that does not work. Zui is drawn but my model vanishes.

    Slider work with negativ values:-)

    posted in Kode read more
  • W

    i try the geometry shader for a wireframe example. The shaders compile without a error. I have used this example:
    wireframe with hidden edges
    (vertex shader -> vs.glsl, geometry shader -> gs.glsl, fragment shader -> fs.glsl)

        pipeline.vertexShader = Shaders.simple_vert;
        pipeline.geometryShader = Shaders.simple_geom;
        pipeline.fragmentShader = Shaders.simple_frag;

    But i get this error message:
    kha.graphics4.FragmentShader should be kha.graphics4.GeometryShader
    I have no idea why this error message occurs.

    Thanks for all the help that I have already found here:-)

    posted in Kode read more
  • W

    Great it works. Many thanks Robert , I have been wondering a typo that can not be.

    posted in Kode read more
  • W

    i have found this network / multiplayer example on git:

    I think there is a small typo in the readme:
    ... then navigate to "build/node" and start the server with node kha.js
    node kha.js => node server.js

    My problem is, i get this message when i calling >npm install:
    *ws@0.4.32 install /path to project/BlockArena/build/node/node_modules/w> (node-gyp rebuild 2> builderror.log) || (exit 0)

    make: Verzeichnis ,,/path to project/BlockArena/build/node/node_modules/ws/build" wird betreten
    CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
    bufferutil.target.mk:90: die Regel für Ziel ,,Release/obj.target/bufferutil/src/bufferutil.o" scheiterte
    make: Verzeichnis ,,/path to project/BlockArena/build/node/node_modules/ws/build" wird verlassen*

    I open two clients in my browser and have a strange behavior. The red blocks flicker in the left side of the canvas.
    An when i close one client (close tab in browser) i get this error from the server:
    throw er; // Unhandled 'error' event

    Error: channel closed
    at process.target.send (internal/child_process.js:523:16)
    at Object.kha_network_NodeProcessClient.send (/path to project/BlockArena/build/node/kha.js:14991:11)
    at Object.kha_network_Session.sendToEverybody (/path to project/BlockArena/build/node/kha.js:15365:11)
    at Object.kha_network_Session.update (/path to project/BlockArena/build/node/kha.js:15357:8)
    at Timeout.kha_SystemImpl.synch [as _onTimeout] (/path to project/BlockArena/build/node/kha.js:3277:29)
    at tryOnTimeout (timers.js:228:11)
    at Timer.listOnTimeout (timers.js:202:5)*

    I think that is because the server is not installed properly.
    My node version: 6.3.1
    npm version: 3.10.6
    and the kha version is from git.

    Before i found this demo, i have played a little bit with the node package 'ws'. Create sessions, store user-id und user-socket in a map send some bytes - nice and easy, but without the big features from the kha.network package (serialized objects, automatic synchronization, shared code between Client- and Server-App etc). Now I would never miss again these cool things.

    posted in Kode read more
  • W

    @webster said:

    remark to me;-)
    have a look at the painter* files in the debug-html5-resources folder, which should contain all the patterns that I need.

    now i think, i shoot a little bit to fast and to deep in the framework. The 'texture2D' is not defined in the painter-image.frag.essl file. Nevertheless, the files could be useful for me and my learning.

    posted in Kode read more
  • W

    remark to me;-)
    have a look at the painter* files in the debug-html5-resources folder, which should contain all the patterns that I need.

    posted in Kode read more
  • W

    Hallo Robert,
    that is a little bit strange to me, because in some cases the shader compiled this stuff. I want learn some of the cool stuff which can be done with fragment shaders. In the 'book of shaders' i found this example:
    I am surprised how the few lines create such a nice effect.
    Without the loop but with gl_FragColor and glFragCoord does this work. I use the html5 tag from khamake. But what is the best approach to avoid these errors, should i use only the in- and out-qualifier from the shader language.
    The frag.essl file in the debug-html5-resources folder show me this:
    #version 100
    // Unknown execution mode 8
    and no more comments about wrong instructions. But this comment is in every essl file by me regardless of whether the shader compiled or not.
    Another question, has kha a function for cropping a texture?

    posted in Kode read more
  • W

    is it right, that krafix can not compile this code:
    void kore() {
    // vec2 p = gl_FragCoord.xy / iResolution;
    vec3 col;
    // float col[3]; // alternative also not work
    float c = iGlobalTime;
    for(int i = 0; i < 3; i++) {
    c += 0.3;
    col[i] = fract(c);
    // gl_FragColor = vec4(col[0], col[1], col[2], 1.0);
    gl_FragColor = vec4(col, 1.0);
    I have tried this on windows 8.1 and linux and always get a black screen.

    posted in Kode read more
  • W

    Hallo, after I updated my system (Ubuntu 14.04.3 LTS - 64 bit) Kode Studio does not start properly. When I launch it from the console I get the following error message:
    bash: Kann die Prozessgruppe des Terminals nicht setzen (-1).: Unpassender IOCTL (I/O-Control) für das Gerät
    bash: Keine Job-Steuerung in dieser Shell.
    /home/roland/apps/kodestudio/kode --type=renderer --no-sandbox --lang=de --node-integration=true --enable-delegated-renderer --num-raster-threads=2 --gpu-rasterization-msaa-sample-count=8 --content-image-texture-target=3553 --video-image-texture-target=3553 --disable-accelerated-video-decode --channel=2812.1.504192727 --v8-natives-passed-by-fd --v8-snapshot-passed-by-fd: relocation error: /home/roland/apps/kodestudio/resources/app/node_modules/native-keymap/build/Release/keymapping.node: symbol _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE14_M_replace_auxEmmmc, version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
    Uncaught Exception: Error: read ECONNRESET
    Error: read ECONNRESET
    at exports._errnoException (util.js:837:11)
    at Pipe.onread (net.js:544:26)

    Sorry, don't know why i have always such silly problems.

    posted in Kode read more
  • W

    @Robert many thanks, that was as always very fast.

    posted in Kode read more
  • W

    hi, another Kode Studio based question: the README.md from this git-repo https://github.com/KTXSoftware/kha-examples.git contains a image where the editor contains a color pattern (different colors for types, keywords, strings). My silly question, how can i get this (view>command pallete>open user settings>?).

    There is certainly a way to create own macros, but I have no idea how to do it.
    But first, new colors would be very nice:-)
    Best regards

    posted in Kode read more
  • W

    hallo Robert
    many thanks for the fast reply. Now i understand the dependencies better. Kode Studio makes use from the system (Ubuntu 14.04.3 LTS) installation of kha with haxelib. The console-command works with my standalone version of kha.
    git submodule foreach --recursive git pull origin master
    This has solved the errors - very nice

    posted in Kode read more
  • W

    I'm very new to haxe and kha. Today i have found the Kode Studio and copy-paste some stuff from the 'Kha Shmup Tutorial'. In fact this was the first time that something (kha stuff) run on my laptop;-) unfortunately only from the Kode Studio with the green arrow.
    If I want to use the console , as described in the tutorial (~ ./khamake.sh html5
    ), I get the following error:
    Creating Kha project.
    Exporting asset 1 of 1 (Assets/playerShip.png).
    Assets done.
    Haxe stderr: /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:82: characters 34-60 : Class<kha.Shaders> has no field painter_image_frag
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:83: characters 32-58 : Class<kha.Shaders> has no field painter_image_vert
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:308: characters 34-62 : Class<kha.Shaders> has no field painter_colored_frag
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:309: characters 32-60 : Class<kha.Shaders> has no field painter_colored_vert
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:561: characters 34-59 : Class<kha.Shaders> has no field painter_text_frag
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:562: characters 32-57 : Class<kha.Shaders> has no field painter_text_vert
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:773: characters 33-59 : Class<kha.Shaders> has no field painter_video_frag
    /home/roland/Dokumente/KodeProjects/EmptyKhaTemplate/Kha/Sources/kha/graphics4/Graphics2.hx:774: characters 31-57 : Class<kha.Shaders> has no field painter_video_vert

    Haxe process exited with code 1

    In the studio, I get a strange warning but the app starts anyway:
    ›Warning: Can't find a page with url: file:////home/roland/Dokumente/KodeProjects/KhaShmup/build/debug-html5/index.html. Available pages: ["file:///home/roland/Dokumente/KodeProjects/KhaShmup/build/debug-html5/index.html"]

    Can anyone tell me what I have not yet understood.
    And sorry for my english, that is what google suggest.

    posted in Kode read more

Looks like your connection to Kode Forum was lost, please wait while we try to reconnect.