Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLineWidth not working on WebGL #994

Closed
customautosys opened this issue May 11, 2020 · 3 comments
Closed

setLineWidth not working on WebGL #994

customautosys opened this issue May 11, 2020 · 3 comments

Comments

@customautosys
Copy link
Contributor

Code below. Not working in both 7.1.1 & 8

<html>
<head>
	<title>MelonJS setLineWidth not working in WebGL</title>
	<script src="melonjs.js"></script>
	<script>
		let menu=me.Stage.extend({
			init:function(){
				this._super(me.Stage,'init');
			},
			onResetEvent:function(){
				let entity=me.Renderable.extend({
					init:function(){
						let width=me.game.viewport.getWidth();
						let height=me.game.viewport.getHeight();
						this._super(me.Renderable,'init',[0,0,width,height]);
						this.floating=true;
					},
					update:function(dt){
						this._super(me.Renderable,'update',[dt]);
						return true;
					},
					draw:function(renderer){
						renderer.setColor(new me.Color(255,255,0,1));
						renderer.setLineWidth(10);
						let bounds=this.getBounds();
						renderer.strokeLine(bounds.left,bounds.top,bounds.width,bounds.height);
					}
				});
				me.game.world.addChild(new entity());
			}
		});
		me.device.onReady(function(){
			me.video.init(document.body.clientWidth,document.body.clientHeight,{
				wrapper:'screen',
				scale:'auto',
				scaleMethod:'flex',
				renderer:me.video.WEBGL
			});
			me.loader.preload([],function(){
				me.state.set(me.state.MENU,new menu());
				me.state.change(me.state.MENU);
			});
		});
	</script>
	<style>
		#screen{
			position:absolute;
			left:0;
			top:0;
			width:100%;
			height:100%;
		}
	</style>
</head>
<body>
<div id="screen"></div>
</div>
</body>
</html>
@obiot
Copy link
Member

obiot commented May 23, 2020

indeed a limitation for now on WebGL, thanks

@obiot
Copy link
Member

obiot commented May 24, 2020

just to be precise on this one, there is some lineWidth implementation on the WebGL renderer but that relies on the lineWidth method, for which the OpenGL specs says The maximum line width supported must be at least one., which means that there is no guarantee this is supported on all platforms & GPU.

@obiot
Copy link
Member

obiot commented Jul 11, 2020

Closing this one as included in #999

@obiot obiot closed this as completed Jul 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants