[Patch] Rendering of FreeBasic graphic on OpenGL

For other topics related to the FreeBASIC project or its community.
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

[Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Aug 31, 2017 22:54

I tried to modify the gfx library, to be able to use FreeBasic commands
even in the OpenGL mode. With my modified version, it is possible, by
setting a flag with ScreenControl, to render the graphic page of FreeBasic
over the openGL screen (using a quad with a texture). This feature could be
activated in a new thread, so the rendering will happen as with other
driver (not recommended), or it can happen each time the command flip is
called. Real color mode (32 and 16 bit) and paletted color modes are
supported.

To enable 2d rendering when Flip is called:
screencontrol 150,1

To enable automatic 2d rendering:
screencontrol 150,2

To set a zoom factor of 2:
screencontrol 151,2

https://sourceforge.net/p/fbc/patches/33/
Imortis
Posts: 1572
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 01, 2017 13:08

Interesting. I will have to test this out later and see how it works out.

EDIT: I am compiling the whole thing now.
Last edited by Imortis on Sep 01, 2017 16:21, edited 1 time in total.
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 01, 2017 16:05

I hope that it will work better than the hackish 2d.bi file
Imortis
Posts: 1572
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 01, 2017 17:37

Can you show me an example of the use of this code renderer? I tried and failed to use it properly.
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 01, 2017 21:04

Code: Select all

screencontrol 150,1
screenres 640,480,8,, &h02   

for i as integer=1 to 200
?"hello world";
next

flip
sleep 1000
palette 15,255,0,0
flip
sleep 1000
end





Code: Select all

screencontrol 150,2
screencontrol 151,2
screenres 640,480,8,, &h02   

'color 9
for i as integer=1 to 200
?"hello world";
next

flip
dim a as string
input a
palette 15,255,0,0
flip
sleep
end
Imortis
Posts: 1572
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 01, 2017 21:36

Hmm... I get blank screens all around. None of my tests display anything and your code doesn't either. Do I need to have the openGL dll in the program folder or something similar? It should just use the version in the Windows directory, right?
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 01, 2017 21:39

In theory, yes. I tested it under wine, and it worked. Are you sure you recompiled all the files? Can you check if the procedure "fb_hGL_SetupProjection" inside gfx_opengl.c is executed?
dodicat
Posts: 5159
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby dodicat » Sep 02, 2017 11:42

I haven't looked into the C code for the updated lib.
But, I will mention here, if your graphics card is an inbuilt Intel, then the opengl will be so poor so as not to be able to texture quads (if you are texturing via an image), unless that image is a power of 2 wide and a power of two high.
For example, on my machine this old code snippet wont show a screen unless I set the screenres as powers of two.

Code: Select all

#include once "fbgfx.bi"
#Include Once "GL/glu.bi"
#include "GL/glext.bi"

Enum
    opengl      = 2
    fullscreen  = 1
    #define plus Or
End Enum

Dim Shared As Integer xres,yres
Screenres 1024,512,32,,opengl plus fullscreen
Screeninfo xres,yres

'Simple structure just to hold corners of one quad
Type pair
    As single x,y
End Type
Operator *(x As Double,n As pair) As pair
Return Type<pair>(x*n.x,x*n.y)
End Operator


'Create a FreeBasic image
Sub CreateFBimageBackground(Byref im2 As Any Ptr)
    Dim As Single minx,maxx,miny,maxy,lasty,grad
    #define dist(x1,y1,x2,y2) Sqr((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
    #define map(a,b,x,c,d) ((d)-(c))*((x)-(a))/((b)-(a))+(c)
    #macro paintsketch(_function,r,g,b)
    For x As Double=minx To maxx Step (maxx-minx)/5000
        Dim As Double x1=(xres)*(x-minx)/(maxx-minx)
        Dim As Double y1=(yres)*(_function-maxy)/(miny-maxy)
        grad=y1-lasty
        lasty=y1
        grad=grad*250
        Line im2,(x1,0)-(x1,yres-y1),Rgb(r+grad,g+grad,b)
    Next x
    #endmacro
    #macro _window(topleftX,topleftY,bottomrightX,bottomrightY)
    minx=topleftX
    maxx=bottomrightX
    miny=bottomrightY
    maxy=topleftY
    #endmacro
    For x As Integer=0 To xres
        For y As Integer=0 To yres
            Var d=dist(x,y,(.8*xres),(.9*yres))
            Var c=map(0,800,d,255,50)
            Pset im2,(x,y),Rgb(0,0,c)
        Next y
    Next x
    _window(-5,3,25,-1.2)
    paintsketch(.05*Sin(x)+.05*Sin(2*x),100,100,50)
    _window(5,2,30,-.8)
    paintsketch(.1*Sin(x),100,100,0)
   
    _window(1,2,12,-.6)
    paintsketch(.1*Sin(x),100,100,0) 
    _window(0,2,8,-.5)
    paintsketch(.2*Sin(x),100,100,0)
End Sub

'Set a Quad to hold image
Sub setbackgroundquad(e() As pair)
    Dim As Single r1=xres/yres,r2=1 'same ratio as screen
    Dim As Single n=1 'left open for a fiddle around
    e(1)=n*Type(-r1,r2)
    e(2)=n*Type(r1,r2)
    e(3)=n*Type(r1,-r2)
    e(4)=n*Type(-r1,-r2)
End Sub

Sub DrawBackGroundQuad(e() As pair)
    Dim As Single n=1
    glLoadIdentity()
    glTranslatef(0,0,-2) 'adjust the z translate for a good fit
    glbegin gl_quads
    glTexCoord2f( 0,n )
    glvertex3f(e(1).x,e(1).y,0)
    glTexCoord2f( n,n )
    glvertex3f(e(2).x,e(2).y,0)
    glTexCoord2f( n,0 )
    glvertex3f(e(3).x,e(3).y,0)
    glTexCoord2f( 0,0 )
    glvertex3f(e(4).x,e(4).y,0)
    glend
End Sub

Sub glsetup
    glShadeModel(GL_SMOOTH)                 ' Enables Smooth Color Shading
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
    glEnable GL_ALPHA
    glEnable GL_BLEND
    glViewport(0, 0, xres, yres)       ' Set the viewport
    glMatrixMode(GL_PROJECTION)        ' Change Matrix Mode to Projection
    glLoadIdentity                     ' Reset View
    gluPerspective(45.0, xres/yres, 1.0, 100.0)
    glMatrixMode(GL_MODELVIEW)         ' Return to the modelview matrix
    glLoadIdentity                     '  Reset View
   
End Sub

'Transfer FB image to OpenGL
Sub settexture( texture As gluint, image As Any Ptr)
    glGenTextures(1, @texture)
    glBindTexture( GL_TEXTURE_2D, texture )
    glTexImage2d( GL_TEXTURE_2D, 0, GL_RGBA, Cast(fb.image Ptr, image)->Width, Cast(fb.image Ptr, image)->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, image+Sizeof(fb.image) )
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST )
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST )
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
End Sub


