LB Booster
« Using OpenGL in LBB »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 03:55am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Using OpenGL in LBB  (Read 615 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Using OpenGL in LBB
« Thread started on: Apr 14th, 2015, 11:50am »

Over at the LB Community Forum there's been some renewed interest in Rob's OpenGL demos here:

OpenGL 3D Graphics in Liberty BASIC

Please note that there's a bug in the 'OpenGL in LB.bas' framework which can cause it to crash in LBB. Specifically, in the SUB CreateBMPTexture the following line needs to be changed (in the gluBuild2DMipmaps call):

Was: Code:
      arr AS long ,_ 

Needs to be: Code:
      array AS long ,_ 

This also makes the STRUCT arr unnecessary. Why the original code seemed to work in LB4.04 I have no idea.

Richard.
User IP Logged

RobM
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 91
xx Re: Using OpenGL in LBB
« Reply #1 on: Apr 14th, 2015, 2:56pm »

Actually, the whole sub can be changed as below. There are a few calls in the original code that aren't necessary. I think you pointed this out when we were porting my program over to LBB :)

Code:
SUB CreateBMPTexture filename$ , texture
    call glBindTexture GL.TEXTURE.2D , texture
    OPEN "DevIL.dll" FOR dll AS #dev
    CALLDLL #dev , "ilInit" , ret AS long
    'CALLDLL #dev , "ilGenImages" , 1 AS long , ret AS long
    CALLDLL #dev , "ilBindImage" , 1 AS long , ret AS long
    CALLDLL #dev , "ilLoadImage" , filename$ AS ptr , ret AS long
    CALLDLL #dev , "ilConvertImage" , 6408 AS long , 5121 AS long , ret AS long
    CALLDLL #dev , "ilGetData" , array AS long
    'STRUCT arr , bitmaparray AS long
    'arr.bitmaparray.struct = array
    CALLDLL #dev , "ilGetInteger" , 3560 AS long , IL.IMAGE.BPP AS long
    CALLDLL #dev , "ilGetInteger" , 3556 AS long , IL.IMAGE.WIDTH AS long
    CALLDLL #dev , "ilGetInteger" , 3557 AS long , IL.IMAGE.HEIGHT AS long
    CALLDLL #dev , "ilGetInteger" , 3562 AS long , IL.IMAGE.FORMAT AS long
    'CALLDLL #gl , "glTexImage2D" , 3553 AS long , 0 AS long , IL.IMAGE.BPP AS long , IL.IMAGE.WIDTH AS long , IL.IMAGE.HEIGHT AS long , IL.IMAGE.FORMAT AS long , 5121 AS long , array AS long , ret AS long
    CALLDLL #glu , "gluBuild2DMipmaps" , 3553 AS long , 4 AS long , IL.IMAGE.WIDTH AS long , IL.IMAGE.HEIGHT AS long , 6408 AS long , 5121 AS long , array AS long , ret AS long
    CALLDLL #dev , "ilDeleteImages" , 1 AS long , ret AS long
    CLOSE #dev
END SUB
 
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Using OpenGL in LBB
« Reply #2 on: Apr 14th, 2015, 3:40pm »

on Apr 14th, 2015, 2:56pm, RobM wrote:
There are a few calls in the original code that aren't necessary.

Indeed, but I wanted to list the minimum change necessary for it to run without crashing. Leaving the 'superfluous' calls doesn't seem to do any obvious harm.

More importantly, are you able to correct the version available for download from the link at LBPE?

Richard.
User IP Logged

RobM
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 91
xx Re: Using OpenGL in LBB
« Reply #3 on: Apr 14th, 2015, 3:49pm »

on Apr 14th, 2015, 3:40pm, Richard Russell wrote:
More importantly, are you able to correct the version available for download from the link at LBPE?

Richard.


Not sure. I see that the current file was uploaded by Rod. I will have to see if I can figure it out.
User IP Logged

RobM
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 91
xx Re: Using OpenGL in LBB
« Reply #4 on: Apr 14th, 2015, 4:06pm »

Done! Took a few tries but I got it.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls