Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: hellfire on June 09, 2009

Title: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 09, 2009
So moderator magic moved my post from here (http://www.dbfinteractive.com/forum/index.php/topic,4101.new/boardseen.html#new) to a whole new topic...

As stated in the title it's just a copy of Clyde's source to compile in Visual Studio (2005 or newer).
Might be interesting for blitz-users who want to peek into c++.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Pixel_Outlaw on June 09, 2009
I ran the included .exe and all I saw was a white screen. I have a Radeon card.

I was looking forward to it too.  :skint:
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Shockwave on June 09, 2009
Ooh, nice one.
Works here fine ATI X1650
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: rdc on June 09, 2009
Very cool.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 09, 2009
I ran the included .exe and all I saw was a white screen. I have a Radeon card.
Oh, so my framework seems to went somewhat incompatible somewhere; I'll have a look at that later...
What card is that exactly?

edit:
After having a closer look at my screen-interface, the only potential problem I could spot is the use of non-power-of-two-textures (using GL_TEXTURE_RECTANGLE) which work properly even on a pretty old geforce2mx (with current drivers) which is the oldest card I can get my hands on at the moment...  :skint:
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Moroboshisan on June 09, 2009
I ran the included .exe and all I saw was a white screen.

same white screen here.

Notebook Acer Aspire 5710, Intel(R) Graphics Media Accelerator, Driver Version: 6.14.10.4926
*   Accelerator Information   *
Accelerator in Use:   Mobile Intel(R) 945 Express Chipset Family
Video BIOS:      1471.0
Current Graphics Mode:   1280 by 800 True Color (60 Hz)

DirectX: 9.0c v4.09.0000.0904

WinXP SP3
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Clyde on June 09, 2009
Excellent Conversion HellFire dude, and really cool work with your screen lib.
Very usefull source for when I delve into C++ properlly.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Pixel_Outlaw on June 09, 2009
Running fine here now! Looks really smooth. Thanks for the code as I'm trying to pick up C++ before my college semester starts at the end of the summer vacation. You also have very clean coding style.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: mziskandar on June 09, 2009
Cool...
Runs well on:

Win XP SP3
Intel 3.0ht
Ati9600xt
768MB RAM

Thanks for the source..  :goodpost:
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 09, 2009
OK on my W7 nVidia 8600GT, but white screen on my W7 i945 GMA950.

Jim
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: spitfire on June 10, 2009
white screen; laptop intel graphics chip
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 10, 2009
Those mobile chipsets seem to cause a bit of a trouble.
I've added two versions for testing, do they work any better?
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: spitfire on June 10, 2009
extended region works, direct is white
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 10, 2009
same for me.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Moroboshisan on June 10, 2009
extended region works, direct is white

same here
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: va!n on June 10, 2009
@hellfire:
thanks a lot for sharing the VS version... i tested both version on my Win7-RC1-64 bit config... Plasma of both versions are running without probs... however, while closing the app, both version crashed here!

Just a question, the screen.lib seems to based on OpenGL... Is this lib your own work? (however i am very interested in DX :P )
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 10, 2009
Quote
the screen.lib seems to based on OpenGL... Is this lib your own work?
Of course - you can easily recognize my code at the number of reported problems ;)

Quote
i am very interested in DX  :P
I chose OpenGL here because everything that's needed to compile is already installed with Visual-Studio.
So there's no need to download huge sdks or fiddling with project settings - which is major obstacle when starting with C++.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: benny! on June 11, 2009
@HellFire:

Nice example - thanks and K++ for uploading it.

Both versions just run fine on my little DELL notebook.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Rbz on June 11, 2009
Works fine here (Geforce 8800)

Here one version using tinyptc_ext for MSVC 2008, almost a copy and paste of Hellfire source :)
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: spitfire on June 12, 2009
works
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 12, 2009
Quote
Here one version using tinyptc_ext for MSVC 2008
Nice :)

The idea of my screen-lib is to stretch the output-image using hardware-acceleration.
Manual scaling reduces performance quite drastically - especially with the hd-resolutions that are common nowadays.
I usually prefer to run in display's native resolution as you never know what it's doing when changing it.
And I also like the comfort of resizing the window or moving it across screens.

I'm trying to sort out the reported problems - which is a bit tricky as eg intel-chipsets claim to support non-power-of-two-textures but actually they don't...

Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 12, 2009
rbz's version works, and not only that it's doing real-time frame rates (20+fps, maybe more) on battery on my Intel Atom netbook (specs above) whereas the previous working version was doing about 2fps.  Is that down to the scaling?

Jim
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 12, 2009
Quote
whereas the previous working version was doing about 2fps
Interessting.
That "working" version uploads a 512x256 texture and draws a single fullscreen quad (addressing a 320x240 subregion) with bilinear filtering.
I guess rbz' is uploading 640x480 using glDrawPixels; if that's significantly faster, there's apparently no hardware-acceleration on your system.




Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 12, 2009
It runs Aero, so that means that it has PS2.0 and DirectX9.  I really should run some experiments myself...

Jim
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Rbz on June 13, 2009
....
I guess rbz' is uploading 640x480 using glDrawPixels; ....
tinyptc_ext uses DirectDraw surface and it this case it use a 640x480 buffer.

We tried to use Opengl some time ago but we got some problems on some PC's config (slow down) and decided to use the old method that Gaffer developed for the original tinyptc.

In fact, tinyptc is one of the best know library for old school pixel coders, it work's everywhere,  and those features added in the "ext" version make it nicer to use and still making small files.
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 28, 2009
We have a winner!

Microsoft Corporation
GDI Generic
1.1.0
Extensions
   GL_WIN_swap_hint
   GL_EXT_bgra
   GL_EXT_paletted_texture

This is on my netbook - it doesn't hardware accelerate OpenGL at all!  Which explains why DirectDraw is better.  Wonder if that problem will get addressed with final release drivers?

Jim

Later:
I went back to the Vista driver and installed it on Windows 7.
Now I get

Intel
Intel 945GM
1.4.0 - Build 7.14.10.4906
Extensions
   GL_ARB_depth_texture
   GL_ARB_fragment_program
   GL_ARB_multitexture
   GL_ARB_point_parameters
   GL_ARB_shadow
   GL_ARB_texture_border_clamp
   GL_ARB_texture_compression
   GL_ARB_texture_cube_map
   GL_ARB_texture_env_add
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_dot3
   GL_ARB_texture_env_crossbar
   GL_ARB_transpose_matrix
   GL_ARB_vertex_buffer_object
   GL_ARB_vertex_program
   GL_ARB_window_pos
   GL_EXT_abgr
   GL_EXT_bgra
   GL_EXT_blend_color
   GL_EXT_blend_func_separate
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_clip_volume_hint
   GL_EXT_compiled_vertex_array
   GL_EXT_cull_vertex
   GL_EXT_draw_range_elements
   GL_EXT_fog_coord
   GL_EXT_multi_draw_arrays
   GL_EXT_packed_pixels
   GL_EXT_rescale_normal
   GL_EXT_secondary_color
   GL_EXT_separate_specular_color
   GL_EXT_shadow_funcs
   GL_EXT_stencil_two_side
   GL_EXT_stencil_wrap
   GL_EXT_texture_compression_s3tc
   GL_EXT_texture_env_add
   GL_EXT_texture_env_combine
   GL_EXT_texture_lod_bias
   GL_EXT_texture_filter_anisotropic
   GL_EXT_texture3D
   GL_3DFX_texture_compression_FXT1
   GL_IBM_texture_mirrored_repeat
   GL_NV_blend_square
   GL_NV_texgen_reflection
   GL_SGIS_generate_mipmap
   GL_SGIS_texture_edge_clamp
   GL_SGIS_texture_lod
   GL_WIN_swap_hint

and the extended region version works brilliantly and is much faster than the ptc version.
Shame though that this driver is horrible for everything else :)

Jim
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: Jim on June 29, 2009
Ask and ye shall receive!  A new Windows 7 driver from Intel today with OpenGL support
Intel
Intel 945GM
1.4.0 - Build 8.15.10.1825
Extensions
   GL_EXT_blend_minmax
   GL_EXT_blend_subtract
   GL_EXT_blend_color
   GL_EXT_abgr
   GL_EXT_texture3D
   GL_EXT_clip_volume_hint
   GL_EXT_compiled_vertex_array
   GL_EXT_cull_vertex
   GL_SGIS_texture_edge_clamp
   GL_SGIS_generate_mipmap
   GL_EXT_draw_range_elements
   GL_SGIS_texture_lod
   GL_EXT_rescale_normal
   GL_EXT_packed_pixels
   GL_EXT_separate_specular_color
   GL_ARB_multitexture
   GL_EXT_texture_env_combine
   GL_EXT_bgra
   GL_EXT_blend_func_separate
   GL_EXT_secondary_color
   GL_EXT_fog_coord
   GL_EXT_texture_env_add
   GL_ARB_texture_cube_map
   GL_ARB_transpose_matrix
   GL_ARB_texture_env_add
   GL_IBM_texture_mirrored_repeat
   GL_EXT_multi_draw_arrays
   GL_NV_blend_square
   GL_ARB_texture_compression
   GL_3DFX_texture_compression_FXT1
   GL_EXT_texture_filter_anisotropic
   GL_ARB_texture_border_clamp
   GL_ARB_point_parameters
   GL_ARB_texture_env_combine
   GL_ARB_texture_env_dot3
   GL_ARB_texture_env_crossbar
   GL_EXT_texture_compression_s3tc
   GL_ARB_shadow
   GL_ARB_window_pos
   GL_EXT_shadow_funcs
   GL_EXT_stencil_wrap
   GL_ARB_vertex_program
   GL_ARB_fragment_program
   GL_EXT_stencil_two_side
   GL_ARB_vertex_buffer_object
   GL_EXT_texture_lod_bias
   GL_NV_texgen_reflection
   GL_ARB_depth_texture
   GL_WIN_swap_hint

Jim
Title: Re: [C++] plasma (adapted from Clyde's BMAX code)
Post by: hellfire on June 30, 2009
Thanks for your investigations, Jim.
I'm still a bit confused about how some hardware can run complex shaders but can not access an arbitrary-sized texture.
Probably just some strange form of economy...