'Rotate and draw the cube with texturing on each face
Sub DrawGlCube(Byref rotangle As Single)
    glLoadIdentity()
    glTranslatef(0,0,-5)
    glRotatef(rotangle,1,.5,.25)           ' Rotate
    glBegin(GL_QUADS)
   
    glTexCoord2f( 1,1 )
    glVertex3f( 1.0, 1.0,-1.0)            ' Top right of the quad (top)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top left of the quad (top)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0, 1.0, 1.0)            ' Bottom left of the quad (top)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0, 1.0, 1.0)            ' Bottom right of the quad (top)
   
    glTexCoord2f( 1,1 )       
    glVertex3f( 1.0,-1.0, 1.0)            ' Top right of the quad (bottom)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Top left of the quad (bottom)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom left of the quad (bottom)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0,-1.0)            ' Bottom right of the quad (bottom)
   
    glTexCoord2f( 1,1 )
    glVertex3f( 1.0, 1.0, 1.0)            ' Top right of the quad (front)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0, 1.0)            ' Top left of the quad (front)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Bottom left of the quad (front)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0, 1.0)            ' Bottom right of the quad (front)
   
    glTexCoord2f( 1,1 )
    glVertex3f( 1.0,-1.0,-1.0)            ' Bottom left of the quad (back)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom right of the quad (back)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top right of the quad (back)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0, 1.0,-1.0)            ' Top left of the quad (back)
   
    glTexCoord2f( 1,1 )
    glVertex3f(-1.0, 1.0, 1.0)            ' Top right of the quad (left)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top left of the quad (left)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom left of the quad (left)
    glTexCoord2f( 1,0 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Bottom right of the quad (left)
   
    glTexCoord2f( 1,1 )
    glVertex3f( 1.0, 1.0,-1.0)            ' Top right of the quad (right)
    glTexCoord2f( 0,1 )
    glVertex3f( 1.0, 1.0, 1.0)            ' Top left of the quad (right)
    glTexCoord2f( 0,0 )
    glVertex3f( 1.0,-1.0, 1.0)            ' Bottom left of the quad (right)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0,-1.0)
    glend
End Sub

'Some variables
Dim As gluint tex1
Dim As Any Ptr background=Imagecreate(xres,yres)
Dim  As pair BackgroundCorners(1 To 4)


CreateFBimageBackground(background)
setbackgroundquad(BackgroundCorners())

'NOW START OPENGL
glsetup
'transfer freebasic image to openGL
settexture(tex1,background)
'enable texturing
glEnable( GL_TEXTURE_2D )
Dim As Single angle

Do
    angle=angle+1
    glClear(GL_COLOR_BUFFER_BIT)
   
    'freebasic image is planted onto the background quad
    DrawBackGroundQuad(BackgroundCorners())
   
    'standard rotate cube
    'with image planted to each face
    glEnable (GL_CULL_FACE)
    DrawGlcube(angle)
    gldisable(GL_CULL_FACE)
    glend
    Flip
    Sleep 1,1
Loop Until Inkey=Chr(27)
Imagedestroy background
   

If you set your screenres to something else,(not a power of two), and the cube runs then you rule out this particular opengl problem and carry on with your tests of the updated lib.
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 02, 2017 12:03

In fact the updated C code should build a texture that is power of 2, using the function "next_pow2" that is inside the file gfx_opengl.c . The function fb_hGL_ScreenCreate (added by me) will create a texture that is has the right size, and the function fb_hGL_SetupProjection will use glTexSubImage2d to copy the screen buffer on the part of the texture you need. Then it will render the texture, scaling it (using the appropriate texture coordinates) to fill the whole screen.

Another thing to try is: try replacing, in my test code, the line

Code: Select all

screenres 640,480,8,, &h02 

with

Code: Select all

screenres 640,480,32,, &h02   


To see if the issue happens always, or only with indexed colors
dodicat
Posts: 5159
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby dodicat » Sep 02, 2017 16:53

I see the difficulties.
I had a try at combining FB graphics and opengl on the fly.
I cannot quite get the transparency correct.
This draws the background above the gl graphics, which is what is required in general (I guess).

Code: Select all

#include once "fbgfx.bi"
#Include Once "GL/glu.bi"
#include "GL/glext.bi"

Enum
    opengl      = 2
    fullscreen  = 1
End Enum

Dim Shared As Integer xres,yres
Screenres 1024,512,32,,opengl
width 1024\8,512\16 'larger fonts
Screeninfo xres,yres

'Simple structure just to hold corners of one quad
Type pair
    As single x,y
End Type
Operator *(x As Double,n As pair) As pair
Return Type<pair>(x*n.x,x*n.y)
End Operator




Function Regulate(Byval MyFps As long,Byref fps As long) As long
    Static As Double timervalue,lastsleeptime,t3,frames
    Dim As Double t=Timer
    frames+=1
    If (t-t3)>=1 Then t3=t:fps=frames:frames=0
    Dim As long sleeptime=lastsleeptime+((1/myfps)-T+timervalue)*1000
    If sleeptime<1 Then sleeptime=1
    lastsleeptime=sleeptime
    timervalue=T
    Return sleeptime
End Function

'Set a Quad to hold image
Sub setbackgroundquad(e() As pair)
    Dim As Single r1=xres/yres,r2=1 'same ratio as screen
    Dim As Single n=1 'left open for a fiddle around
    e(4)=n*Type(-r1,r2)
    e(3)=n*Type(r1,r2)
    e(2)=n*Type(r1,-r2)
    e(1)=n*Type(-r1,-r2)
End Sub
'draw the quad
Sub DrawBackGroundQuad(e() As pair)
    Dim As Single n=1
    glLoadIdentity()
    glTranslatef(0,0,-2.4) 'adjust the z translate for a good fit
    glbegin gl_quads
    glTexCoord2f( 0,n )
    glvertex3f(e(1).x,e(1).y,0)
    glTexCoord2f( n,n )
    glvertex3f(e(2).x,e(2).y,0)
    glTexCoord2f( n,0 )
    glvertex3f(e(3).x,e(3).y,0)
    glTexCoord2f( 0,0 )
    glvertex3f(e(4).x,e(4).y,0)
    glend
End Sub

Sub glsetup
    glShadeModel(GL_SMOOTH)                 ' Enables Smooth Color Shading
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
   ' glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
    glBlendFunc(GL_ONE,GL_ONE)'_MINUS_SRC_ALPHA )
    glEnable GL_ALPHA
    glEnable GL_BLEND
    glViewport(0, 0, xres, yres)       ' Set the viewport
    glMatrixMode(GL_PROJECTION)        ' Change Matrix Mode to Projection
    glLoadIdentity                     ' Reset View
    gluPerspective(45.0, xres/yres, 1.0, 100.0)
    glMatrixMode(GL_MODELVIEW)         ' Return to the modelview matrix
    glLoadIdentity                     '  Reset View
End Sub

'Transfer FB image to OpenGL
Function settexture(image As Any Ptr) As gluint
    static As gluint texture,s
    if s=0 then glGenTextures(1, @texture):
    glBindTexture( GL_TEXTURE_2D, texture ):s=1
    glTexImage2d( GL_TEXTURE_2D, 0, GL_RGBA, Cast(fb.image Ptr, image)->Width, Cast(fb.image Ptr, image)->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, image+Sizeof(fb.image) )
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST )
    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST )
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL)
    Return texture
End Function


'Rotate and draw the cube with texturing on each face
Sub DrawGlCube(Byref rotangle As Single)
    glLoadIdentity()
    glTranslatef(0,0,-5)
    glRotatef(rotangle,1,.5,.25)           ' Rotate
    glBegin(GL_QUADS)
   
   ' glTexCoord2f( 1,1 )
    glcolor3ub 255,0,0
    glVertex3f( 1.0, 1.0,-1.0)            ' Top right of the quad (top)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top left of the quad (top)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0, 1.0, 1.0)            ' Bottom left of the quad (top)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0, 1.0, 1.0)            ' Bottom right of the quad (top)
   
    'glTexCoord2f( 1,1 )
    glcolor3ub 255,100,0
    glVertex3f( 1.0,-1.0, 1.0)            ' Top right of the quad (bottom)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Top left of the quad (bottom)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom left of the quad (bottom)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0,-1.0)            ' Bottom right of the quad (bottom)
   
   ' glTexCoord2f( 1,1 )
    glcolor3ub 255,0,255
    glVertex3f( 1.0, 1.0, 1.0)            ' Top right of the quad (front)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0, 1.0)            ' Top left of the quad (front)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Bottom left of the quad (front)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0, 1.0)            ' Bottom right of the quad (front)
   
   ' glTexCoord2f( 1,1 )
    glcolor3ub 0,0,200
    glVertex3f( 1.0,-1.0,-1.0)            ' Bottom left of the quad (back)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom right of the quad (back)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top right of the quad (back)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0, 1.0,-1.0)            ' Top left of the quad (back)
   
   ' glTexCoord2f( 1,1 )
    glcolor3ub 0,255,0
    glVertex3f(-1.0, 1.0, 1.0)            ' Top right of the quad (left)
    glTexCoord2f( 0,1 )
    glVertex3f(-1.0, 1.0,-1.0)            ' Top left of the quad (left)
    glTexCoord2f( 0,0 )
    glVertex3f(-1.0,-1.0,-1.0)            ' Bottom left of the quad (left)
    glTexCoord2f( 1,0 )
    glVertex3f(-1.0,-1.0, 1.0)            ' Bottom right of the quad (left)
   
   ' glTexCoord2f( 1,1 )
    glcolor3ub 255,0,100
    glVertex3f( 1.0, 1.0,-1.0)            ' Top right of the quad (right)
    glTexCoord2f( 0,1 )
    glVertex3f( 1.0, 1.0, 1.0)            ' Top left of the quad (right)
    glTexCoord2f( 0,0 )
    glVertex3f( 1.0,-1.0, 1.0)            ' Bottom left of the quad (right)
    glTexCoord2f( 1,0 )
    glVertex3f( 1.0,-1.0,-1.0)
    glend
