PlayN community wiki

107 views
Skip to first unread message

Daniel Gerson

unread,
Aug 14, 2013, 5:06:44 AM8/14/13
to pl...@googlegroups.com
Hi guys.
I've create a PlayN community wiki using Github's Gollum based wiki system, here:

https://github.com/dmg46664/playn/wiki

At the moment it consists of the following two articles, which I've been slowly fleshing out:

and then a bunch of categorized links.

I think a community wiki needs to have a web-frontend which Google code doesn't provide, otherwise the barrier to edit is too high. Security is provided by github user authentication and revision history, but aside from that anyone can write/edit/create pages.

I make no guarantees about the quality of the information which has rough edges, but I think the wiki model has shown that this is the way to go.

DMG


David Jurgens

unread,
Aug 14, 2013, 6:07:02 AM8/14/13
to pl...@googlegroups.com
Thanks!  This will be a huge help I'm sure.  I'll dig through my code and see if there's anything I have worth documenting right now. :)

Evgeni Gordejev

unread,
Aug 14, 2013, 11:22:09 AM8/14/13
to pl...@googlegroups.com
Great job Daniel

Антон Сорока

unread,
Aug 15, 2013, 9:06:01 AM8/15/13
to pl...@googlegroups.com
I've read your post. It is great, if I've found it several days before it could save a lot of time for me....but never the less, I've got some question, that you've omit in your post :
probably could write a bit more about the attribute bindings - this is exactly what I need...
 I want to organize gl gradient... I've extended from QuadShader , override createColorExtras method to provide possibility manage color...also override vertexShader() method (add attribute : "attribute vec4 aVertexColor;" and swipe "v_Color = vec4(red / 255.0, green / 255.0, blue / 255.0, alpha / 255.0);" to ""v_Color = aVertexColor;\n" ). In the constructor of my ColorExtras, I've added next rows : 

            this.aVertexColor = prog.getAttrib("aVertexColor", 4, GL20.GL_FLOAT);
   this.color = LinerGradient.this.ctx.createFloatBuffer(4 * 4);

 Also I've override prepare and willFlsuh methdos :
        @Override
public void prepare(int tex, boolean justActivated) {
   float[] colors = {
   1.0f, 0.0f, 0.0f, 1.0f,
   0.0f, 0.0f, 1.0f, 1.0f,
   0.0f, 0.0f, 1.0f, 1.0f, 
   1.0f, 0.0f, 0.0f, 1.0f
   };
   if(this.color.position()!=0){
this.color.expand(colors.length);
   }
   this.color.add(colors, this.color.position(), colors.length);
   // ANTS_TAG : something very, very strange appear here!!!
   this.color.bind(GL20.GL_ARRAY_BUFFER);
   this.aVertexColor.bind(4, 0);
}

@Override
public void willFlush() {
   PlayN.log().warn("GradientExtras::willFlush");
   this.color.bind(GL20.GL_ARRAY_BUFFER);
   this.color.send(GL20.GL_ARRAY_BUFFER, GL20.GL_STATIC_DRAW);
}


 I've created SurfaceLayer and setting my shader to render surface based on it...
 I couldn't proper define semantics of binding exactly attribute variable (I can easy manager uniform, but not attribute ).....My source code has been changed several times, but I am still haven't clear vision of attribute binding.... As you've realized I want to add color attribute (vec4 as argb) to each vertices. I've done this in proper openGL, but...this binding not so clean for me... I will be very glad to hear any advice from your...

Daniel Gerson

unread,
Aug 15, 2013, 10:08:56 AM8/15/13
to pl...@googlegroups.com
Okay, so the color/texture extras I assume is supposed to be used within the PlayN lifecycle (having various layers that share a GLShader but have different extras configured). I bypassed all of that and have my signficant GLShader immediateLayer find its own inputs which it iterates over (with small amounts of feedback), etc. Essentially one long .flush() method.

No matter. Shouldn't matter at what points you configure your bindings/buffers.

Your line 

// ANTS_TAG : something very, very strange appear here!!!
this.color.bind(GL20.GL_ARRAY_BUFFER);
this.aVertexColor.bind(4, 0); // <---------- THE FIRST ARGUMENT SHOULD BE STRIDE


The Stride argument as I understand it should be the total amount of bytes used by the shader on a particular iteration, that may potentially be broken down into separate attributes.

Not sure I completely understand what you want to be achieving, but at the very least you are expecting a vec4 in your shader. That's 4 floats x 4 bytes per float, which should be a stride of 16 by my calculation.

However, I might be completely off base. Best to create a github repo demo'ing your problem, then it's easy to compile/check & verify.

Just my two cents. I used opengl 1.x many moons ago, and I fully intend to only know enough about ES2.0 to get the job done, and fix things only when it's clear to gain significant advantage. Part of the reason I don't think I created an attributes section, because it one has to create a rather specific example. When you get your example up and running, we'd appreciate you fleshing that section of the documentation out. :-)

DMG

Антон Сорока

unread,
Aug 15, 2013, 10:45:57 AM8/15/13
to pl...@googlegroups.com
Now I understand why, when I setting up 16 here, I've got liner gradient :), but I should also to drill deeper , because currently, my shader draws just last rectangle... :)
 I am wondering , why we should set stride as argument to bind method, because I thought I had settled when created Attrib variable...

Daniel Gerson

unread,
Aug 15, 2013, 11:27:37 AM8/15/13
to pl...@googlegroups.com


On Thursday, August 15, 2013 4:45:57 PM UTC+2, Антон Сорока wrote:
Now I understand why, when I setting up 16 here, I've got liner gradient :), but I should also to drill deeper , because currently, my shader draws just last rectangle... :)
 I am wondering , why we should set stride as argument to bind method, because I thought I had settled when created Attrib variable...


Answered on the wiki. 

Next time, it's better to start a new thread in the forum for new questions. :-)

DMG

Daniel Gerson

unread,
Aug 15, 2013, 2:56:25 PM8/15/13
to pl...@googlegroups.com


Next time, it's better to start a new thread in the forum for new questions. :-)

DMG

Just to add (in case you thought me arbitrary)... if we start questions in new threads with good thread descriptions, they will be easier in the future for people to find when searching for similar issues.

:-)
Reply all
Reply to author
Forward
0 new messages