Forum Replies Created
-
AuthorPosts
-
I did write a websockets module for BMax, but as soon as I connect to.. well anything using Emscripten in M2 I receive the error “-1”
So I don’t even know where to begin.Modifying this I was able to confirm that it wasn’t just me, Emscripten really don’t support sockets.
I’ve always gotten error “-1” whatever that means, and it’s the same with this example.Very nice!
Good workI’d recommend hiding the hint as you hover the mouse over it; it’s currently blocking me from clicking the above line.
Wheel… not in a near future, I think. But I want to draw colored line under Color declaration to see each color right in the editor area.
I might be able to add a colour wheel later
I think a line might blend into the background colour too much, or confuse the user; making him think there’s an error if the line is red for example.Very nice!
I used this a lot back in Blide and Jungle, but had completely forgotten about it!Would it be possible to make a separate ‘hint’ for colours?
Like, say you’re typing ‘New Color()’ and as you enter inside the ‘()’ a colour wheel pops up and you can preview the colour.
Possibly even set the colour from the colour wheel.Now we need it in real time
My example above is real-time
You must have copied the shader incorrectly, cause it’s the exact same shader as nr 7. which you got an error on (that error is btw fixed by writing ‘1.0 -‘ instead of just ‘1 -‘, fixed in my version), but mine has two name changes.
Make sure you get the first line copied which defines the renderpasses.And as I said, all you have to do is replace the ‘sharp’ and ‘blur’ texture with ‘m_ImageTexture0’ and pass the image to a canvas (so that the canvas draws to the image), then there’s no need to pass a texture to the shader, M2 does that for you.
So if you really can’t get my example working, do ^ those things.
Those sites are pure poison, stay away from those.
Alright, I made a red square just moving about on the screen using the “updated” shader.
It’s real ugly, but as a proof of conceptHere’s the shader using m_ImageTexture0 for ‘blur’ and ‘sharp’ texture:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758//@renderpasses 0,1,2varying vec2 v_TexCoord0;varying vec4 v_Color;//@vertexattribute vec4 a_Position;attribute vec2 a_TexCoord0;attribute vec4 a_Color;uniform mat4 r_ModelViewProjectionMatrix;uniform vec4 m_ImageColor;void main(){v_TexCoord0 = a_TexCoord0;v_Color = m_ImageColor * a_Color;gl_Position=r_ModelViewProjectionMatrix * a_Position;}//@fragmentuniform sampler2D m_ImageTexture0;uniform sampler2D m_Scanlines;uniform sampler2D m_Shadowmask;uniform vec2 m_Resolution;uniform float m_ColorBleed;uniform float m_GlowSize;uniform float m_GlowGain;uniform float m_ScanlineIntensity;uniform float m_ShadowMaskIntensity;void main(){//Scanline texture, mixed with white for fadingvec4 scanColor = mix( vec4(1.0, 1.0, 1.0, 1.0), texture2D( m_Scanlines, v_TexCoord0 * m_Resolution ), m_ScanlineIntensity );vec4 maskColor = mix( vec4(1.0, 1.0, 1.0, 1.0), texture2D( m_Shadowmask, v_TexCoord0 * m_Resolution ), m_ShadowMaskIntensity );//blur offset distancevec2 blurOffset = vec2( m_GlowSize / m_Resolution.x, m_GlowSize / m_Resolution.y );//blur in four directions based on offsetvec2 leftCoord = vec2( v_TexCoord0.x - blurOffset.x, v_TexCoord0.y );vec2 rightCoord = vec2( v_TexCoord0.x + blurOffset.x, v_TexCoord0.y );vec2 topCoord = vec2( v_TexCoord0.x, v_TexCoord0.y + blurOffset.y );vec2 bottomCoord = vec2( v_TexCoord0.x, v_TexCoord0.y - blurOffset.y );//blur colors are mixed for final glow color using BlurTexturevec4 glowX = mix( texture2D( m_ImageTexture0,rightCoord ), texture2D( m_ImageTexture0,leftCoord ), 0.5 );vec4 glowY = mix( texture2D( m_ImageTexture0,topCoord ), texture2D( m_ImageTexture0,bottomCoord ), 0.5 );vec4 glow = mix( glowX, glowY, 0.5 );//final color mixingvec4 color = texture2D( m_ImageTexture0,v_TexCoord0 );vec4 colorWithBleed = mix( max( color, glow ), color, 1.0 - m_ColorBleed );vec4 colorWithGlow = colorWithBleed + ( glow * m_GlowGain );gl_FragColor= ( colorWithGlow * v_Color ) * scanColor * maskColor;}And I massacred your M2 example as well heh:
Monkey12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576#Import "<std>"#Import "<mojo>"#Import "<mojo3d>"#Import "shaders/test07_CRT.glsl"#Import "images/"Using std..Using mojo..'A CRT shader"Class MyWindow Extends WindowField img :ImageField imgClean :ImageField crtCanvas :CanvasField scale :Vec2fField zoom := 8.0Method New()Super.New( "Shader test",1280,720,WindowFlags.Resizable )ClearColor = Color.BlackLocal tex := Texture.Load( "asset::frame.png", TextureFlags.None )Local texBlur := Texture.Load( "asset::frame.png", TextureFlags.FilterMipmap )Local texScan := Texture.Load( "asset::scanline16px.png", TextureFlags.FilterMipmap | TextureFlags.WrapST )Local texMask := Texture.Load( "asset::shadowMask16px.png", TextureFlags.FilterMipmap | TextureFlags.WrapST )Local testShader := New Shader( "test07", LoadString("asset::test07_CRT.glsl"), "" )img = New Image( tex.Width * zoom, tex.Height * zoom,, testShader )'img.Handle = New Vec2f( 0.5 )crtCanvas = New Canvas( img )scale = New Vec2f( img.Width/tex.Width, img.Height/tex.Height )'img.Material.SetTexture( "SharpTexture", tex )'img.Material.SetTexture( "BlurTexture", texBlur )img.Material.SetTexture( "Scanlines", texScan )img.Material.SetTexture( "Shadowmask", texMask )img.Material.SetVec2f( "Resolution", New Vec2f( tex.Width, tex.Height ) )img.Material.SetFloat( "ColorBleed", 1.1 )img.Material.SetFloat( "GlowGain", 0.15 )img.Material.SetFloat( "GlowSize", 0.5 )img.Material.SetFloat( "ScanlineIntensity", 0.25 )img.Material.SetFloat( "ShadowMaskIntensity", 0.25 )imgClean = New Image( tex )imgClean.Handle = New Vec2f( 0.5 )EndMethod OnRender( canvas:Canvas ) OverrideApp.RequestRender()crtCanvas.Clear(Color.Black)crtCanvas.Color=Color.RedcrtCanvas.DrawRect(64+Sin(Millisecs()*0.01)*32, 64+Sin(Millisecs()*0.005)*64,64,64)crtCanvas.Flush()'canvas.DrawImage( imgClean, Width*.15, Height/2, 0, 2, 2 )', 0, scale.X, scale.Y )canvas.DrawImage( img, 0, 0 )canvas.DrawText( App.FPS, 5, 5 )EndEndFunction Main()New AppInstanceNew MyWindowApp.Run()EndMonkey1uniform sampler2D m_ImageTexture0;I can give it a try without changing your code too much…
I’m no expert on this subject, but couldn’t you just make a fullscreen shader?
I have this outline shader that I just apply to the canvas itselfGood info Mark!
You say Stream will work everywhere, will LoadString also work everywhere?
This kind of stuff should be in the Docs
What kind of situations you’d use the class in, what platforms it supports.
And also why you’d want to use one thing over the other if there a other similar things (like FileStream & Stream)FileStream.Open has been acting weird for me too.
It seems it doesn’t accept “asset::”So what you can do is just:
MyHandle = FileStream.Open ( AssetsDir()+“Galaxy.txt”, “r” )OR possibly just use Stream instead:
MyHandle:Stream = Stream.Open( “asset::Galaxy.txt”, “r” )OR use LoadString for simple text stuff:
LoadString( “asset::Galaxy.txt” )Got some help with the fullscreen shader and it’s working pretty well.

I’ve made a minor change to the theme ‘Hollow’ (json only)
Made the menu separators easier to see.
http://hezkore.com/captures/theme-hollow.zipFeel free to add it if you want.
Oh and I still think there should be a “Please restart Ted2Go” alert message when switching theme.
Going between some image heavy themes sometimes has some really odd results.Like the tabs and checkboxes being wrong in the theme ‘Smooth’:

Getting some good results using a fullscreen shader.
Proper sharp edges too!But I’ll look into the other suggestions
-
AuthorPosts