PB 6.00 - Shader documentation

Everything related to 3D programming
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 275
Joined: Thu Jul 09, 2015 9:07 am

PB 6.00 - Shader documentation

Post by pf shadoko »

The documentation concerning the new 3D functions was not finished at the time of the translation of the doc, it contains errors and gaps
here is an update of the documentation about the shader + description of the predefined shader
I will give some examples of use later

___________________________________________________________________________________________
- CreateShader

enumeration of predefined shaders has no place here but in CreateShaderMaterial

note:
Shaders usually need to receive parameters to work:
2 functions allow to pass these parameters:
- MaterialShaderAutoParameter (automatic parameter)
- MaterialShaderParameter (shader parameter)

PureBasic also allows to set these parameters directly in the shader programs by adding at the end of the 'uniform' declaration line: "//" followed by either:
- the auto parameter number preceded by a "+" (cf. 'ParameterType' constants of the MaterialShaderAutoParameter function)
note: I will provide later a shader editor to simplify the assignment of these numbers
- one or more values (separated by a space) corresponding to the shader parameter (MaterialShaderParameter)

example:
uniform vec4 camera_pos;//+76 <- automatic parameter #PB_Shader_CameraPosition
uniform vec4 fog_params;//+31 <- automatic parameter #PB_Shader_FogParams
uniform vec3 speed;//0.5 1 0 <- shader parameter 'speed'
uniform sampler2D diffuseMap;//1 <- shader parameter texture number


___________________________________________________________________________________________
- MaterialShaderAutoParameter

description :
the automatic parameters correspond to the parameters of the 3D engine (positions of the camera, lights, color of the material, fog...)
this function allows to make the link between the 'uniform' variable of the shader and these parameters

