• Welcome to Theos PowerBasic Museum 2017.

BassBox

Started by Patrice Terrier, October 08, 2007, 10:57:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Charles Pegge


Good idea. And if you sort the plugin list alphabetically, you can ensure that themed plugins are grouped together eg GenesisPT001 GenesisPT02 .. I think this will work well, at least for the first 100 plugins :)

Petr, the Cubeshere is useful because it has a good distribution of quads over its surface without excessive concentration at the poles. The vertices can then be varied to generate the rough terrain. But there are two main problems to deal with. One is stitching the terrains together seamlessly and the other is fitting spherical texture skins to this layout of vertices.


Charles Pegge

These layers of translucent texture - very subtle and fascinating Patrice. Brings the planet to life.


Well Vulcan gets some more heat treatment, but the occasional abyss into the interior can only be closed with the power of mathematics, and a good night's sleep.

Patrice Terrier

#242
There is a new BassBox version!

The ZIP file is attached to the first post of this thread.

Now you can give any name to your plugin, the kernell checks all the DLL stored in the "BBPlugin\" subfolder, if they export the "BBProc" procedure they are bounded to the kernell, else they are ignored.

I have renamed all the existing DLL with a name matching their Title.

__________________________


Special note for Charles:

"Vulcan.bas" and "StickDance.bas", at this moment, are only provided in source code format, because they both create a problem with the other plugins using textures, perhaps because they use a special mapping texture mode that is not reseted during the BBP_Destroy message.
To see the problem start BassBox selecting the "Vulcan" plugin then switch to "Day One", and look how the texture is mapped hover the globe (it is darker and uses tesselate by face mode).

It would be nice if you could turn off this feature in your plugin when it is detached. Or at least tell me what to do.

Thank you

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Petr Schreiber

Hi Patrice and Charles,

I think that problem which is caused by the Charles plugins is just that he defined other kind of blending ( glBlendFunc ), maybe something more ( light setup ).

New version is very nice ( especially Genesis ), but without Charles plugins not complete :'(
Hope we will find all reasons it causes troubles soon.

OpenGL works like state machine, so when you change something, it stays changed.


Bye,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Charles Pegge

The main difference from your render settings is that I use Lighting and also color_material which controls how the color interacts with light sources. My Plugins currently do not disable GL_COLOR_MATERIAL at the end of rendering.

Unfortunately, I can't reproduce the problem that you describe so I cant verify that this is the cause,  but you may want to use these features in future plugins so it may be desirable to enable/disable them rather than assume they are always disabled. What do you think?



         glEnable GL_LIGHTING
         glEnable GL_COLOR_MATERIAL



render_settings:
         glShadeModel GL_SMOOTH                            'Enable Smooth Shading
         'glClearColor cl(0,0), cl(1,0), cl(2,0), cl(3,0)   'Background
         glClearDepth 1.0                                  'Depth Buffer Setup
         glEnable GL_DEPTH_TEST                            'Enables Depth Testing
         glDepthFunc GL_LEQUAL                             'The Type Of Depth Testing To Do
         glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST  'Really Nice Perspective Calculations
         glEnable GL_LIGHTING                              'Enable Lighting
         glEnable GL_COLOR_MATERIAL                        'Enable Coloring Of Material
         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) 'Enable Alpha Blending
         glEnable(GL_BLEND)                                'Enable Blending
         glEnable(GL_ALPHA_TEST)                           'Enable Alpha Testing
         glAlphaFunc(GL_ALWAYS,0.0)                        'Set Alpha Testing
         'glDisable(GL_CULL_FACE)                            'Remove front or Back Face
RETURN



Kent Sarikaya

Guys, when I put the plugins into where i think they should go, they don't show up. Do I need to add anything to the bassbox code?
I haven't been able to view any of the recent new plugins and the screenshots look so good.

Charles Pegge

Kent, I think the best way to do it is unzip the new Bassbox into a new folder. If you want to see mine (StickDance Plug005 & Vulcan ) all you have to do is compile them in situ then rerun BassBox. I'd be interested to know if any of them interfere with the other plugins on your system.

Kent Sarikaya

Thanks Charles, I followed your instructions and got all of them working. All the plug-ins look fine. The only thing I notice, if any is that the first plugin with the blue world is sort of ghosted as Petr mentioned. I can't remember if it was like this before I added your plugins. I did notice some fading before I do remember that, but the extent is where I am fuzzy.
The other plugins all look ok as far as I can tell.

All I know is how nice these plugins and the player are. I really enjoy your guys talents and creativity!

