• W
    webster

    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:

    or:
    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
    webster

    Hello,

    with my new laptop the kore taget give me this error:
    ./101_shaderPlaygroundUI
    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
    webster

    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)
    compile:
    node <path to kore>/make.js --compile
    maybe:
    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
    webster

    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
    webster

    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.

    [screenshoot]
    (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;
        pipeline.compile();
    
        // 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]);
        }
        vertexBuffer.unlock();
    
        // 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];
        }
        indexBuffer.unlock();
    
        width = System.windowWidth();
        height = System.windowHeight();
        lastTime = 0;
        Scheduler.addTimeTask(update, 0, 1 / 60);
        System.notifyOnRender(render);
    }
    
    public function new() {
        Assets.loadEverything(loadingFinish);
    }
    
    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.begin();
        g.clear(Color.fromFloats(0.05, 0.0, 0.15), 1.0);
        g.setVertexBuffer(vertexBuffer);
        g.setIndexBuffer(indexBuffer);
        g.setPipeline(pipeline);
        g.setMatrix(mvpID, mvp);
        g.drawIndexedVertices();
        g.end();
    
        var g2 = framebuffer.g2; // g2.begin(false);
        ui.begin(g2);
        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
    webster

    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
    webster

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

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

    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
    webster

    hello,

    i try something like this:

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

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

    p.s.
    Slider work with negativ values:-)

    posted in Kode read more
  • W
    webster

    Hello,
    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
    webster

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

    posted in Kode read more

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