Page 2 of 4

Posted: Thu Aug 13, 2009 2:18 am
by eddy
I added the first sprite effect.:
- global animation

Code: Select all

; ======================================
; EXAMPLE 4
; ======================================
DisableExplicit
InitMouse()
InitKeyboard()
InitEngine3D()
InitSprite()
Add3DArchive(".", #PB_3DArchive_FileSystem)

#w=800
#h=600
OpenWindow(0, 0, 0, #w, #h, "SpriteFX")
OpenWindowedScreen(WindowID(0), 0, 0, #w, #h, 0, 0, 0)

CreateGlobalAnimationFX(1, "0-19,18-0", 20)
Dim KABOOM(150)
If CreateView(0, 0, 0, #w, #h, 0)
   If AddLayer(1, "ex2.jpg", #Layer_Blend_Add)
      SetLayerFrameGrid(1, 4, 5)
      For i=0 To ArraySize(KABOOM())
         KABOOM(i)=AddSprite(#PB_Any, Random(800), Random(600), 64, 64)
         sc.f=1+Random(300)/100
         ScaleSprite(KABOOM(i), sc, sc)
         SetSpriteFX(KABOOM(i), 1)
      Next
   EndIf
EndIf

Repeat
   RenderViews()
   RenderWorld()
   FlipBuffers()
   
   ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) Or WaitWindowEvent(0)=#PB_Event_CloseWindow

Posted: Thu Aug 13, 2009 10:11 am
by jamirokwai
jamirokwai wrote:The png converted to bmp also display in blue. The blue parts of this screenshot should display in yellow.
You mean the colors are inverted. :?

Possibly, yes.
Did you try this code with your own texture ?
Yes. I used the bub.png, converted it to yellowish with a white background with no blue in it. The background is displayed in blue, not white, as I would expect it to be.

Posted: Thu Aug 13, 2009 10:23 am
by jamirokwai
eddy wrote:I added the first sprite effect.:
- global animation

Code: Select all

; ======================================
; EXAMPLE 4
; ======================================
DisableExplicit
InitMouse()
InitKeyboard()
InitEngine3D()
InitSprite()
Add3DArchive(".", #PB_3DArchive_FileSystem)

#w=800
#h=600
OpenWindow(0, 0, 0, #w, #h, "SpriteFX")
OpenWindowedScreen(WindowID(0), 0, 0, #w, #h, 0, 0, 0)

CreateGlobalAnimationFX(1, "0-19,18-0", 20)
Dim KABOOM(150)
If CreateView(0, 0, 0, #w, #h, 0)
   If AddLayer(1, "ex2.jpg", #Layer_Blend_Add)
      SetLayerFrameGrid(1, 4, 5)
      For i=0 To ArraySize(KABOOM())
         KABOOM(i)=AddSprite(#PB_Any, Random(800), Random(600), 64, 64)
         sc.f=1+Random(300)/100
         ScaleSprite(KABOOM(i), sc, sc)
         SetSpriteFX(KABOOM(i), 1)
      Next
   EndIf
EndIf

Repeat
   RenderViews()
   RenderWorld()
   FlipBuffers()
   
   ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape) And WaitWindowEvent(0)=#PB_Event_CloseWindow

For your information (Mac OS X pb4.31 x86). This example displays a frozen screen without animation. After a few moments, the debugger tells me about "Invalid Memory Access" at ExamineKeyboard(). It is not possible to exit via the ESC-key.

Also regarding the Animation-Feature: #MAXLONG is no constant predefined for Mac OS X x86 atm. I suppose the value is 2147483647, coming from a windows-PB. Since this seems to be a windows-api-constant: could be better to avoid these values for cross-platform-support?!

Here is the ogre.log. There is no problem logged. I suppose the error sits inside the software-rendering-routines?
  • 11:09:28: Creating resource group General
    11:09:28: Creating resource group Internal
    11:09:28: Creating resource group Autodetect
    11:09:28: SceneManagerFactory for type 'DefaultSceneManager' registered.
    11:09:28: Registering ResourceManager for type Material
    11:09:28: Registering ResourceManager for type Mesh
    11:09:28: Registering ResourceManager for type Skeleton
    11:09:28: MovableObjectFactory for type 'ParticleSystem' registered.
    11:09:28: OverlayElementFactory for type Panel registered.
    11:09:28: OverlayElementFactory for type BorderPanel registered.
    11:09:28: OverlayElementFactory for type TextArea registered.
    11:09:28: Registering ResourceManager for type Font
    11:09:28: ArchiveFactory for archive type FileSystem registered.
    11:09:28: ArchiveFactory for archive type Zip registered.
    11:09:28: FreeImage version: 3.10.0
    11:09:28: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
    11:09:28: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,koa,iff,lbm,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,dds,gif,g3,sgi,j2k,j2c,jp2
    11:09:28: DDS codec registering
    11:09:28: Registering ResourceManager for type HighLevelGpuProgram
    11:09:28: Registering ResourceManager for type Compositor
    11:09:28: MovableObjectFactory for type 'Entity' registered.
    11:09:28: MovableObjectFactory for type 'Light' registered.
    11:09:28: MovableObjectFactory for type 'BillboardSet' registered.
    11:09:28: MovableObjectFactory for type 'ManualObject' registered.
    11:09:28: MovableObjectFactory for type 'BillboardChain' registered.
    11:09:28: MovableObjectFactory for type 'RibbonTrail' registered.
    11:09:28: OGRE EXCEPTION(6:FileNotFoundException): 'plugins.cfg' file not found! in ConfigFile::load at OgreConfigFile.cpp (line 84)
    11:09:28: plugins.cfg not found, automatic plugin loading disabled.
    11:09:28: *-*-* OGRE Initialising
    11:09:28: *-*-* Version 1.6.0RC1 (Shoggoth)
    11:09:28: OpenGL Rendering Subsystem created.
    11:09:28: Particle Emitter Type 'Point' registered
    11:09:28: Particle Emitter Type 'Box' registered
    11:09:28: Particle Emitter Type 'Ellipsoid' registered
    11:09:28: Particle Emitter Type 'Cylinder' registered
    11:09:28: Particle Emitter Type 'Ring' registered
    11:09:28: Particle Emitter Type 'HollowEllipsoid' registered
    11:09:28: Particle Affector Type 'LinearForce' registered
    11:09:28: Particle Affector Type 'ColourFader' registered
    11:09:28: Particle Affector Type 'ColourFader2' registered
    11:09:28: Particle Affector Type 'ColourImage' registered
    11:09:28: Particle Affector Type 'ColourInterpolator' registered
    11:09:28: Particle Affector Type 'Scaler' registered
    11:09:28: Particle Affector Type 'Rotator' registered
    11:09:28: Particle Affector Type 'DirectionRandomiser' registered
    11:09:28: Particle Affector Type 'DeflectorPlane' registered
    11:09:28: CPU Identifier & Features
    11:09:28: -------------------------
    11:09:28: * CPU ID: GenuineIntel: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz
    11:09:28: * SSE: yes
    11:09:28: * SSE2: yes
    11:09:28: * SSE3: yes
    11:09:28: * MMX: yes
    11:09:28: * MMXEXT: yes
    11:09:28: * 3DNOW: no
    11:09:28: * 3DNOWEXT: no
    11:09:28: * CMOV: yes
    11:09:28: * TSC: yes
    11:09:28: * FPU: yes
    11:09:28: * PRO: yes
    11:09:28: * HT: no
    11:09:28: -------------------------
    11:09:28: *******************************************
    *** Starting OSX OpenGL Subsystem ***
    *******************************************
    11:09:28: SceneManagerFactory for type 'OctreeSceneManager' registered.
    11:09:28: SceneManagerFactory for type 'TerrainSceneManager' registered.
    11:09:28: SceneManagerFactory for type 'BspSceneManager' registered.
    11:09:28: Registering ResourceManager for type BspLevel
    11:09:28: Added resource location '.' of type 'FileSystem' to resource group 'General'
    11:09:28: GLRenderSystem::_createRenderWindow "PureBasic Ogre", 800x600 fullscreen miscParams: FSAA=0 colourDepth=32
    11:09:28: Creating a Carbon Compatible Render System
    11:09:30: GL_VERSION = 1.2 APPLE-1.5.48
    11:09:30: GL_VENDOR = Intel Inc.
    11:09:30: GL_RENDERER = Intel GMA 950 OpenGL Engine
    11:09:30: GL_EXTENSIONS = GL_ARB_transpose_matrix GL_ARB_vertex_program GL_ARB_vertex_blend GL_ARB_window_pos GL_ARB_shader_objects GL_ARB_vertex_shader GL_ARB_shading_language_100 GL_EXT_multi_draw_arrays GL_EXT_clip_volume_hint GL_EXT_rescale_normal GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_gpu_program_parameters GL_EXT_geometry_shader4 GL_EXT_transform_feedback GL_APPLE_client_storage GL_APPLE_specular_vector GL_APPLE_transform_hint GL_APPLE_packed_pixels GL_APPLE_fence GL_APPLE_vertex_array_object GL_APPLE_vertex_program_evaluators GL_APPLE_element_array GL_APPLE_flush_render GL_APPLE_aux_depth_stencil GL_NV_texgen_reflection GL_NV_light_max_exponent GL_IBM_rasterpos_clip GL_SGIS_generate_mipmap GL_ARB_texture_border_clamp GL_ARB_multitexture GL_ARB_texture_env_add GL_ARB_texture_cube_map GL_ARB_texture_env_dot3 GL_ARB_texture_env_combine GL_ARB_texture_compression GL_ARB_texture_mirrored_repeat GL_ARB_shadow GL_ARB_depth_texture GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_point_sprite GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ARB_pixel_buffer_object GL_EXT_framebuffer_object GL_EXT_texture_rectangle GL_ARB_texture_rectangle GL_EXT_texture_env_add GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_texture_lod_bias GL_EXT_abgr GL_EXT_bgra GL_EXT_stencil_wrap GL_EXT_texture_filter_anisotropic GL_EXT_separate_specular_color GL_EXT_secondary_color GL_EXT_blend_func_separate GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1 GL_EXT_blend_equation_separate GL_EXT_packed_depth_stencil GL_APPLE_flush_buffer_range GL_APPLE_ycbcr_422 GL_APPLE_vertex_array_range GL_APPLE_texture_range GL_APPLE_pixel_buffer GL_APPLE_object_purgeable GL_NV_blend_square GL_ATI_texture_env_combine3 GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod
    11:09:30: ***************************
    11:09:30: *** GL Renderer Started ***
    11:09:30: ***************************
    11:09:30: Registering ResourceManager for type GpuProgram
    11:09:30: GLSL support detected
    11:09:30: GL: Using framebuffer copy for rendering to textures (worst)
    11:09:30: GL: Warning: RenderTexture size is restricted to size of framebuffer. If you are on Linux, consider using GLX instead of SDL.
    11:09:30: RenderSystem capabilities
    11:09:30: -------------------------
    11:09:30: RenderSystem Name: OpenGL Rendering Subsystem
    11:09:30: GPU Vendor: intel
    11:09:30: Device Name: Intel GMA 950 OpenGL Engine
    11:09:30: Driver Version: 1.2.0.0
    11:09:30: * Fixed function pipeline: yes
    11:09:30: * Hardware generation of mipmaps: yes
    11:09:30: * Texture blending: yes
    11:09:30: * Anisotropic texture filtering: yes
    11:09:30: * Dot product texture operation: yes
    11:09:30: * Cube mapping: yes
    11:09:30: * Hardware stencil buffer: yes
    11:09:30: - Stencil depth: 8
    11:09:30: - Two sided stencil support: yes
    11:09:30: - Wrap stencil values: yes
    11:09:30: * Hardware vertex / index buffers: yes
    11:09:30: * Vertex programs: yes
    11:09:30: * Fragment programs: yes
    11:09:30: * Supported Shader Profiles: arbfp1 arbvp1 glsl
    11:09:30: * Texture Compression: yes
    11:09:30: - DXT: yes
    11:09:30: - VTC: no
    11:09:30: * Scissor Rectangle: yes
    11:09:30: * Hardware Occlusion Query: no
    11:09:30: * User clip planes: yes
    11:09:30: * VET_UBYTE4 vertex element type: yes
    11:09:30: * Infinite far plane projection: yes
    11:09:30: * Hardware render-to-texture: yes
    11:09:30: * Floating point textures: no
    11:09:30: * Non-power-of-two textures: yes
    11:09:30: * Volume textures: yes
    11:09:30: * Multiple Render Targets: 1
    11:09:30: - With different bit depths: no
    11:09:30: * Point Sprites: yes
    11:09:30: * Extended point parameters: no
    11:09:30: * Max Point Size: 64
    11:09:30: * Vertex texture fetch: yes
    11:09:30: - Max vertex textures: 16
    11:09:30: - Vertex textures shared: yes
    11:09:30: * GL 1.5 without VBO workaround: no
    11:09:30: * Frame Buffer objects: no
    11:09:30: * Frame Buffer objects (ARB extension): no
    11:09:30: * Frame Buffer objects (ATI extension): no
    11:09:30: * PBuffer suppport: no
    11:09:30: * GL 1.5 without HW-occlusion workaround: no
    11:09:30: Registering ResourceManager for type Texture
    11:09:30: ResourceBackgroundQueue - threading disabled
    11:09:30: Particle Renderer Type 'billboard' registered
    11:09:30: Texture: bub2.jpg: Loading 1 faces(PF_R8G8B8,256x256x1) with 8 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
    11:09:30: WARNING: Mesh instance 'M4871036' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
    11:09:35: Render Target 'PureBasic Ogre' Average FPS: 43.6009 Best FPS: 59.7015 Worst FPS: 0.545256
    11:09:35: *-*-* OGRE Shutdown
    11:09:35: CPU Identifier & Features
    11:09:35: -------------------------
    11:09:35: * CPU ID: GenuineIntel: Intel(R) Core(TM)2 CPU T7400 @ 2.16GHz
    11:09:35: * SSE: yes
    11:09:35: * SSE2: yes
    11:09:35: * SSE3: yes
    11:09:35: * MMX: yes
    11:09:35: * MMXEXT: yes
    11:09:35: * 3DNOW: no
    11:09:35: * 3DNOWEXT: no
    11:09:35: * CMOV: yes
    11:09:35: * TSC: yes
    11:09:35: * FPU: yes
    11:09:35: * PRO: yes
    11:09:35: * HT: no
    11:09:35: -------------------------
    11:09:35: *******************************************
    *** Starting OSX OpenGL Subsystem ***
    *******************************************

Posted: Thu Aug 13, 2009 11:39 am
by eddy
You can try to load this texture with the common sprite3D commands.
If you get the same result, the problem could be my texture

Posted: Fri Aug 14, 2009 6:28 am
by Wladek
I think,OpenGL is more fast for sprites3D , than Ogre3D.
But Ogre use OpenGL and DirectX . Maybe Ogre more fast than OpenGL, for Windows.
What is your opinion?

Sorry if I make mistaken.

Posted: Sun Aug 30, 2009 6:43 am
by eddy
v0.88
- some FX functions (e.g pauseFX, resumeFX...)
- FX : rotateFX, scaleFX, animationFX

Posted: Mon Aug 31, 2009 8:37 am
by eddy
WIP:
- FX: transparency, color
- MacOS color problem (I think I found where is the problem)

TODO:
- FX: shake, orbit, blink

Posted: Mon Aug 31, 2009 10:02 pm
by jamirokwai
eddy wrote:- MacOS color problem (I think I found where is the problem)
I can confirm this. Tried it on the new purring Snow Leopard. Works great!
What was the problem???

Posted: Mon Aug 31, 2009 10:33 pm
by eddy
Wait, I didn't fix the problem in this last version. :shock:
jamirokwai wrote:
eddy wrote:- MacOS color problem (I think I found where is the problem)
I can confirm this. Tried it on the new purring Snow Leopard. Works great!
What was the problem???
I have to invert the sprite color before calling the function SetMeshData :?
But mac version of SetMeshData works with normal color.

Posted: Mon Aug 31, 2009 11:39 pm
by jamirokwai
eddy wrote:Wait, I didn't fix the problem in this last version. :shock:
jamirokwai wrote:
eddy wrote:- MacOS color problem (I think I found where is the problem)
I can confirm this. Tried it on the new purring Snow Leopard. Works great!
What was the problem???
I have to invert the sprite color before calling the function SetMeshData :?
But mac version of SetMeshData works with normal color.
That is indeed crap. Is this a problem of the Mac-version of Ogre or general behaviour? This will hopefully be fixed with a new version. I found the same bug a few minutes ago while trying the Mesh-example of PB.

Did you already open a bug-report for this behaviour?

EDIT: added a bug-report/feature-question - http://www.purebasic.fr/english/viewtopic.php?p=298109

Posted: Mon Aug 31, 2009 11:43 pm
by eddy
I think it's a general behaviour : a technical difference between DX and OpenGl.

But I'll ask the question to fred to confirm this.

Posted: Sat Sep 05, 2009 8:26 pm
by eddy
For the orbit FX I need to optimize the cosine calculation.

Could you test this code if you are a mac or linux user :?:
I need result for MAC PPC, MAC INTEL and LINUX

Code: Select all

CompilerIf #PB_Compiler_OS<>#PB_OS_Windows
   Debug "test MAC / LINUX" 
   a=-150
   Debug a%128 ; <----- result = 106
CompilerEndIf

Posted: Sun Sep 06, 2009 5:21 am
by eddy
v0.90 uploaded
- more FX
- random sprite commands (randomSpritePosition, randomSpriteScale...)
- fixed color problem of MAC version

Re: Sprite3D engine with FX [cross-platform]

Posted: Fri Sep 11, 2009 10:26 pm
by eddy
for the next version...

- Fx : FaceObject, FollowObject, Path, SineScale, SineRotate, SineMove, Vortex
- layer will support some FXs ( SetLayerFX )

Image

Test Exe for Sprite3D engine

Posted: Tue Sep 15, 2009 4:20 am
by eddy
Here is a little test : :arrow: window exe : http://www.datafilehost.com/download-b22efe98.html
I mixed some FXs : sineMove, mouse control, rotation, followObject, faceObject, scale...

The path FX seems to be more complex. There's different way to do it.