Patrice Terrier

#248
I had a hard time to figure and suppress most plugin's interaction.

I think I solved everything, however so far I checked only on VISTA, but I am confident that you will check it also on XP ;)

I did several changes in the Kernell and in the plugin as well, so please do not overwrite what I have done.

Kernell change:


SUB BBP_Reset()
    LOCAL BBP AS BBPLUGIN
    BBP.Msg = %BBP_CREATE
    CALL BBP_Plugin(BBP)
    IF BBP.RenderTo = %BBP_OPENGL THEN
       CALL glDisable(%GL_BLEND)
       CALL glDisable(%GL_TEXTURE_2D)
       CALL glDisable(%GL_DEPTH_TEST)
       CALL glDisable(%GL_LIGHT0)
       CALL glDisable(%GL_LIGHT1)
       CALL glDisable(%GL_LIGHT2)
       CALL glDisable(%GL_LIGHT3)
       CALL glDisable(%GL_LIGHT4)
       CALL glDisable(%GL_LIGHT5)
       CALL glDisable(%GL_LIGHT6)
       CALL glDisable(%GL_LIGHT7)
       CALL glDisable(%GL_LIGHTING)
       CALL glDisable(%GL_COLOR_MATERIAL)
       CALL glDisable(%GL_ALPHA_TEST)
       CALL glDisable(%GL_NORMALIZE)

       'DIM No_Mat(3) AS SINGLE ' : ARRAY ASSIGN No_Mat() = 0.0, 0.0, 0.0, 0.0
       'CALL glMaterialfv(%GL_FRONT_AND_BACK, %GL_DIFFUSE, No_Mat(0))
       'CALL glMaterialfv(%GL_FRONT_AND_BACK, %GL_SPECULAR, No_Mat(0))
       'CALL glMaterialfv(%GL_FRONT_AND_BACK, %GL_SHININESS, No_Mat(0))
       'CALL glFlush()

    END IF
END SUB


Plugins that have been edited:
Day1.bas, StickDance.bas, Vulcan.bas

The most important change was done in StickDance, there:

    CASE %BBP_DESTROY
         DIM No_Mat(3) AS SINGLE ' Dito ARRAY ASSIGN Dummy() = 0.0, 0.0, 0.0, 0.0
         glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, No_Mat(0))
         glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, No_Mat(0))
         glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, No_Mat(0))


I suggest the use of ARRAY ASSIGN to simplify array affectation.

Looking forward for your feedback.

The ZIP file is attached to the first post of this thread.

...

Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

Thanks Patrice. That looks like a comprehensive reset of Opengl states. I can see my prior version of 005 bleaches part of  day0 and day1 so I presume this is due to not clearing glmaterial values.

Now let's see what other kinds of mischief can be wrought upon your system, shadows, antialiasing, vertex and fragment shaders.... ;)

Kent Sarikaya

Thanks for the update Patrice. Happy to report all seems to work fine here on XP that I can see!!

Patrice Terrier

#251
In VISTA (and XP as well), I would like to create a Desktop Window Manager (DWM) thumbnail, to reduce the size of the player in order to take less room on the desktop.

I know how to do this on VISTA (and XP as well) however the problem I have, is that OpenGL doesn't render the viewport if it is not shown on the desktop.

Do you know if there is a way to render OpenGL directly to a memory bitmap without showing it first to the screen?
 
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

You could try making a tiny tiny viewport of a few pixels, one pixel or maybe even zero pixels? But it would be interesting to see something on a micro screen.

Petr Schreiber

#253
Hi Patrice,

you know the answer is PBuffers. Now just how to get PBuffers to PB :D

Here are the extensions defined in C:

    DECLARE_HANDLE(HPBUFFERARB);

    HPBUFFERARB wglCreatePbufferARB(HDC hDC,
    int iPixelFormat,
    int iWidth,
    int iHeight,
    const int *piAttribList);

    HDC wglGetPbufferDCARB(HPBUFFERARB hPbuffer);

    int wglReleasePbufferDCARB(HPBUFFERARB hPbuffer,
       HDC hDC);

    BOOL wglDestroyPbufferARB(HPBUFFERARB hPbuffer);

    BOOL wglQueryPbufferARB(HPBUFFERARB hPbuffer,
    int iAttribute,
    int *piValue);


Here is how I would translate them to PB ( no warranty, I am not José :( )

DECLARE FUNCTION prototype_wglCreatePbufferARB( BYVAL hDc as DWORD, BYVAL iPixelFormat AS LONG, BYVAL iWidth AS LONG, BYVAL iHeight AS LONG, BYVAL piAttribList AS DWORD ) AS DWORD

DECLARE FUNCTION prototype_wglGetPbufferDCARB( BYVAL hPbuffer as DWORD ) AS DWORD

DECLARE FUNCTION prototype_wglReleasePbufferDCARB( BYVAL hPbuffer as DWORD, BYVAL hDc as DWORD ) AS DWORD

DECLARE FUNCTION prototype_wglDestroyPbufferARB( BYVAL hPbuffer as DWORD ) AS BYTE

DECLARE FUNCTION prototype_wglQueryPbufferARB( BYVAL hPbuffer as DWORD, BYVAL iAttribute AS LONG, BYVAL piValue AS DWORD ) AS BYTE


Then you just need set of handles to those functions:

GLOBAL PwglCreatePbufferARB, PwglGetPbufferDCARB, PwglReleasePbufferDCARB, PwglDestroyPbufferARB, PwglQueryPbufferARB AS DWORD


And then you need to seek if those extensions are supported ( beware, case sensitive ! )

PwglCreatePbufferARB = wglGetProcAddress("wglCreatePbufferARB")
...


and finally call functions something like:

CALL DWORD PwglCreatePbufferARB USING prototype_wglCreatePbufferARB( ... )


I must say Eros made this much easier in thinBASIC, where you can set address to function declaration and no need for CALL DWORD fun. In PB could be calls encapsulated in MACRO like that:

MACRO wglCreatePbufferARB( hDc, iPixelFormat, iWidth, iHeight, piAttribList)
  CALL DWORD ...
END MACRO


But those are just quick thoughts, I had no time to test whether it really works, so be careful :)


Bye,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

José Roca

#254
 
Untested. Hope they work.


FUNCTION wglCreatePbufferARB( _
   BYVAL hDc AS DWORD, _
   BYVAL iPixelFormat AS LONG, _
   BYVAL iWidth AS LONG, _
   BYVAL iHeight AS LONG, _
   BYREF piAttribList AS LONG _
   ) AS DWORD

   LOCAL dwRes AS DWORD
   LOCAL pProc AS DWORD

   pProc = wglGetProcAddress("wglCreatePbufferARB")
   IF pProc = %NULL THEN EXIT FUNCTION
   CALL DWORD pProc USING wglCreatePbufferARB(hDc, iPixelFormat, iWidth, iHeight, piAttribList) TO dwRes
   FUNCTION = dwRes

END FUNCTION

FUNCTION wglGetPbufferDCARB (BYVAL hPbuffer AS DWORD) AS DWORD

   LOCAL dwRes AS DWORD
   LOCAL pProc AS DWORD

   pProc = wglGetProcAddress("wglGetPbufferDCARB")
   IF pProc = %NULL THEN EXIT FUNCTION
   CALL DWORD pProc USING wglGetPbufferDCARB(hPbuffer) TO dwRes
   FUNCTION = dwRes

END FUNCTION

FUNCTION wglReleasePbufferDCARB (BYVAL hPbuffer AS DWORD, BYVAL hDc AS DWORD) AS LONG

   LOCAL lRes AS LONG
   LOCAL pProc AS DWORD

   pProc = wglGetProcAddress("wglReleasePbufferDCARB")
   IF pProc = %NULL THEN EXIT FUNCTION
   CALL DWORD pProc USING wglReleasePbufferDCARB(hPbuffer, hDc) TO lRes
   FUNCTION = lRes

END FUNCTION

FUNCTION wglDestroyPbufferARB (BYVAL hPbuffer AS DWORD) AS LONG

   LOCAL lRes AS LONG
   LOCAL pProc AS DWORD

   pProc = wglGetProcAddress("wglDestroyPbufferARB")
   IF pProc = %NULL THEN EXIT FUNCTION
   CALL DWORD pProc USING wglDestroyPbufferARB(hPbuffer) TO lRes
   FUNCTION = lRes

END FUNCTION

FUNCTION wglQueryPbufferARB ( _
   BYVAL hPbuffer AS DWORD, _
   BYVAL iAttribute AS LONG, _
   BYREF piValue AS LONG _
   ) AS LONG

   LOCAL lRes AS LONG
   LOCAL pProc AS DWORD

   pProc = wglGetProcAddress("wglQueryPbufferARB")
   IF pProc = %NULL THEN EXIT FUNCTION
   CALL DWORD pProc USING wglQueryPbufferARB(hPbuffer, iAttribute, piValue) TO lRes
   FUNCTION = lRes

END FUNCTION