End Sub
'=============== for ball only  =========
type pt
        as long x=100,y=100
        as single dx,dy
        as long kx,ky
    end type
sub ball(byref i as any ptr)
   
    static as pt b
    static as long kx=1,ky=1
    b.dx=8
    b.dy=6.5
    b.x+=b.dx*kx:b.y+=b.dy*ky
    if b.x<50 or b.x>xres-50 then kx=-kx
    if b.y<50 or b.y>yres-50 then ky=-ky
    circle i,(b.x,b.y),50,rgb(0,0,200),,,,f
    end sub
'===============
sub ClearImage(byref im as any ptr)
    imagedestroy im:im=0
    im=imagecreate (xres,yres,rgba(0,0,0,0))
end sub

'Some variables
Dim As gluint tex1
Dim As any Ptr background=Imagecreate(xres,yres,rgba(0,0,0,0))
Dim  As pair BackgroundCorners(1 To 4)
setbackgroundquad(BackgroundCorners())

'NOW START OPENGL
glsetup

Dim As Single angle
dim as long fps
Do
    angle=angle+1
    glClear(GL_COLOR_BUFFER_BIT)
   
     glEnable (GL_CULL_FACE)
     DrawGlcube(angle)
     glcolor3ub 0,100,0 'set clearcolor here
   
     
   'draw the background image
     glenable gl_texture_2d
     DrawBackGroundQuad(BackgroundCorners())
     gldisable gl_texture_2d
     
   'Free basic graphics
    ClearImage(background)
    ball(background)
    draw string background,(20,20),"OpenGL cube with FreeBASIC ball and text",rgb(255,100,0)
    draw string background,(30,50),"Frames per second  = " &fps,rgb(255,255,255)
     settexture(background)
   
    glend
    Flip
    Sleep regulate(30,fps),1
