java - Libgdx gl10.glLineWidth() -
i have line: gdx.gl10.gllinewidth(width); now, intend draw pretty thick line, and, unfortunately when type in small values 1 or 5 line small. once surpass soemthing 10, no longer gets larger. passing in direct values in these instances, , so, under impression gl has limit or something.... correct? here's code:
gdx.gl.glclearcolor(0,0,0,1); gdx.gl.glclear(gl10.gl_color_buffer_bit); batch.setprojectionmatrix(cam.combined); batch.begin(); batch.draw(bg,0,0,width,height); for(spell : spells){ a.draw(batch); } lc.draw(batch); batch.end(); //((ppux+ppuy)/2f)*4 gdx.gl10.gllinewidth(50);//average , 1/4 unit) renderer.setprojectionmatrix(cam.combined); renderer.begin(shapetype.line); lp.drawlines(renderer); renderer.end(); batch.begin(); lp.draw(batch); batch.end(); lp.drawlines(renderer) calls following(i call set color, , draw line):
renderer.setcolor(1,1,1,1); elem = elems.get(spellcombo.get(0)); vector2 last = new vector2(a.x(),a.y()); for(int = 1; < spellcombo.size(); i++){ = elems.get(spellcombo.get(i)); vector2 cur = new vector2(a.x(),a.y()); renderer.line(last.x, last.y, cur.x, cur.y); last = cur; } renderer.line(last.x,last.y,mx,my); gdx.gl.glenable(gl10.gl_blend); gdx.gl.glblendfunc(gl10.gl_src_alpha, gl10.gl_one_minus_src_alpha); renderer.setcolor(1, 0, 0, .2f); for(elem e : elems){ int id = elems.indexof(e); if(combomanager.validspell(spellcombo,id)) renderer.line(last.x,last.y,e.x(),e.y()); } screenshots:
image gllinewidth() set 1
image gllinewidth() set 5
image gllinewidth() set 10
image gllinewidth() set 20
image gllinewidth() set 200 
i don't know how fix, , google wasn't particularily helpfull. thanks!
in libgdx gdx.gl10 object wrapper opengl 1.x api. so, calls there (basically) calls opengl es (on android) or regular opengl (on desktop). java layer makes changes api, pretty straightforward mapping. (on desktop, libgdx tries emulate es variant api presented contains es-relevant apis.)
the line-drawing support in opengl es 1 place es changes regular opengl. both have limitations on supported line width, though in regular opengl limitations seem apply anti-aliased lines.
regular opengl
http://www.opengl.org/sdk/docs/man/xhtml/gllinewidth.xml
there range of supported line widths. width 1 guaranteed supported; others depend on implementation. query range of supported widths, call glget argument gl_aliased_line_width_range.
opengl es
http://www.khronos.org/opengles/sdk/docs/man/xhtml/gllinewidth.xml
there range of supported line widths. width 1 guaranteed supported; others depend on implementation. query range of supported widths, call glget argument gl_aliased_line_width_range.
to query limits in libgdx, use this:
int[] results = new int[1]; gdx.gl10.glgetintegerv(gl20.gl_aliased_line_width_range, results, 0); the upshot of of though, because line drawing (other width 1.0) on opengl es has different run-time limitations on different platforms, should use different scheme (like rectangles) draw fat lines.
Comments
Post a Comment