What I did today

Java Audio magic
not sure if i do it right - but:)
its looks strange - but looks work right ^^

How flush Data XD


SourceDataLine Data_Out

Data_Out.stop();

synchronized(SSSS){//synchronized On - prevent Write Line dif Thread
    Data_Out.flush();
    Data_Out.start();
    Data_Out.stop();
}//synchronized off

You can’t flush data when line Playng (sound distorsion)
But you also can’t flush stoped line XD
Because to take effect you need start it agane ^^
lol

up: Hm… - number smiles per lines 6 / 9 :slight_smile:

I realized I didn’t have a personal website up anymore since I switched hosts. While messing around with my wessles.com domain, I realized that my address was in the whois database for all to see. I figured this was a good opportunity to get around to buying a new domain and making a “studio” name, as opposed to me using my full name everywhere. I deleted the old domain, and bought systemvoidgames.com. I made the website itself today; I’d say it turned out pretty well :).

-wes

Hm… still have mini distortion :frowning:
But i think find new way
if set Line volume to 0
and play sample to end
it will be same like flush line for Listener =)

Anyone have better solution or something same?

Sure for complex systems…like continuations, fibers or actor frameworks as examples. Use a DSL or some bytecode weaving (hopefully written by someone else) to do the lifting for you. That only covers part of the problem space. Otherwise you’re doing 10x the effort to be 2x efficient.

I know. I’m woefully old-school. We have this quaint notion that code structure should reflect code behavior and not the currently fashionable notions of form, meter and prose. Blame it on a lack of humanity courses. So our code ends up looking like cookbook recipes instead of “flowing off the tongue” in a pleasing manner.

I went back to my lighting demo stuff and completely redid how i calculated light. Now lights are much more versatile and just all around better:

Edit: these lights are still shaderless btw. The new algorthim is basically the combination of the old one plus another one maybe I’ll explain it later

New features:

  • better light ranges
  • better shadows
  • colors mxing is still very intact and pretty cool

[quote=“kingroka123,post:3005,topic:49634”]
Cool it’s looking good man. :slight_smile: Also I noticed the very top beam seems to be getting condensed at the top of the image, as if it’s reflecting off of something - intended?

that is just how the light went through that crack. It wasnt intended but that just gave me a fascinating idea :smiley:

Whatever you think about Apple. Still total risk takers. They’re pushing for total vertical integration: http://adriansampson.net/blog/appleisa.html

Found a new way to use generics in Java for solving a problem with WebGL, having a function return data in different types depending on a parameter name. This is possible in JS with duck typing, but generics allowed that in Java too with Java 7.

For example: This is the code I wrote using generics for the glGetParameter() method in WebGL10 class. This does convert the objects into integers as they are represented as integers in desktop OpenGL (chosen to look like LWJGL classes since it makes it easy for me to port to WebGL in the end).


@SuppressWarnings("unchecked")
public static <T> T glGetParameter(int pname)
{
    checkContextCompatibility();
    T result = nglGetParameter(pname);

    switch (pname)
    {
        case GL_ARRAY_BUFFER_BINDING:
        case GL_ELEMENT_ARRAY_BUFFER_BINDING:
            return (T) (Integer) WebGLObjectMap.get().createBuffer((JavaScriptObject) result);

        case GL_CURRENT_PROGRAM:
            return (T) (Integer) WebGLObjectMap.get().createProgram((JavaScriptObject) result);

        case GL_FRAMEBUFFER_BINDING:
            return (T) (Integer) WebGLObjectMap.get().createFramebuffer((JavaScriptObject) result);

        case GL_RENDERBUFFER_BINDING:
            return (T) (Integer) WebGLObjectMap.get().createRenderBuffer((JavaScriptObject) result);

        case GL_TEXTURE_BINDING_2D:
        case GL_TEXTURE_BINDING_CUBE_MAP:
            return (T) (Integer) WebGLObjectMap.get().createTexture((JavaScriptObject) result);
    }

    return result;
}

The above allows one to use it to take multiple parameters, as like in this example.


int          texture    = glGetParameter(GL_TEXTURE_BINDING_2D);
boolean      blending   = glGetParameter(GL_BLEND);
Float32Array blendColor = glGetParameter(GL_BLEND_COLOR);

This is similar to how people use WebGL from the native JavaScript too, where the var keyword is used instead of the return types. Interested, I thought how this will be output in JS by the GWT compiler. This is the version without optimisations in SuperDev mode.


function glGetParameter_0_g$(pname_0_g$){
  $clinit_WebGL10_0_g$();
  var result_0_g$;
  checkContextCompatibility_0_g$();
  result_0_g$ = nglGetParameter_0_g$(pname_0_g$);
  switch (pname_0_g$) {
    case 34964:
    case 34965:
      return dynamicCastAllowJso_0_g$(dynamicCast_0_g$(valueOf_60_g$(get_40_g$().createBuffer_1_g$(dynamicCastJso_0_g$(result_0_g$))), 1480), 1);
    case 35725:
      return dynamicCastAllowJso_0_g$(dynamicCast_0_g$(valueOf_60_g$(get_40_g$().createProgram_1_g$(dynamicCastJso_0_g$(result_0_g$))), 1480), 1);
    case 36006:
      return dynamicCastAllowJso_0_g$(dynamicCast_0_g$(valueOf_60_g$(get_40_g$().createFramebuffer_1_g$(dynamicCastJso_0_g$(result_0_g$))), 1480), 1);
    case 36007:
      return dynamicCastAllowJso_0_g$(dynamicCast_0_g$(valueOf_60_g$(get_40_g$().createRenderBuffer_1_g$(dynamicCastJso_0_g$(result_0_g$))), 1480), 1);
    case 32873:
    case 34068:
      return dynamicCastAllowJso_0_g$(dynamicCast_0_g$(valueOf_60_g$(get_40_g$().createTexture_1_g$(dynamicCastJso_0_g$(result_0_g$))), 1480), 1);
  }
  return result_0_g$;
}

It is almost the same, but the call to nglGetParameter, a method that is written using JSNI is still not inlined. So I thought verifying the optimised output of the method and setting the compile style to pretty for this input:


int result = glGetParameter(GL_TEXTURE_BINDING_2D);
GWT.log("" + result);

It inlined the code perfectly, even from the parameter it judged what type I was trying to create and inlined the casts as well, producing the following version:


checkContextCompatibility();
result = $wnd.gl.getParameter(32873);
valueOf($createTexture(get_2(), dynamicCastJso(result)));

The piece where $wnd.gl.getParameter is actually part of nglGetParameter method which is the JSNI method, and it got inlined into the glGetParameter method, which itself is inlined into the onModuleLoad method which is the entry point. This is extremely good, I was initially worried about the overhead my library introduces, but it turned out that there is no overhead actually!

It started with the question on how to write the Java function for the IDL [icode]any getParameter(GLenum pname)[/icode] that made me look into generics, and took me to verify the contents of the generated JS by the compiler. Learnt this today.

Wow, I didn’t even know they had their own microarchitecture! That’s incredible…

http://www.anandtech.com/show/7910/apples-cyclone-microarchitecture-detailed

Ha ha, HA Ha…ha ha ha. Rediscovered Java’s rules for converting a float into an integer. [icode] i = (int)f; [/icode] I wondered why some of my code with littered with tests & branches.

Wot’s so funny about the rules?

Cas :slight_smile:

Nothing…other than I forgot them. Notably if ‘f’ is too big to fit the result is the largest int. Intel hardware doesn’t do that with their opcode so the JVM has to compare to be able to do the fix-up in hedge cases. I forgot the rule and was driving myself nuts trying to figure out what was causing the compares & branches.

Arrgh, seriously? So every time I’m casting to an int the JVM can’t use an intrinsic and has to branch???

Cas :slight_smile:

Not really today… yesterday I biked 100 miles/160 km with some friends! Longest bike ride of my life but I enjoyed it.

Nice. avg speed?

Yeap. That’s why I was having one of those “Somebody just poked me in the eye with a sharp stick” moment.

0x00000000029cc0f3: cvttss2si r11d,xmm2 ; this is the cast to int 0x00000000029cc0f8: cmp r11d,0x80000000 ; compare against the value returned for overflow 0x00000000029cc0ff: jne L0000 ; continue normally - this sucks if this is cold...prediction will guess fall-through..wrong! 0x00000000029cc101: sub rsp,0x8 ; from here to the label is do it the hard way via some function 0x00000000029cc105: movss dword ptr 0x00000000029cc10a: call 0x00000000029cc10f: pop r11 L0000: ; code past the cast

I was naively expecting the one opcode.

I don’t think Java has a trunc method so how do we get around this? BigDecimal might work, I think you can set the scale to zero, but that doesn’t seem like the right way to handle it.

The average was 12.5-15 mph/20-24 km/h, but on the flat stretches I was going upwards of 18-19 mph/30 km/h!