Loop Until Inkey=Chr(27)
Imagedestroy background
   

I'll work on it a bit, but not too much.
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 02, 2017 17:04

In my OpenB3D project I included a similar file. Since it always caused issues, I tried to move those routines into the graphic library
dodicat
Posts: 5159
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby dodicat » Sep 02, 2017 17:17

Compiling your library code is not easy for forum members.
Perhaps some .dll file with an assortment of FB graphics, could be created??
Or maybe only an include file with straight fb code?
What framerate did you get for the ball?
My openGL here is crap, (10 fps), so I am limited in openGL coding with this computer.
Good luck!
angros47
Posts: 1421
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 02, 2017 19:06

I got a framerate of 31.

I already made years ago a library that allowed to use 2d graphics on OpenGL... OpenB3D, born from the sprite engine of Basic4GL. I stopped working on it because of lack of interest. It is available as .dll and .so file.

I think that the ability to merge both opengl and regular 2d mode should be provided by native FreeBasic library, not by an external library, actually, since both modes are provided by the same internal library.
sgaba
Posts: 28
Joined: Aug 15, 2005 19:18
Location: Czech Republic

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby sgaba » Sep 02, 2017 20:14

Hello
I applied Patch and created the .deb package for Linux (Ubuntu).
https://www.dropbox.com/sh/25s64q3woan558j/AADDnbmtNm1j2JaNcXou9d_7a?dl=0
or
https://drive.google.com/open?id=0B53cRMSpme_nRnRCdGtrTlBsWVU
/fbc_1.06.0-git_linux_gl/
For more information on how to install it, look at:
((https://www.freebasic.net/forum/viewtopic.php?f=5&t=25266))
I tested it and it worked.
I'm a big fan of this Patch.

You can download it. And test it.
Imortis
Posts: 1572
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 05, 2017 16:08

Can you link to a pre-compiled libfbgfx.a and libfbgfxmt.a for Windows? I can't seem to get it to work here.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests