Author Topic: OpenB3D and Freebasic  (Read 3866 times)

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
OpenB3D and Freebasic
« on: May 31, 2013, 03:35:06 pm »
Hi, has anyone experience with this library? I thought, I have seen a video on youtube from our member DJLinux ...
I actually succeeded in compiling it for 32 bit Linux, I'll try for 64 bit Linux at home this weekend. Of course my plans are coding a wrapper so I can use it with Freepascal. But before that I should know a few things more about the internals. Does it have it's own windowing system or does it use the Freebasic one? (If so, I'll need to program a workaround with SDL). What about texture loading? Etc.
« Last Edit: May 31, 2013, 04:14:00 pm by Cybermonkey »

Mopz

  • Guest
Re: OpenB3D and Freebasic
« Reply #1 on: May 31, 2013, 03:58:36 pm »
Couldn't find much information about this one.

I'd love to get my hands on a very simple wrapper for opengl myself while developing a naalaa extension. I only know the really old OpenGL 1.1 stuff, which means 98% of what I know has been deprecated for ages. I'd be happy if I found a layer library that simulates the behavior of old OpenGL without using any of the deprecated functions. Because I just don't have the time doing everything from scratch. Nor am I interested in using a "game engine", because that stuff I want to do myself. In this case FreeGLUT could hopefully still be used for windowing.
« Last Edit: May 31, 2013, 04:02:20 pm by Mopz »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #2 on: May 31, 2013, 04:15:15 pm »
Well, this Openb3d is somewhat compatible to the BlitzBasic3d API.

Mopz

  • Guest
Re: OpenB3D and Freebasic
« Reply #3 on: May 31, 2013, 04:35:09 pm »
I can see how it'd be possible to use CD in combination with IUP to make a Linux version of NaaLaa. But as an OpenGL wrapper I don't think it'd help me much. But that's just my thought after a quick glance at CD.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #4 on: June 01, 2013, 04:56:57 pm »
Well, anyway, I started porting the library wrapper (a.k.a. Unit in Pascal  ;)) to Freepascal. I was right with my assumption that one needs an extra windowing manager. I actually use SDL in this example but FreeGLUT might be a better alternative.
Code: [Select]
program test;

uses openb3d,crt,sdl;

var worldlight,camera,cube:pointer;
userkey:CHAR;
screen:pSDL_SURFACE;

begin
SDL_INIT(SDL_INIT_VIDEO);

SDL_GL_SETATTRIBUTE(SDL_GL_RED_SIZE, 5);
SDL_GL_SETATTRIBUTE(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SETATTRIBUTE(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SETATTRIBUTE(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SETATTRIBUTE(SDL_GL_DOUBLEBUFFER, 1);

screen:=SDL_SETVIDEOMODE(640, 480, 0, SDL_OPENGL);
IF screen=NIL THEN HALT;

graphics3d (640,480,0);

worldlight:=createlight();
cube :=createcube();
MoveEntity (Cube,2.5,0,5);
EntityColor (Cube,20,100,40);
camera:=createcamera();



REPEAT
SDL_DELAY(50);

UpdateWorld();
RenderWorld();

SDL_GL_SWAPBUFFERS;
UNTIL keypressed;

SDL_QUIT;
end.

See the screenshot for the result ...

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #5 on: June 02, 2013, 08:49:35 pm »
Just finished the port of the wrapper. So far everything seems to work. I hope I can post a binary example here, soon. Meanwhile have a look at the screenshot.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #6 on: June 02, 2013, 09:18:41 pm »
Okay, a win32 binary. Enjoy and rotate the cube with a,s,d,q,w,e

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #7 on: June 04, 2013, 08:39:39 am »
Dear Mopz!! and DJLinux this thread is about OpenB3D and not OpenGL 1,2,3,... Would you be so kind, Marcus, to open a new thread for your questions?

Mopz

  • Guest
Re: OpenB3D and Freebasic
« Reply #8 on: June 04, 2013, 03:25:24 pm »
Sorry  :) I removed the unrelated posts and will start a new thread  :)
« Last Edit: June 04, 2013, 03:42:09 pm by Mopz »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: OpenB3D and Freebasic
« Reply #9 on: June 10, 2013, 02:35:33 pm »
I decided to go use SDL instead of GLUT. It is rather easy to open an OpenGL context with SDL and for input (keyboard, mouse etc.) I can use my existing code from the egslengine. So stay tuned, I hope I can show you something more impressive the next few days.