Dear Cerberus X User!
As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.
Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.
Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!
Accepting ensures:
- Continued access to your account with a short break for the actual transfer.
- Retention of your data under the same terms.
Without consent:
- You don't have further access to your forum user account.
- Your account and personal data will be deleted after April 5, 2024.
- Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.
We hope to keep you in our community and see you on the forum soon!
All the best
Your Cerberus X Team
Very interesting to read and I am curious about the outcome.
gl_FragColor = v_color0 * texture2D(s_texColor, v_texcoord0);
Local defs:=""
defs+="#define NUM_LIGHTS "+numLights+"~n"
Local vshader:=glCompile( GL_VERTEX_SHADER,defs+_vsource )
Local fshader:=glCompile( GL_FRAGMENT_SHADER,defs+_fsource)
Function glCompile:Int( type:Int,source:String )
#If TARGET<>"glfw" Or GLFW_USE_ANGLE_GLES20
source="precision mediump float;~n"+source
#Endif
Local shader:=glCreateShader( type )
glShaderSource shader,source
glCompileShader shader
glGetShaderiv shader,GL_COMPILE_STATUS,tmpi
If Not tmpi[0]
Print "Failed to compile fragment shader:"+glGetShaderInfoLog( shader )
Local lines:=source.Split( "~n" )
For Local i:=0 Until lines.Length
Print (i+1)+":~t"+lines[i]
Next
Error "Compile fragment shader failed"
Endif
Return shader
End
D3D9 and D3D11 shaders can be only compiled on Windows.
bgfxMakeRef( rs_vboMem, _data, offset, size )
bgfxUpdateDynamicVertexBuffer( rs_vbo, 0, rs_vboMem )
bgfxMakeRef( rs_vboMem[vboIndex], _data, offset, size )
bgfxUpdateDynamicVertexBuffer( rs_vbo[vboIndex], 0, rs_vboMem[vboIndex] )
So bfgx doesn't have multiple render targets?
SetScissor(0, 0, 320, 240)
DrawCircle(320, 240, 50)
SetScissor(320, 0, 320, 240)
DrawCircle(480, 240, 50)
SetScissor(320, 240, 320, 240)
DrawCircle(320, 320, 50)
' the first argument of each function is view id
SetScissor(0, 0, 0, 320, 240)
DrawCircle(0, 320, 240, 50)
SetScissor(1, 320, 0, 320, 240)
DrawCircle(1, 480, 240, 50)
SetScissor(2, 320, 240, 320, 240)
DrawCircle(2, 320, 320, 50)
Bummer Maybe it is better to create a new framework then ( Hades hint hint ). This way it would not be constraint by the mojo way of coding.I don't think I can get Mojo 2 working with bgfx. What do you guys want to do?
DrawCircle(100, 100, 50)
DrawRect(200, 200, 300, 80)
Field canvas:Canvas = New Canvas()
...
canvas.DrawCircle(100, 100, 50)
canvas.DrawRect(200, 200, 300, 80)
Function SetScissors:Void( viewId:Int, x:Int, y:Int, width:Int, height:Int )
Function DrawCircle:Void( viewId:Int, x:Int, y:Int, radius:Int )
Function DrawRect:Void( viewId:Int, x:Int, y:Int, width:Int, height:Int )
SetScissors( 0, 0, 0, 320, 240 )
DrawCircle( 0, 100, 100, 50 )
DrawRect( 0, 200, 100, 200, 200 )
SetScissors( 1, 320, 0, 320, 240 )
DrawCircle( 1, 480, 100, 50 )
DrawRect( 1, 480, 200, 200, 200 )
GetNextViewId()
SetScissors( 0, 0, 320, 240 )
DrawCircle( 100, 100, 50 )
DrawRect( 200, 100, 200, 200 )
GetNextViewId()
SetScissors( 320, 0, 320, 240 )
DrawCircle( 480, 100, 50 )
DrawRect( 480, 200, 200, 200 )
I prefer Mojo 1 myself, more straight forward. What does other prefer?
'generate color texture
Local colortex:=New Texture( 256,256,4,Texture.ClampST|Texture.RenderTarget )
Local rcanvas:=New Canvas( colortex )
rcanvas.Clear( 1,1,1 )
rcanvas.Flush
'generate normal texture
Local normtex:=New Texture( 256,256,4,Texture.ClampST|Texture.RenderTarget )
rcanvas.SetRenderTarget( normtex )
rcanvas.Clear( .5,.5,1.0,0.0 )
For Local x:=0 Until 256 'Step 32
For Local y:=0 Until 256 'Step 32
Local dx:=x-127.5
Local dy:=y-127.5
Local dz:=127.5*127.5-dx*dx-dy*dy
If dz<=0 Continue
dz=Sqrt( dz )
Local r:=(dx+127.5)/255.0
Local g:=(dy+127.5)/-255.0
Local b:=(dz+127.5)/255.0
rcanvas.SetColor( r,g,b,1 )
rcanvas.DrawPoint( x,y )
Next
Next
rcanvas.Flush
bgfxSetViewFrameBuffer( 0, colortex )
' draw the color texture
...
bgfxSetViewFrameBuffer( 0, normtex )
' draw the normal texture
bgfxSetViewFrameBuffer( 0, colortex )
' draw the color texture
...
bgfxSetViewFrameBuffer( 1, normtex )
' draw the normal texture
Me too. Maybe having it only mojo1 compatible is enough, even if it isn't 100%.
@Ferdi ... and only chiming in here to maybe help you see something you might have overlooked.