this is for making big points round:
Code: Select all
glEnable_(#GL_POINT_SMOOTH);
glHint_(#GL_POINT_SMOOTH_HINT, #GL_NICEST);
glEnable_(#GL_BLEND);
glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA); point_size 20 // as an example
your card may not display big round points, my card can't display more than size 100, some drivers can't display big round points.
save this file as points.material in the same folder as the code:
Code: Select all
material size_200
{
receive_shadows off
technique
{
pass
{
point_size 200
lighting off
diffuse vertexcolour
//scene_blend alpha_blend
}
}
}
material size_100
{
receive_shadows off
technique
{
pass
{
point_size 100
lighting off
diffuse vertexcolour
//scene_blend alpha_blend
//colour_op alpha_blend
//colour alpha_blend
//colour_op_ex blend_current_alpha src_texture src_current
//depth_write on
}
}
}
material size_50
{
receive_shadows off
technique
{
pass
{
point_size 50
lighting off
diffuse vertexcolour
}
}
}
material size_20
{
receive_shadows off
technique
{
pass
{
point_size 20
lighting off
diffuse vertexcolour
}
}
}
material size_10
{
receive_shadows off
technique
{
pass
{
point_size 10
lighting off
diffuse vertexcolour
//scene_blend alpha_blend
//depth_write off
}
}
}
material size_5
{
receive_shadows off
technique
{
pass
{
point_size 5
lighting off
diffuse vertexcolour
}
}
}
material size_2
{
receive_shadows off
technique
{
pass
{
point_size 2
lighting off
diffuse vertexcolour
}
}
}
uncomment line 60 : MaterialBlendingMode(0, #PB_Material_AlphaBlend)
and you may see as if the cube have interior, and the graphics now slower
Code: Select all
Procedure.f RandF(Min.f, Max.f, Resolution.i = 10000)
ProcedureReturn (Min + (Max - Min) * Random(Resolution) / Resolution)
EndProcedure
Enumeration
#MESH
#LIGHT
EndEnumeration
Quit.b = #False
#CameraSpeed = 1
Define.f KeyX, KeyY, MouseX, MouseY
Global flag, alpha
ExamineDesktops()
If OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), " Big Round Points.... use arrow keys and mouse to move the camera", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
InitEngine3D()
InitSprite()
OpenWindowedScreen(WindowID(0), 0, 0, DesktopWidth(0), DesktopHeight(0), 0, 0, 0)
InitKeyboard()
InitMouse()
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts",#PB_3DArchive_FileSystem)
Parse3DScripts()
CreateMaterial(3, LoadTexture(3, "snow_1024.jpg"))
CreateMaterial(4, LoadTexture(4, "Geebee2.bmp"))
CreatePlane(3, 200, 200, 5, 5, 5, 5)
CreateEntity(3,MeshID(3),MaterialID(3), 0, -50, 0)
CreateLight(0,RGB(255,255,255),-100,40,30)
AmbientColor(RGB(200,200,200))
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 70, 200)
CameraLookAt(0, 0, -15, 0)
EndIf
CreateMesh(1, #PB_Mesh_PointList, #PB_Mesh_Dynamic )
GetScriptMaterial(0, "size_10")
SetMeshMaterial(1, MaterialID(0))
DisableMaterialLighting(0, #True)
;MaterialBlendingMode(0, #PB_Material_AlphaBlend)
;MaterialBlendingMode(0, #PB_Material_Color)
glEnable_(#GL_POINT_SMOOTH);
glHint_(#GL_POINT_SMOOTH_HINT, #GL_NICEST);
glEnable_(#GL_BLEND);
glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA);
Global Stars = CreateNode(#PB_Any)
AttachNodeObject(Stars, MeshID(1))
alpha = 255
For i=1 To 200000
MeshVertexPosition(RandF(-50,50),RandF(-50,50), RandF(-50,50))
MeshVertexColor(RGBA(Random(255,10),Random(255,10),Random(255,10), alpha))
;MeshVertexColor(RGB(Random(255,10),Random(255,10),Random(255,10)))
Next
FinishMesh(#False)
flag = 1
Repeat
Event = WindowEvent()
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateNode(Stars, 0, 1/4, 0, #PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera(0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
Endalso compile with opengl option
Code: Select all
Procedure.f RandF(Min.f, Max.f, Resolution.i = 10000)
ProcedureReturn (Min + (Max - Min) * Random(Resolution) / Resolution)
EndProcedure
Enumeration
#house
#light
EndEnumeration
Quit.b = #False
#CameraSpeed = 5
Define.f KeyX, KeyY, MouseX, MouseY
ExamineDesktops()
If OpenWindow(0, 0, 0, DesktopWidth(0), DesktopHeight(0), " Big Round Points", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
;Initialize environment
InitEngine3D()
InitSprite()
OpenWindowedScreen(WindowID(0), 0, 0, DesktopWidth(0), DesktopHeight(0), 0, 0, 0)
InitKeyboard()
InitMouse()
SetFrameRate(60)
Add3DArchive(".", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Textures", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Models", #PB_3DArchive_FileSystem)
Add3DArchive(#PB_Compiler_Home + "Examples/3D/Data/Scripts",#PB_3DArchive_FileSystem)
Parse3DScripts()
CreateMaterial(3, LoadTexture(3, "snow_1024.jpg"))
CreatePlane(3, 1500, 1500, 5, 5, 5, 5)
CreateEntity(3,MeshID(3),MaterialID(3), 0, -500, 0)
CreateLight(0,RGB(255,255,255),-100,40,30)
AmbientColor(RGB(200,200,200))
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 4, 550)
CameraLookAt(0, 0, -200, 0)
EndIf
CreateMesh(1, #PB_Mesh_PointList, #PB_Mesh_Dynamic )
GetScriptMaterial(0, "size_100")
SetMeshMaterial(1, MaterialID(0))
DisableMaterialLighting(0, #True)
MaterialBlendingMode(0, #PB_Material_AlphaBlend)
glEnable_(#GL_POINT_SMOOTH);
glHint_(#GL_POINT_SMOOTH_HINT, #GL_NICEST);
glEnable_(#GL_BLEND);
glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA);
Global Stars = CreateNode(#PB_Any)
AttachNodeObject(Stars, MeshID(1))
MoveNode(Stars, 0, -250,0)
For i=1 To 1000
MeshVertexPosition(RandF(-100,100),RandF(-100,100), RandF(-100,100))
MeshVertexColor(RGBA(Random(255,10),Random(255,10),Random(255,10), 100))
Next
FinishMesh(#False)
;Main loop
Repeat
Event = WindowEvent()
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = #CameraSpeed
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -#CameraSpeed
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = #CameraSpeed
Else
KeyY = 0
EndIf
EndIf
RotateNode(Stars, 0, 1/4, 0, #PB_Relative)
RotateCamera(0, MouseY, MouseX, 0, #PB_Relative)
MoveCamera(0, KeyX, 0, KeyY)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
End