example:
MaterialShaderAutoParameter(#Material, #PB_Shader_Fragment, #PB_Shader_CameraPosition, "camerapos", 0)

list of automatic parameters:
https://www.ogre3d.org/docs/manual18/ma ... d_005fauto

____________________________________________________________________________________________
- MaterialShaderParameter

description :
this function allows to set specific parameters to the shader

example:
MaterialShaderParameter(#Material, #PB_Shader_Fragment, "bumpy", #PB_Shader_Float, 0.5,0,0,0)

____________________________________________________________________________________________
CreateShaderMaterial

the ShaderID field must contain either
- the ID of a shader previously created with CreateShader
- the ID of a predefined shader:
#PB_Material_ColorShader
#PB_Material_PerpixelShader
#PB_Material_BumpShader
#PB_Material_SkyShader
#PB_Material_WaterShader
#PB_Material_WaterShaderRTT
#PB_Material_OceanShader
#PB_Material_PointSpriteSphereShader
#PB_MaterialShader_CubicEnvShader <- new
#PB_MaterialShader_CubicEnvBumpShader <- new

___________________________________________________________________________________________
___________________________________________________________________________________________


description of the predefined shaders:
___________________________________________________________________________________________
#PB_Material_ColorShader

Effect: uniform color in 'perpixel'.

texture(s) : none

MaterialShaderParameter : none

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- MaterialShininess(#Material, Shininess , SpecularColor)
- AmbiantColor
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

___________________________________________________________________________________________
#PB_Material_PerpixelShader

Effect: material in 'perpixel'

texture(s) :
- 0: sampler2D color

MaterialShaderParameter : none

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- MaterialShininess(#Material, Shininess , SpecularColor)
- LightAttenuation
- AmbiantColor
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

___________________________________________________________________________________________
#PB_Material_BumpShader

Effect: material with relief

texture(s) :
- 0: sampler2D color
- 1: sampler2D normal

MaterialShaderParameter :
#PB_Shader_Fragment
- float bumpy - default value: 1 (relief amplitude)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- MaterialShininess(#Material, Shininess , SpecularColor)
- LightAttenuation
- AmbiantColor
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

remark(s):
- the tangents must be defined (use'BuildMeshTangent')
___________________________________________________________________________________________
#PB_Material_SkyShader

Effect: displays a sky with clouds and sun

texture(s) :
- 0: uniform sampler2D color (clouds)

MaterialShaderParameter :
#PB_Shader_Fragment
- vec3 speed - default value: 10 0 0 (speed of clouds (X Z))
- float height - default value: 200 (height of the 1st cloud layer)
- int layer - default value: 2 (number of additional cloud layers)
- float scale - default value: 4000 (texture scale)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor, couleur): couleur du ciel soleil au zenith
- SetMaterialColor(#Material, #PB_Material_DiffuseColor, couleur): couleur du ciel soleil a l'horizon
- Fog

___________________________________________________________________________________________
#PB_Material_WaterShader

Effect : allows you to display a water surface

texture(s) :
- 0: sampler2D normal

MaterialShaderParameter :
#PB_Shader_Fragment
- float scale - default value: 0.1 (échelle de la texture)
- float height - default value: 1 (hauteur des vagues)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_DiffuseColor, couleur): couleur de l'eau (Alpha: opacité)
- SetMaterialColor(#Material, #PB_Material_SpecularColor, couleur): couleur du reflet du ciel
- Fog

___________________________________________________________________________________________
#PB_Material_WaterShaderRTT

Effect : permet d'afficher une surface d'eau avec reflet (via RTT)

texture(s) :
- 0 : sampler2D normal
- 1 : sampler2D RTT (render to texture)

MaterialShaderParameter : none

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_DiffuseColor, couleur): couleur de l'eau (Alpha: opacité)
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

___________________________________________________________________________________________
#PB_Material_OceanShader

Effect : allows to display a water surface with waves
texture(s) :
- 0: sampler2D normal
- 1: sampler2D color (foam)

MaterialShaderParameter :
#PB_Shader_Vertex
- float wavebig - default value: 0.5 (wave amplitude)
- float swell - default value: 0.5 (swell amplitude)
#PB_Shader_Fragment
- float wavelittle - default value: 0.5 (amplitude of "small" waves)
- float foam - default value: 0.5 (foam)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor, color): water color
- SetMaterialColor(#Material, #PB_Material_DiffuseColor, color): color of the sky reflection
- Fog

remark(s):
- the alpha value of the texture 'normal' contains the height of the wave

___________________________________________________________________________________________
#PB_Material_PointSpriteSphereShader

Effect: displays spheres at the vertices of the mesh

texture(s) : none

MaterialShaderParameter : none

Taking into account :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- MaterialShininess(#Material, Shininess , SpecularColor)
- AmbientColor
- Fog

remark(s):
- the material must be of type PointSprite : SetMaterialAttribute(0,#PB_Material_PointSprite,1)
- the mesh must be of type PointList : CreateMesh(#Mesh,#PB_Mesh_PointList)
- the radius of the sphere is defined by the texture coordinate U
- the color of the sphere is defined by the vertex color
example: MeshVertex(posX, posY, posZ, 10, 0,RGB(255,0,0))

_______________________________________________________________________________________
#PB_MaterialShader_CubicEnv

Effect: reflection via cubic texture

texture(s) :
- 0: samplerCube cubemap
- 1: uniform sampler2D color

MaterialShaderParameter :
#PB_Shader_Fragment
- float glossy - default value : 0.5 ( reflect intensity)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- AmbiantColor
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

remark(s) :
- cubic textures must be 'clamped': SetMaterialAttribute(#texture, #PB_Material_TAM, #PB_Material_ClampTAM)

___________________________________________________________________________________________
#PB_MaterialShader_CubicEnvBump

Effect: reflection via cubic texture with relief

texture(s) :
- 0: samplerCube cubemap
- 1: sampler2D color
- 2: sampler2D normal

MaterialShaderParameter :
#PB_Shader_Fragment
- float glossy - default value : 0.5 (reflect intensity)
- float bumpy - default value : 1 (relief amplitude)

Taking into account of :
- SetMaterialColor(#Material, #PB_Material_AmbientColor|#PB_Material_DiffuseColor, color)
- MaterialShininess(#Material, Shininess , SpecularColor)
- AmbiantColor
- Fog
- ScaleMaterial / ScrollMaterial / RotateMaterial

remark(s) :
- cubic textures must be 'clamped' : SetMaterialAttribute(#texture, #PB_Material_TAM, #PB_Material_ClampTAM)
- the tangents must be defined (use'BuildMeshTangent')
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: PB 6.00 - Shader documentation

Post by Psychophanta »

I did not dare to say it before, but, it is a must: why that silence about 3D behaviour in PB6.0?

there does not work a lot of things, and even the pc (in windows 64bit) resets all, without even a blue screen with some stuff. o_O
WindowedScreen makes strange flash when started.
ALL the tips and forum examples are extremely slow. o_O
Opengl lib is not available.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Fred
Administrator
Administrator
Posts: 16581
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB 6.00 - Shader documentation

Post by Fred »

Use "directX9" subsystem if it works better for you.
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: PB 6.00 - Shader documentation

Post by Psychophanta »

Fred wrote: Mon Jul 11, 2022 9:53 am Use "directX9" subsystem if it works better for you.
With that subsystem, starting to 'windowedscreen' is as normal behaviour here, however test yourself the extreme latency with mouse for example, in this tip:

Code: Select all

; Rota una entidad alrededor de un eje global dado. Hecho con PB nativo en Febrero 2019.
;/ inits
Global pantallacompleta.b=0,Titulo$="Rota una entidad alrededor de un eje global dado. Hecho con PB nativo en Febrero 2019"
If ExamineDesktops()=0:End:EndIf
Global bitplanes.a=DesktopDepth(0),FRX.u=DesktopWidth(0),FRY.u=DesktopHeight(0),RX.u=FRX,RY.u=FRY,FrecuenciadeMuestreo.u=60
If FRX<1280 Or FRY<720:RX=FRX*2/3:RY=FRY*2/3:Else:RX=1280:RY=720:EndIf
If InitEngine3D()=0
  MessageRequester("Error","The 3D Engine can't be initialized",0):End
EndIf
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,RX,RY,Titulo$,#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,RX,RY,1,0,0,#PB_Screen_WaitSynchronization)
Add3DArchive(#PB_Compiler_Home+"examples/3D/Data/Packs/skybox.zip",#PB_3DArchive_Zip)
Enumeration; Camaras
  #Camara
EndEnumeration
Enumeration; Luces
  #Luz
EndEnumeration
Enumeration; Texturas
  #Textura
EndEnumeration
Enumeration; Materiales
  #Material
EndEnumeration
Enumeration; Mallas
  #Object0malla
EndEnumeration
Enumeration; Entidades
  #Object0
EndEnumeration
Enumeration; Nodos
  #Pivotcamara
EndEnumeration
;\
Structure D3DXVECTOR3
  x.f
  y.f
  z.f
EndStructure
Structure Vector3D Extends D3DXVECTOR3
  m.f;<-length(modulo)
EndStructure
Structure BaseVectorial
  i.D3DXVECTOR3
  j.D3DXVECTOR3
  k.D3DXVECTOR3
EndStructure
Macro ProductoEscalar(a,b,ax=x,ay=y,az=z,bx=x,by=y,bz=z)
  (a#\ax#*b#\bx#+a#\ay#*b#\by#+a#\az#*b#\bz#)
EndMacro
Macro getmodulo(v,vx=x,vy=y,vz=z)
  (Sqr#ProductoEscalar(v#,v#,vx#,vy#,vz#,vx#,vy#,vz#))
EndMacro
Macro ProductoVectorial(in1,in2,out,in1x=x,in1y=y,in1z=z,in2x=x,in2y=y,in2z=z,outx=x,outy=y,outz=z); <- Calculates the vectorial product of two 3D vectors. Just modify this procedure to get the vectorial product for 4D, 5D, 6D or any dimension you need.
  out#\outx#=in1#\in1y#*in2#\in2z#-in1#\in1z#*in2#\in2y#
  out#\outy#=in1#\in1z#*in2#\in2x#-in1#\in1x#*in2#\in2z#
  out#\outz#=in1#\in1x#*in2#\in2y#-in1#\in1y#*in2#\in2x#
EndMacro
Procedure.b KeyEdgeDetection(key.a)
  Static pka.a
  If KeyboardPushed(key);<-if current key status is PUSHED
    If pka=0:pka=key:ProcedureReturn 1:EndIf;<-if previous key status was NOT PUSHED, then assign previous state to current one, and EXIT.
  ElseIf pka=key;<-else (if previous key status was PUSHED and current key status is NOT PUSHED):
    pka=0;:ProcedureReturn -1;<-set previous key status to NOT PUSHED.
  EndIf
  ProcedureReturn 0
EndProcedure
Macro TeclaControldecamara(tecla=LeftControl)
  If KeyEdgeDetection(#PB_Key_#tecla#); <- inicia control camara
    pasocam.f=0.01:pasocamincr.f=0.001
  ElseIf KeyboardReleased(#PB_Key_#tecla#)
  ElseIf KeyboardPushed(#PB_Key_#tecla#); <- mover el punto de vista
    ;para desplazar la camara hacia delante, atras, arriba, abajo, izq o der
    If mdx Or mdy Or mdz
      If mmb.b
        MoveNode(#Pivotcamara,mdx,-mdy,0,#PB_Local); o MoveCamera(#Camara,mdx,-mdy,0,#PB_Local) o MoveCamera(#Camara,mdx,-mdy,0,#PB_Relative)
      Else
        RotateNode(#Pivotcamara,-mdy*60,-mdx*60,0,#PB_Relative)
        If mdz
          MoveCamera(#Camara,0,0,-mdz,#PB_Relative)
        EndIf
      EndIf
    ElseIf KeyboardPushed(#PB_Key_Add)
      MoveCamera(#Camara,0,0,-pasocam,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Subtract)
      MoveCamera(#Camara,0,0,pasocam,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Pad8)
      MoveCamera(#Camara,0,pasocam,0,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Pad2)
      MoveCamera(#Camara,0,-pasocam,0,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Pad6)
      MoveCamera(#Camara,pasocam,0,0,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Pad4)
      MoveCamera(#Camara,-pasocam,0,0,#PB_Relative)
      pasocam+pasocamincr
    ElseIf KeyboardPushed(#PB_Key_Pad1)
      RotateNode(#Pivotcamara,0,-0.5,0,#PB_Relative)
    ElseIf KeyboardPushed(#PB_Key_Pad7)
      RotateNode(#Pivotcamara,0,0.5,0,#PB_Relative)
    ElseIf KeyboardPushed(#PB_Key_Pad3) Or lmb.b
      RotateNode(#Pivotcamara,0,0,-0.5,#PB_Relative)
    ElseIf KeyboardPushed(#PB_Key_Pad9) Or rmb.b
      RotateNode(#Pivotcamara,0,0,0.5,#PB_Relative)
    EndIf
EndMacro
Macro resetear
  RotateNode(#Pivotcamara,0,0,0,#PB_Absolute)
  MoveCamera(#Camara,0,0,6,#PB_Absolute)
EndMacro
SkyBox("stevecube.jpg")
CreateLight(#luz,$EEEEEE,4,4,2,#PB_Light_Point)
CreateCamera(#Camara,0,0,100,100):CreateNode(#Pivotcamara,0,0,0):AttachNodeObject(#Pivotcamara,CameraID(#Camara)):CameraRange(#Camara,0.1,10000):CameraBackColor(#Camara,$181911)
MoveCamera(#Camara,0,0,6,#PB_Absolute)
If CreateTexture(#Textura,32,32)
  Font.i=LoadFont(#PB_Any,"Arial",8)
  StartDrawing(TextureOutput(#Textura))
  Box(0,0,16,16,RGB(255,0,0))
  Box(16,0,16,16,RGB(0,255,0))
  Box(0,16,16,16,RGB(0,0,255))
  Box(16,16,16,16,RGB(255,255,0))
  DrawingFont(FontID(Font))
  DrawingMode(#PB_2DDrawing_Transparent)
  DrawText(6,2,"hola",RGB(0,0,0))
  DrawText(1,14,"mundo",RGB(0,0,0))
  StopDrawing()
EndIf
CreateMaterial(#material,TextureID(#textura))
CreateCube(#Object0malla,1)
CreateEntity(#Object0,MeshID(#Object0malla),MaterialID(#material),0,0.1581,0):RotateEntity(#Object0,1,20,3)
Macro ObtenerEjeLocalJdeunObjeto(tipo,objeto,vectorY)
  Pitch(tipo#ID(objeto#),90.0,#PB_Local):vectorY#\x=tipo#DirectionX(objeto#):vectorY#\y=tipo#DirectionY(objeto#):vectorY#\z=tipo#DirectionZ(objeto#):Pitch(tipo#ID(objeto#),270.0,#PB_Local)
EndMacro
Macro ObtenerBasedeOrientaciondeunObjeto(tipo,objeto,Base); <- el 'tipo' puede ser 'Camera', 'Entity' o 'Light'. 'Base' es del tipo .BaseVectorial
  ;Si se traza un segmento rectilineo desde un punto dado en el espacio ('objeto') hasta el centroide de un cuerpo dado ('objeto'), este segmento determina un plano normal a él, el cual contiene el centroide de 'objeto'.
  ;Lo que hace esta función es rotar 'objeto' alrededor de un eje dado ('fi->') referenciado a una base global de coordenadas.
  ;Dado que el 'objeto' tiene una orientación propia arbitraria, se necesita la base de coordenadas de este 'objeto' respecto a la base de referencia global.
  ;El eje alrededor del cual rota el 'objeto', así como la cantidad angular a rotar, está determinada por un vector angulo dado ('fi->'), o bien, un vector unidad más un valor escalar angular dados.
  ;Para rotar el 'objeto' con referencia a ese plano, el vector 'fi->' hay que referenciarlo a la base de orientación de 'objeto'
  ;Tenemos entonces 3 elementos de entrada a la funcion:
  ;1- un cuerpo en el espacio
  ;2- un punto en el espacio no coincidente con el centroide del cuerpo
  ;3- un vector angulo, o bien, un vector unidad más un valor escalar angular.
  ;'objeto' es la entidad o nodo de la cual debemos conocer su base de coordenadas, es decir su orientación propia 'x', 'y', y 'z' con respecto a la base global.
  ;'fi->' es el vector, dado en coordenadas globales, que hay que referenciar a coordenadas de 'objeto'
  ;'Base#.BaseVectorial\i->' será el vector 'i' de la base de orientación de 'objeto' con respecto al sistema global
  ;'Base#.BaseVectorial\j->' será el vector 'j' de la base de orientación de 'objeto' con respecto al sistema global
  ;'Base#.BaseVectorial\k->' será el vector 'k' de la base de orientación de 'objeto' con respecto al sistema global
  ;Para obtener la base de coordenadas de 'objeto':
  ;Dado que EntityRoll(objeto#,#PB_Absolute|#PB_Engine3D_Raw) nos da el angulo en que Base#\z-> es torsionado, entonces Base#\y-> y Base#\x-> los podremos conocer. Pero de momento no se como, así que hago esto:
  ;giro 'objeto' -90 grados sobre su propio eje 'y' para obtener su eje 'x' , y luego la dejo como estaba:
  Base#\k\x=tipo#DirectionX(objeto#):Base#\k\y=tipo#DirectionY(objeto#):Base#\k\z=tipo#DirectionZ(objeto#)
  ObtenerEjeLocalJdeunObjeto(tipo#,objeto#,Base#\j)
  ProductoVectorial(Base#\k,Base#\j,Base#\i)
  ;Ya tenemos la triada de vectores correspondientes a las base del objeto 'objeto' (Base#\i-> , Base#\j-> y Base#\k-> )
EndMacro
Macro ObtenerVectorReferidoaBasedeCoordenadasDada(Base,fi,fienobjeto)
  ;Para obtener el vector 'fi' referenciado a esa 'Base':
  fienobjeto#\x=Base#\i\x*fi#\x+Base#\j\x*fi#\y+Base#\k\x*fi#\z
  fienobjeto#\y=Base#\i\y*fi#\x+Base#\j\y*fi#\y+Base#\k\y*fi#\z
  fienobjeto#\z=Base#\i\z*fi#\x+Base#\j\z*fi#\y+Base#\k\z*fi#\z
EndMacro
Macro RotarSobreEjeGlobalArbitrario(objeto,ejeglobal,angulo); <- rota una entidad alrededor de un eje arbitrario global dado.
  provis.Vector3D
  ConvertWorldToLocalPosition(EntityID(objeto#),ejeglobal#\x+EntityX(objeto#),ejeglobal#\y+EntityY(objeto#),ejeglobal#\z+EntityZ(objeto#)); <- convierte una posición referenciada en la base global de coordenadas hacia una posición referenciada en la base local del objeto
  provis\x=GetX():provis\y=GetY():provis\z=GetZ():provis\m=getmodulo(provis)
  EntityFixedYawAxis(objeto#,#True,provis\x/provis\m,provis\y/provis\m,provis\z/provis\m); <- esta funcion interpreta el eje como local, asi que hay que transformar un vector de global a local
  Yaw(EntityID(objeto#),Degree(angulo#),#PB_Local)
  EntityFixedYawAxis(objeto#,#False)
EndMacro
Macro RotarObjetoSobreEjeReferidoaBaseDada(objetoarotar,tipodeobjeto,objeto,vector,angulo); el plano lo establece la base de coordenadas del objeto 'ojo'
  ObtenerBasedeOrientaciondeunObjeto(tipodeobjeto#,objeto#,base.BaseVectorial); <- obtener la base de coordenadas de un objeto
  ObtenerVectorReferidoaBasedeCoordenadasDada(base.BaseVectorial,vector#,eje.Vector3D); <- obtener el vector 'eje', referenciado en la base de coordenadas de 'ojo'.
  RotarSobreEjeGlobalArbitrario(objetoarotar#,eje.Vector3D,angulo#); <- rotar el objeto sobre ese 'eje'
EndMacro
Repeat
  ExamineMouse():ExamineKeyboard()
  WaitWindowEvent()
  CursorX.f=MouseX():CursorY.f=MouseY():lmb.b=MouseButton(#PB_MouseButton_Left):rmb.b=MouseButton(#PB_MouseButton_Right):mmb.b=MouseButton(#PB_MouseButton_Middle)
  mdx.f=MouseDeltaX()/200:mdy.f=MouseDeltaY()/200:mdz.f=MouseWheel()/20
  TeclaControldecamara(LeftControl)
  ElseIf KeyboardPushed(#PB_Key_F5):resetear
  ElseIf rmb
    MoveEntity(#Object0,mdx,-mdy,-mdz,#PB_World|#PB_Relative)
  Else
    THETA.f=Sqr(mdx.f*mdx.f+mdy.f*mdy.f+mdz.f*mdz.f)
    If THETA
      vectordeentrada.Vector3D\x=mdy:vectordeentrada.Vector3D\y=mdx:vectordeentrada.Vector3D\z=mdz
      RotarObjetoSobreEjeReferidoaBaseDada(#Object0,Camera,#Camara,vectordeentrada.Vector3D,THETA)
    EndIf
  EndIf
  TimeSinceLastFrame.i=RenderWorld(50)
  FlipBuffers():Delay(15)
Until KeyboardPushed(#PB_Key_Escape)
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Fred
Administrator
Administrator
Posts: 16581
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PB 6.00 - Shader documentation

Post by Fred »

Your event loop is wrong, you should know that since the time you're around :)
User avatar
Psychophanta
Addict
Addict
Posts: 4958
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: PB 6.00 - Shader documentation

Post by Psychophanta »

No timing problem with 5.xx versions.
Is 6.00 slower for 3D?
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Saboteur
Enthusiast
Enthusiast
Posts: 271
Joined: Fri Apr 25, 2003 7:09 pm
Location: (Madrid) Spain
Contact:

Re: PB 6.00 - Shader documentation

Post by Saboteur »

I think you have to process events with:
Repeat
event=WindowEvent()
Until event=0

Anyway something is not ok, I get a random error on linux at RenderWorld() line.
[:: PB Registered ::]

Win10 Intel core i5-3330 8GB RAM Nvidia GTX 1050Ti
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2050
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PB 6.00 - Shader documentation

Post by Andre »

As far as I can see, all or most of the text above is included in the PB docs now. Anything more to do? Then please post bug-reports / suggestions here: https://www.purebasic.fr/english/viewforum.php?f=37
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply