MiniB3d for FreeBasic

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Nov 27, 2017 22:11

In shadow.cpp, the line is supposed to be:

float ShadowObject::light_x, ShadowObject::light_y, ShadowObject::light_z;


where did you get that code? It looks like an attempt to expand the source code into the more verbose form, forgetting to change one character. But the code I have is not in that form, have you downloaded it from sourceforge? And are you sure you haven't replaced or modified any file?
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Nov 28, 2017 2:08

Yes you are right isn't in the latest donload so must be modified by me.
Sorry for the mistake.

Joshy
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 16, 2018 23:21

Ok, new version is online. In this version, some bugs have been fixed, and the code in the shader part has been cleaned a bit. Instead of adding further new features, this time I preferred to introduce a new helper library, named OB3D Plus. The reason is that most of the new features rely on shaders, and until now, I always tried to keep OpenB3D compatible even with older hardware that provided no shader support.

I didn't like to either have to drop support for some hardware, or to keep OpenB3D back, so I preferred to put the new features in a separate library, with different hardware requirements.

The features of OB3D Plus include: High Dynamic Range, Screen Space Ambient Occlusion, Material Capture, Fur Shading, simple Deferred Rendering, Interior Mapping, and more. Also, it allows to save videos of the rendering.
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 21, 2018 10:56

gluBuild2DMipmaps() supports GL_TEXTURE_2D but not GL_TEXTURE_CUBE_MAP_XYZ

Code: Select all

switch(i){
case 0:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 1:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 2:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 3:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 4:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 5:
  gluBuild2DMipmaps(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_RGBA,tex->width, tex->height, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
}
Do you mean this ?

Code: Select all

switch(i){
case 0:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0,  GL_RGBA,tex->width, tex->height, 0,  GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 1:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0,  GL_RGBA,tex->width, tex->height, 0,  GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 2:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0,  GL_RGBA,tex->width, tex->height,  0, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 3:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0,  GL_RGBA,tex->width, tex->height, 0,  GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 4:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0,  GL_RGBA,tex->width, tex->height, 0,  GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
case 5:
  glTexImage2D(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,  0, GL_RGBA,tex->width, tex->height,  0, GL_RGBA, GL_UNSIGNED_BYTE, dstbuffer);
  break;
}
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 28, 2018 10:24

D.J.Peters wrote:gluBuild2DMipmaps() supports GL_TEXTURE_2D but not GL_TEXTURE_CUBE_MAP_XYZ


It depends on the version. It is not guaranteed to support cubemap textures... but using your code, mipmapping would be lost. True, that could be fixed by using glGenerateMipmap, but that command is not supported on older version of OpenGL (still provided with some Windows PC)
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 28, 2018 11:19

Only for fun I compiled last version 1.25 looks like you never compiled it for 64bit.

I told you before "near" and "far" in lower case are reserved keywords of C++ 64-bit.

So you have to rename it all I self prefer fNear and fFar.

I know the source code of gluBuild2DMipmaps all other targets as GL_TEXTURE_2D and GLU_TEXTURE_2D makes no sense.

How ever I removed the glu dependencies GL_LINEAR_MIPMAP_LINEAR does a good job for the Cube maps also
you need only to set (GL_GENERATE_MIPMAP, GL_TRUE) also.

Yes I don't use glGenerateMipmap it's OpenGL 3.0 only and OpenGL ES

For the OpenGL wrangler there is no need for:

#ifdef win32
#ifdef linux
#ifdef MAC
...
all works here with #include <GLee.h> and flags: -i "GL" -l GLee
(of course on MAC -i "GL" isn't needed)

But why should I told you more if you ignore it all ;-)

Joshy
Last edited by D.J.Peters on Apr 28, 2018 13:48, edited 1 time in total.
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 28, 2018 13:17

I forgot that part (since I have a 32 bit system).... the issue with "near" and "far" was just in the file octree.cpp, or in others, too?
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 28, 2018 14:45

Your lib isn't OpenGL 2.x compatible at all.

You never test users OpenGL version but this is the primary feature
of all this Extension Wrangler Libraries like glLee, GLEW

For example If you link to GLee or used prototypes from glext.h on Linux it does not mean
that all commands do you use to compile time on your box are available on users machine also.

Looks like you use the OpenGL wrangler and extension stuff only
to have lesser work to load extensions manually.

On a OpenGL 2.1 only box a call to glFramebufferRenderbuffer will crash the application
glFramebufferRenderbuffer is only a var and it's value is NULL thru runtime.
be course glFramebufferRenderbuffer need OpenGL 3.0 or a higher version.

Your code is a 95% OpenGL 1.7 legacy 3D engine with OpenGL 2.0 shaders
but that needs OpenGL 3.0 for the frame buffer object !

Irrlicht and Ogre checks the OpenGL version thru runtime and select the supported features or used a fallback.
Horde 3D needs only OpenGL 2.0 for it's beautiful render pipeline.

Is there any point why you ignore the OpenGL version on the target machine ?

Joshy
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 28, 2018 15:28

D.J.Peters wrote:Is there any point why you ignore the OpenGL version on the target machine ?

Joshy


I started working on this library almost 10 years ago, and in all this time, this is the first time I receive such a complaint. The same applies to the issue you described with cube mapping, actually... you seem to be the first one who has encountered it.

The OpenGL version is tested, when the library is initialized, to determine whether use VBO or not, but nothing else. Anyway, the reason I don't test for version is: what would the library be supposed to do, if a feature is not available? Stop with an error message? It wouldn't be much more useful, because the final result would be the same: the software won't work unless a newer version of OpenGL is provided.
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 28, 2018 19:22

D.J.Peters wrote:I told you before "near" and "far" in lower case are reserved keywords of C++ 64-bit.


Which compiler? And what are they supposed to do? Because as far as I can find, they were reserved keywords in 16 bit model, not in 32, nor in 64.
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 28, 2018 20:41

g++ 5.2.0
g++.exe -O2 -Wall -s -DNDEBUG -m64 -DBUILD_DLL -DWIN32 -DWIN64 -I..\libOpenB3D-1.25-src -Isrc -c D:\CodeBlocks\joshy\libOpenB3D-1.25-src\src\functions.cpp -o obj\win64\dll\src\functions.o
In file included from D:\CodeBlocks\joshy\libOpenB3D-1.25-src\src\functions.cpp:17:0:
D:\CodeBlocks\joshy\libOpenB3D-1.25-src\src\octree.h:16:12: error: expected unqualified-id before ',' token
float near, far;
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 28, 2018 21:06

There are more problems for example the callbacks in the *.bi file are wrong declared

if you write:
declare function blabla as alias "blabla" cdecl (callback as sub (blabla) )

That means your C cdecl function calls a stdcall callback sub and it will crash.

The C lib as caller of the callback restores the stack frame and the callback it self stdcall will restore the stack frame also !

You can fix it like this:

declare a function blabla as alias "blabla" cdecl (callback as sub cdecl (blabla) )

But alias "blabla" and two times cdecl are not needed if you enclose all declares in a ectern "C" block

extern "C"
declare a function blabla (callback as sub(blabla) )
end extern

Or you have to define the callbacks in the C/C++ code as "_stdcall" .

Joshy

Code: Select all

extern "C"

declare function Graphics3D(byval width as integer, byval height as integer, byval unused1 as integer=0, byval unused2 as integer=0, byval unused3 as integer=0) as integer
declare function AmbientLight(byval r as single, byval g as single, byval b as single) as integer
declare function AntiAlias(byval samples as integer) as integer
declare function RenderWorld () as integer

declare function BackBufferToTex (byval tex as any ptr, byval frame as integer=0) as integer
declare function BufferToTex (byval tex as any ptr, byval buffer as any ptr, byval frame as integer=0) as integer
declare function CameraToTex (byval tex as any ptr, byval cam as any ptr, byval frame as integer=0) as integer
declare function TexToBuffer (byval tex as any ptr, byval buffer as any ptr, byval frame as integer) as integer
declare sub      DepthBufferToTex (byval tex as any ptr, byval cam as any ptr=0)

declare function ClearWorld (byval entities as integer=1, byval brushes as integer=1, byval textures as integer=1) as integer
declare sub ClearCollisions ()
declare function Collisions (byval src_no as integer, byval dest_no as integer, byval method_no as integer, byval response_no as integer=0) as integer

declare function MeshCullRadius (byval ent as any ptr, byval radius as single) as integer
declare function AddAnimSeq (byval ent as any ptr, byval length as integer) as integer
declare function Animate (byval ent as any ptr, byval mode as integer=1, byval speed as single=1, byval seq as integer=0, byval trans as integer=0) as integer
declare function Animating (byval ent as any ptr) as integer
declare function AnimLength (byval ent as any ptr) as integer
declare function AnimSeq (byval ent as any ptr) as integer
declare function AnimTime (byval ent as any ptr) as single
declare function AddMesh (byval mesh1 as any ptr, byval mesh2 as any ptr) as any ptr
declare function AddTriangle (byval surf as any ptr, byval v0 as integer, byval v1 as integer, byval v2 as integer) as integer
declare function AddVertex (byval surf as any ptr, byval x as single, byval y as single, byval z as single, byval u as single=0, byval v as single=0, byval w as single=0) as integer
declare function BrushAlpha (byval brush as any ptr, byval a as single) as integer
declare function BrushBlend (byval brush as any ptr, byval blend as integer) as integer
declare function BrushColor (byval brush as any ptr, byval r as single, byval g as single, byval b as single) as integer
declare function BrushFX    (byval brush as any ptr, byval fx as integer) as integer
declare function BrushShininess (byval brush as any ptr, byval s as single) as integer
declare function BrushTexture (byval brush as any ptr, byval tex as any ptr, byval frame as integer=0, byval index as integer=0) as integer
declare function CameraClsColor (byval cam as any ptr, byval r as single, byval g as single, byval b as single) as integer
declare function CameraClsMode (byval cam as any ptr, byval cls_depth as integer, byval cls_zbuffer as integer) as integer
declare function CameraFogColor (byval cam as any ptr, byval r as single, byval g as single, byval b as single) as integer
declare function CameraFogMode (byval cam as any ptr, byval mode as integer) as integer
declare function CameraFogRange (byval cam as any ptr, byval nnear as single, byval nfar as single) as integer
declare function CameraPick (byval cam as any ptr, byval x as single, byval y as single) as any ptr
declare function CameraProject (byval cam as any ptr, byval x as single, byval y as single, byval z as single) as integer
declare function CameraProjMode (byval cam as any ptr, byval mode as integer) as integer
declare function CameraRange (byval cam as any ptr, byval nnear as single, byval nfar as single) as integer
declare function CameraViewport (byval cam as any ptr, byval x as integer, byval y as integer, byval width as integer, byval height as integer) as integer
declare function CameraZoom (byval cam as any ptr, byval zoom as single) as integer
declare function ClearSurface (byval surf as any ptr, byval clear_verts as integer=1, byval clear_tris as integer=1) as integer
declare function ClearTextureFilters () as integer
declare function CollisionEntity (byval ent as any ptr, byval index as integer) as any ptr
declare function CollisionNX (byval ent as any ptr, byval index as integer) as single
declare function CollisionNY (byval ent as any ptr, byval index as integer) as single
declare function CollisionNZ (byval ent as any ptr, byval index as integer) as single
declare function CollisionSurface (byval ent as any ptr, byval index as integer) as any ptr
declare function CollisionTime (byval ent as any ptr, byval index as integer) as single
declare function CollisionTriangle (byval ent as any ptr, byval index as integer) as integer
declare function CollisionX (byval ent as any ptr, byval index as integer) as single
declare function CollisionY (byval ent as any ptr, byval index as integer) as single
declare function CollisionZ (byval ent as any ptr, byval index as integer) as single
declare function CountChildren (byval ent as any ptr) as integer
declare function CountCollisions (byval ent as any ptr) as integer
declare function CopyEntity (byval ent as any ptr, byval parent as any ptr=0) as any ptr
declare function CopyMesh (byval mesh as any ptr, byval parent as any ptr=0) as any ptr
declare function CountSurfaces (byval mesh as any ptr) as integer
declare function CountTriangles (byval surf as any ptr) as integer
declare function CountVertices (byval surf as any ptr) as integer
declare function CreateBlob (byval fluid as any ptr, byval radius as single, byval parent as any ptr=0) as any ptr
declare function CreateBone (byval mesh as any ptr, byval parent as any ptr=0) as any ptr
declare function CreateBrush (byval r as single=255, byval g as single=255, byval b as single=255) as any ptr
declare function CreateCamera (byval parent as any ptr=0) as any ptr
declare function CreateConstraint (byval p1 as any ptr, byval p2 as any ptr, byval l as single) as any ptr
declare function CreateCone (byval segments as integer=8, byval solid as integer=1, byval parent as any ptr=0) as any ptr
declare function CreateCylinder (byval segments as integer=8, byval solid as integer=1, byval parent as any ptr=0) as any ptr
declare function CreateCube (byval parent as any ptr=0) as any ptr
declare function CreateFluid () as any ptr
declare function CreateGeosphere (byval size as integer, byval parent as any ptr=0) as any ptr
declare function CreateMesh (byval parent as any ptr=0) as any ptr
declare function CreateLight (byval light_type as integer=1, byval parent as any ptr=0) as any ptr
declare function CreateOcTree (byval w as single, byval h as single, byval d as single, byval parent_ent as any ptr=0) as any ptr
declare function CreatePivot (byval parent as any ptr=0) as any ptr
declare function CreatePlane (byval Divisions as integer=1, byval parent as any ptr=0) as any ptr
declare function CreateQuad (byval parent as any ptr=0) as any ptr
declare function CreateRigidBody (byval body as any ptr, byval p1 as any ptr, byval p2 as any ptr, byval p3 as any ptr, byval p4 as any ptr) as any ptr
declare function CreateShadow (byval parent as any ptr, byval Static as integer=0) as any ptr
declare function CreateSphere (byval segments as integer=8, byval parent as any ptr=0) as any ptr
declare function CreateSprite (byval parent as any ptr=0) as any ptr
declare function CreateSurface (byval mesh as any ptr, byval brush as any ptr=0) as any ptr
declare function CreateStencil () as any ptr
declare function CreateTerrain (byval size as integer, byval parent as any ptr=0) as any ptr
declare function CreateTexture (byval width as integer, byval height as integer, byval flags as integer=1, byval frames as integer=1) as any ptr
declare function DeltaPitch (byval ent1 as any ptr, byval ent2 as any ptr) as single
declare function DeltaYaw (byval ent1 as any ptr, byval ent2 as any ptr) as single
declare function EntityAlpha (byval ent as any ptr, byval alpha as single) as integer
declare function EntityAutoFade (byval ent as any ptr, byval near as single, byval far as single) as integer
declare function EntityBlend (byval ent as any ptr, byval blend as integer) as integer
declare function EntityBox (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval w as single, byval h as single, byval d as single) as integer
declare function EntityClass (byval ent as any ptr) as zstring ptr
declare function EntityCollided (byval ent as any ptr, byval type_no as integer) as any ptr
declare function EntityColor (byval ent as any ptr, byval red as single, byval green as single, byval blue as single) as integer
declare function EntityDistance (byval ent1 as any ptr, byval ent2 as any ptr) as single
declare function EntityFX (byval ent as any ptr, byval fx as integer) as integer
declare function EntityInView (byval ent as any ptr, byval cam as any ptr) as integer
declare function EntityName (byval ent as any ptr) as zstring ptr
declare function EntityOrder (byval ent as any ptr, byval order as integer) as integer
declare function EntityParent (byval ent as any ptr, byval parent_ent as any ptr, byval glob as integer=1) as integer
declare function EntityPick (byval ent as any ptr, byval range as single) as any ptr
declare function EntityPickMode (byval ent as any ptr, byval pick_mode as integer, byval obscurer as integer=1) as integer
declare function EntityPitch (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityRadius (byval ent as any ptr, byval radius_x as single, byval radius_y as single=0) as integer
declare function EntityRoll (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityShininess (byval ent as any ptr, byval shine as single) as integer
declare function EntityTexture (byval ent as any ptr, byval tex as any ptr, byval frame as integer=0, byval index as integer=0) as integer
declare function EntityType (byval ent as any ptr, byval type_no as integer, byval recursive as integer=0) as integer
declare function EntityVisible (byval src_ent as any ptr, byval dest_ent as any ptr) as integer
declare function EntityX (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityY (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityYaw (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityZ (byval ent as any ptr, byval glob as integer=0) as single
declare function ExtractAnimSeq (byval ent as any ptr, byval first_frame as integer, byval last_frame as integer, byval seq as integer=0) as integer
declare function FindChild (byval ent as any ptr, byval child_name as zstring ptr) as any ptr
declare function FindSurface (byval mesh as any ptr, byval brush as any ptr) as any ptr
declare function FitMesh (byval mesh as any ptr, byval x as single, byval y as single, byval z as single, byval width as single, byval height as single, byval depth as single, byval uniform as integer=0) as any ptr
declare function FlipMesh (byval mesh as any ptr) as any ptr
declare sub      FluidArray (byval fluid as any ptr, byval array as single ptr, byval w as integer, byval h as integer, byval d as integer)
declare sub      FluidFunction (byval fluid as any ptr, byval ScalarField as Function(byval x as single, byval y as single, byval z as single) as single)
declare sub      FluidThreshold (byval fluid as any ptr, byval threshold as single)
declare function FreeBrush (byval brush as any ptr) as integer
declare function FreeConstraint (byval body as any ptr) as any ptr
declare function FreeEntity (byval ent as any ptr) as integer
declare function FreeRigidBody (byval body as any ptr) as any ptr
declare function FreeShadow (byval parent as any ptr) as any ptr
declare function FreeTexture (byval tex as any ptr) as integer
declare function GeosphereHeight (byval geo as any ptr, byval h as single) as integer
declare function GetBrushTexture (byval brush as any ptr, byval index as integer=0) as any ptr
declare function GetChild (byval ent as any ptr, byval child_no as integer) as any ptr
declare function GetEntityBrush (byval ent as any ptr) as any ptr
declare function GetEntityType (byval ent as any ptr) as integer
declare function GetMatElement (byval ent as any ptr, byval row as integer, byval col as integer) as single
declare function GetParentEntity (byval ent as any ptr) as any ptr
declare function GetSurface (byval mesh as any ptr, byval surf_no as integer) as any ptr
declare function GetSurfaceBrush (byval surf as any ptr) as any ptr
declare function HandleSprite (byval sprite as any ptr, byval h_x as single, byval h_y as single) as integer
declare function HideEntity (byval ent as any ptr) as integer
declare function InstanceMesh (byval mesh as any ptr, byval parent as any ptr=0) as any ptr
declare function LightColor (byval light as any ptr, byval red as single, byval green as single, byval blue as single) as integer
declare function LightConeAngles (byval light as any ptr, byval inner_ang as single, byval outer_ang as single) as integer
declare function LightRange (byval light as any ptr, byval range as single) as integer
declare function LinePick (byval x as single, byval y as single, byval z as single, byval dx as single, byval dy as single, byval dz as single, byval radius as single=0) as any ptr
declare function LoadAnimMesh (byval file as zstring ptr, byval parent as any ptr=0) as any ptr
declare function LoadAnimSeq (byval ent as any ptr, byval name as zstring ptr) as integer
declare function LoadAnimTexture (byval file as zstring ptr, byval flags as integer, byval frame_width as integer, byval frame_height as integer, byval first_frame as integer, byval frame_count as integer) as any ptr
declare function LoadBrush (byval file as zstring ptr, byval flags as integer=1, byval u_scale as single=1, byval v_scale as single=1) as any ptr
declare function LoadGeosphere (byval file as zstring ptr, byval parent as any ptr=0) as any ptr
declare function LoadMesh (byval file as zstring ptr, byval parent as any ptr=0) as any ptr
declare function LoadTerrain (byval file as zstring ptr, byval parent as any ptr=0) as any ptr
declare function LoadTexture (byval file as zstring ptr, byval flags as integer=1) as any ptr
declare function LoadSprite (byval tex_file as zstring ptr, byval tex_flag as integer=1, byval parent as any ptr=0) as any ptr
declare function MeshCSG (byval m1 as any ptr, byval m2 as any ptr, byval method as integer=1) as any ptr
declare function MeshesIntersect (byval mesh1 as any ptr, byval mesh2 as any ptr) as any ptr
declare function MeshWidth  (byval mesh as any ptr) as single
declare function MeshHeight (byval mesh as any ptr) as single
declare function MeshDepth  (byval mesh as any ptr) as single
declare function ModifyGeosphere (byval geo as any ptr, byval x as integer, byval z as integer, byval height as single) as any ptr
declare function ModifyTerrain (byval terr as any ptr, byval x as integer, byval z as integer, byval height as single) as any ptr
declare function MoveEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single) as integer
declare function NameEntity (byval ent as any ptr, byval name as zstring ptr) as integer
declare sub      OctreeMesh (byval octree as any ptr, byval mesh as any ptr, byval level as integer, byval x as single, byval y as single, byval z as single, byval near as single=0, byval far as single=1000)
declare sub      OctreeBlock (byval octree as any ptr, byval mesh as any ptr, byval level as integer, byval x as single, byval y as single, byval z as single, byval near as single=0, byval far as single=1000)
declare function PaintEntity (byval ent as any ptr, byval brush as any ptr) as integer
declare function PaintMesh (byval mesh as any ptr, byval brush as any ptr) as any ptr
declare function PaintSurface (byval surf as any ptr, byval brush as any ptr) as integer
declare function ParticleColor (byval sprite as any ptr, byval r as single, byval g as single, byval b as single, byval a as single=0) as integer
declare function ParticleVector (byval sprite as any ptr, byval x as single, byval y as single, byval z as single) as integer
declare function ParticleTrail (byval sprite as any ptr, byval length as integer) as integer
declare function PickedEntity () as any ptr
declare function PickedNX () as single
declare function PickedNY () as single
declare function PickedNZ () as single
declare function PickedSurface () as any ptr
declare function PickedTime () as single
declare function PickedTriangle () as integer
declare function PickedX () as single
declare function PickedY () as single
declare function PickedZ () as single
declare function PointEntity (byval ent as any ptr, byval target_ent as any ptr, byval roll as single=0) as integer
declare function PositionEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval glob as integer=0) as integer
declare function PositionMesh (byval mesh as any ptr, byval px as single, byval py as single, byval pz as single) as integer
declare function PositionTexture (byval tex as any ptr, byval u_pos as single, byval v_pos as single) as integer
declare function ProjectedX () as single
declare function ProjectedY () as single
declare function ProjectedZ () as single
declare function RepeatMesh (byval mesh as any ptr, byval parent as any ptr=0) as any ptr
declare function ResetEntity (byval ent as any ptr) as integer
declare function RotateEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval glob as integer=0) as integer
declare function RotateMesh (byval mesh as any ptr, byval pitch as single, byval yaw as single, byval roll as single) as any ptr
declare function RotateSprite (byval sprite as any ptr, byval ang as single) as integer
declare function RotateTexture (byval tex as any ptr, byval ang as single) as integer
declare function ScaleEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval glob as integer=0) as integer
declare function ScaleMesh (byval mesh as any ptr, byval sx as single, byval sy as single, byval sz as single) as integer
declare function ScaleSprite (byval sprite as any ptr, byval s_x as single, byval s_y as single) as integer
declare function ScaleTexture (byval tex as any ptr, byval u_scale as single, byval v_scale as single) as integer
declare function SetAnimKey (byval ent as any ptr, byval frame as single, byval pos_key as integer=1, byval rot_key as integer=1, byval scale_key as integer=1) as integer
declare function SetAnimTime (byval ent as any ptr, byval time as single, byval seq as integer=0) as integer
declare function SetCubeFace (byval tex as any ptr, byval face as integer) as integer
declare function SetCubeMode (byval tex as any ptr, byval mode as integer) as integer
declare function ShowEntity (byval ent as any ptr) as integer
declare sub      SkinMesh (byval mesh as any ptr, byval surf_no as integer, byval vid as integer, byval bone1 as integer, byval weight1 as single=1.0, byval bone2 as integer=0, byval weight2 as single=0, byval bone3 as integer=0, byval weight3 as single=0, byval bone4 as integer=0, byval weight4 as single=0)
declare function SpriteRenderMode (byval sprite as any ptr, byval mode as integer) as integer
declare function SpriteViewMode (byval sprite as any ptr, byval mode as integer) as integer
declare function StencilAlpha (byval stencil as any ptr, byval a as single) as integer
declare function StencilClsColor (byval stencil as any ptr, byval r as single, byval g as single, byval b as single) as integer
declare function StencilClsMode (byval stencil as any ptr, byval cls_depth as integer, byval cls_zbuffer as integer) as integer
declare function StencilMesh (byval stencil as any ptr, byval mesh as any ptr, byval mode as integer=1) as integer
declare function StencilMode (byval stencil as any ptr, byval m as integer, byval o as integer=1) as integer
declare function TextureBlend (byval tex as any ptr, byval blend as integer) as integer
declare function TextureCoords (byval tex as any ptr, byval coords as integer) as integer
declare function TextureHeight (byval tex as any ptr) as integer
declare function TextureFilter (byval match_text as zstring ptr, byval flags as integer) as integer
declare function TextureName (byval tex as any ptr) as zstring ptr
declare function TerrainHeight (byval terr as any ptr, byval x as integer, byval z as integer) as single
declare function TerrainX (byval terr as any ptr, byval x as single, byval y as single, byval z as single) as single
declare function TerrainY (byval terr as any ptr, byval x as single, byval y as single, byval z as single) as single
declare function TerrainZ (byval terr as any ptr, byval x as single, byval y as single, byval z as single) as single
declare function TextureWidth (byval tex as any ptr) as integer
declare function TFormedX () as single
declare function TFormedY () as single
declare function TFormedZ () as single
declare function TFormNormal (byval x as single, byval y as single, byval z as single, byval src_ent as any ptr, byval dest_ent as any ptr) as integer
declare function TFormPoint (byval x as single, byval y as single, byval z as single, byval src_ent as any ptr, byval dest_ent as any ptr) as integer
declare function TFormVector (byval x as single, byval y as single, byval z as single, byval src_ent as any ptr, byval dest_ent as any ptr) as integer
declare function TranslateEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval glob as integer=0) as integer
declare function TriangleVertex (byval surf as any ptr, byval tri_no as integer, byval corner as integer) as integer
declare function TurnEntity (byval ent as any ptr, byval x as single, byval y as single, byval z as single, byval glob as integer=0) as integer
declare function UpdateNormals (byval mesh as any ptr) as integer
declare function UpdateTexCoords (byval surf as any ptr) as integer
declare function UpdateWorld (byval anim_speed as single=1) as integer
declare function UseStencil (byval stencil as any ptr) as integer
declare function VectorPitch (byval vx as single, byval vy as single, byval vz as single) as single
declare function VectorYaw (byval vx as single, byval vy as single, byval vz as single) as single
declare function VertexAlpha (byval surf as any ptr, byval vid as integer) as single
declare function VertexBlue (byval surf as any ptr, byval vid as integer) as single
declare function VertexColor (byval surf as any ptr, byval vid as integer, byval r as single, byval g as single, byval b as single, byval a as single=1) as integer
declare sub      VertexCoords (byval surf as any ptr, byval vid as integer, byval x as single, byval y as single, byval z as single)
declare function VertexGreen (byval surf as any ptr, byval vid as integer) as single
declare function VertexNormal (byval surf as any ptr, byval vid as integer, byval nx as single, byval ny as single, byval nz as single) as integer
declare function VertexNX (byval surf as any ptr, byval vid as integer) as single
declare function VertexNY (byval surf as any ptr, byval vid as integer) as single
declare function VertexNZ (byval surf as any ptr, byval vid as integer) as single

declare function VertexRed (byval surf as any ptr, byval vid as integer) as single
declare function VertexTexCoords (byval surf as any ptr, byval vid as integer, byval u as single, byval v as single, byval w as single=0, byval coord_set as integer=0) as integer
declare function VertexU (byval surf as any ptr, byval vid as integer, byval coord_set as integer=0) as single
declare function VertexV (byval surf as any ptr, byval vid as integer, byval coord_set as integer=0) as single
declare function VertexW (byval surf as any ptr, byval vid as integer, byval coord_set as integer=0) as single
declare function VertexX (byval surf as any ptr, byval vid as integer) as single
declare function VertexY (byval surf as any ptr, byval vid as integer) as single
declare function VertexZ (byval surf as any ptr, byval vid as integer) as single
declare function Wireframe (byval enable as integer) as integer
declare function EntityScaleX (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityScaleY (byval ent as any ptr, byval glob as integer=0) as single
declare function EntityScaleZ (byval ent as any ptr, byval glob as integer=0) as single

declare function LoadShader (byval ShaderName as zstring ptr, byval VFile as zstring ptr, byval FFile as zstring ptr) as any ptr
declare function CreateShader (byval shader as zstring ptr, byval VString as zstring ptr, byval FString as zstring ptr) as any ptr
declare function LoadShaderVGF (byval ShaderName as zstring ptr, byval VFile as zstring ptr, byval GFile as zstring ptr, byval FFile as zstring ptr) as any ptr
declare function CreateShaderVGF (byval shader as zstring ptr, byval VString as zstring ptr, byval GString as zstring ptr, byval FString as zstring ptr) as any ptr
declare sub ShadeMesh (byval mesh as any ptr, byval material as any ptr)
declare sub ShadeSurface (byval surf as any ptr, byval material as any ptr)
declare sub ShadeEntity (byval ent as any ptr, byval material as any ptr)
declare sub ShaderTexture (byval material as any ptr, byval tex as any ptr, byval name as zstring ptr, byval index as integer=0)

declare sub SetFloat (byval material as any ptr, byval name as zstring ptr, byval v1 as single)
declare sub SetFloat2 (byval material as any ptr, byval name as zstring ptr, byval v1 as single, byval v2 as single)
declare sub SetFloat3 (byval material as any ptr, byval name as zstring ptr, byval v1 as single, byval v2 as single, byval v3 as single)
declare sub SetFloat4 (byval material as any ptr, byval name as zstring ptr, byval v1 as single, byval v2 as single, byval v3 as single, byval v4 as single)
declare sub UseFloat (byval material as any ptr, byval name as zstring ptr, byref v1 as single)
declare sub UseFloat2 (byval material as any ptr, byval name as zstring ptr, byref v1 as single, byref v2 as single)
declare sub UseFloat3 (byval material as any ptr, byval name as zstring ptr, byref v1 as single, byref v2 as single, byref v3 as single)
declare sub UseFloat4 (byval material as any ptr, byval name as zstring ptr, byref v1 as single, byref v2 as single, byref v3 as single, byref v4 as single)
declare sub SetInteger (byval material as any ptr, byval name as zstring ptr, byval v1 as integer)
declare sub SetInteger2 (byval material as any ptr, byval name as zstring ptr, byval v1 as integer, byval v2 as integer)
declare sub SetInteger3 (byval material as any ptr, byval name as zstring ptr, byval v1 as integer, byval v2 as integer, byval v3 as integer)
declare sub SetInteger4 (byval material as any ptr, byval name as zstring ptr, byval v1 as integer, byval v2 as integer, byval v3 as integer, byval v4 as integer)
declare sub UseInteger (byval material as any ptr, byval name as zstring ptr, byref v1 as integer)
declare sub UseInteger2 (byval material as any ptr, byval name as zstring ptr, byref v1 as integer, byref v2 as integer)
declare sub UseInteger3 (byval material as any ptr, byval name as zstring ptr, byref v1 as integer, byref v2 as integer, byref v3 as integer)
declare sub UseInteger4 (byval material as any ptr, byval name as zstring ptr, byref v1 as integer, byref v2 as integer, byref v3 as integer, byref v4 as integer)
declare function LoadMaterial (byval file as zstring ptr, byval flags as integer, byval frame_width as integer, byval frame_height as integer, byval first_frame as integer, byval frame_count as integer) as any ptr
declare sub ShaderMaterial (byval material as any ptr, byval tex as any ptr, byval name as zstring ptr, byval index as integer=0)

declare sub UseSurface (byval material as any ptr, byval name as zstring ptr, byval surf as any ptr, byval vbo as integer)
declare sub UseMatrix (byval material as any ptr, byval name as zstring ptr, byval mode as integer)
declare sub UseEntity (byval material as any ptr, byval name as zstring ptr, byval ent as any ptr, byval mode as integer)
declare sub ShaderFunction (byval material as any ptr, byval FunctionEnable as sub, byval FunctionDisable as sub)

declare function CreateVoxelSprite (byval slices as integer=64, byval parent as any ptr=0) as any ptr
declare sub      VoxelSpriteMaterial (byval voxelspr as any ptr, byval mat as any ptr)

declare function CreateParticleEmitter (byval particle as any ptr, byval parent as any ptr=0) as any ptr
declare sub      EmitterVector (byval emit as any ptr, byval x as single, byval y as single, byval z as single)
declare sub      EmitterRate (byval emit as any ptr, byval r as single)
declare sub      EmitterVariance (byval emit as any ptr, byval v as single)
declare sub      EmitterParticleLife (byval emit as any ptr, byval l as integer)
declare sub      EmitterParticleSpeed (byval emit as any ptr, byval s as single)
declare sub      EmitterParticleFunction (byval emit as any ptr, byval EmitterFunction as Sub(byval ent as any ptr, byval life as integer))

declare function ActMoveBy (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActTurnBy (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActVector (byval ent as any ptr, byval a as single, byval b as single, byval c as single) as any ptr
declare function ActMoveTo (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActTurnTo (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActScaleTo (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActFadeTo (byval ent as any ptr, byval a as single, byval r as single) as any ptr
declare function ActTintBy (byval ent as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActTrackByPoint (byval ent as any ptr,  byval t as any ptr, byval a as single, byval b as single, byval c as single, byval r as single) as any ptr
declare function ActTrackByDistance (byval ent as any ptr,  byval t as any ptr, byval a as single, byval r as single) as any ptr
declare function ActNewtonian (byval ent as any ptr, byval r as single) as any ptr
declare sub      AppendAction (byval act1 as any ptr, byval act2 as any ptr)

declare function CreatePostFX (byval camera as any ptr, byval passes as integer=1) as any ptr
declare sub AddRenderTarget (byval fx as any ptr, byval pass_no as integer, byval numColBufs as integer, byval depth as integer, byval format as integer=8, byval scale as single=1.0)

declare sub PostFXShader (byval fx as any ptr, byval pass_no as integer, byval shader as any ptr)
declare sub PostFXShaderPass (byval fx as any ptr, byval pass_no as integer, byval name as zstring ptr, byval v as integer)
declare sub PostFXBuffer (byval fx as any ptr, byval pass_no as integer, byval source_pass as integer, byval index as integer, byval slot as integer)
declare sub PostFXTexture (byval fx as any ptr, byval pass_no as integer, byval tex as any ptr, byval slot as integer, byval frame as integer=0)
declare sub PostFXFunction (byval fx as any ptr, byval pass_no as integer, byval FxFunction as sub)

end extern
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 28, 2018 23:11

I just tried compiling on a 64 bit system, using gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) .

I had to add the -fPIC option to the compiler, in the makefile, but it compiled without any troubles related to "far" or "near" keywords. So I am unable to reproduce your problem (and, as I have told you, you are the only one who reported such an issue). Perhaps you have configured some strict setting on the compiler, that blocks any code that might be illegal on any possible system (although no one would ever try to compile OpenB3D on a 16 bit system, I hope).

I don't know what caused you that issue, but since you already know how to fix it, I don't think it requires a new version with the fix.


About the calling conventions: thank you for the hints, perhaps I will update the declare files. I do not recommend to use the stdcall calling convention in the library itself (although it would surely be possible), since that convention is typical of window, it is seldom used in other operating systems, so it should be avoided in a multi platform software.
D.J.Peters
Posts: 7478
Joined: May 28, 2005 3:28

Re: MiniB3d for FreeBasic

Postby D.J.Peters » Apr 29, 2018 8:18

Rename near, far in Near,Far and all C++ compilers are happy including MinGW, Borland, VisualStudio C++ and Intel C++.

Joshy
angros47
Posts: 1424
Joined: Jun 21, 2005 19:04

Re: MiniB3d for FreeBasic

Postby angros47 » Apr 29, 2018 10:18

I'll consider it for the next version. For the future, however, I plan not to add more features on OpenB3D, and instead to put them in other libraries. In current version I am testing the concept.

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests