woot Found out that GL_BGRA_EXT isnt defines in the modules imported when using a framework. Now if we chane the line
glDrawPixels(g_w,g_h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,pBuffer)to
glDrawPixels(g_w,g_h,GL_RGBA,GL_UNSIGNED_BYTE,pBuffer)It works, the main difference is now the color order in the arrays is Red,Green,Blue,Alpha Which I think is more like old blitz instead of Blue,Green,Red,Alpha which I only originally used to keep it like the DBF lib version Jim originally made. So as long as you rework the colors it works and we can use a framework. The other option is we find out the value for GL_BGRA_EXT and define it ourselves but this could cause problems if later versions of bmax define it at some point
.
Anyway the Fixed lib is as follows
'-----------------------------------------------------------------------------------------------------
'
' The Tin Dragons - OpenGL Frame Buffer Lib By Joncom2000
'
' Based on code by Jim Shaw & Rbaz, Inspired by TinyPTC by Gaffer.
'
'-----------------------------------------------------------------------------------------------------
'----------------------------------------------------------------------------------------------
' Globals used by the lib to store screen size
'----------------------------------------------------------------------------------------------
Global g_w:Int
Global g_h:Int
'-----------------------------------------------------------------------------------------------------
' Place Functions after this
'-----------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------
' NAME : ptc_open()
' PURPOSE : This function opens the display
' INPUTS : Title, width and height for screen Also hertz
' RETURNS : nothing
' NOTES : N/A
'------------------------------------------------------------------------
Function ptc_open:Int(title:String,width:Int=640,height:Int=480,hertz:Int=60,full:Int=0)
'Set globals
g_w=width
g_h=height
AppTitle=Title
'open screen
If full = 0 Then
GLGraphics(g_w,g_h,32,Hertz,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER)
Else
GLGraphics(g_w,g_h,0,Hertz,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER)
End If
glViewport(0, 0, g_w,g_h)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glOrtho(0,g_w,g_h,0,0,1)
glPixelZoom(1,-1)
glRasterPos2i(0,0)
End Function
'------------------------------------------------------------------------
' NAME : ptc_update()
' PURPOSE : This function updates the display
' INPUTS : pixel buffer pointer
' RETURNS : nothing
' NOTES : N/A
'------------------------------------------------------------------------
Function ptc_update(pBuffer:Byte Ptr)
'glDrawPixels(g_w,g_h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,pBuffer)
glDrawPixels(g_w,g_h,GL_RGBA,GL_UNSIGNED_BYTE,pBuffer)
Flip
End Function
'------------------------------------------------------------------------
' NAME : ptc_draw()
' PURPOSE : This function updates the display
' INPUTS : pixel buffer pointer
' RETURNS : nothing
' NOTES : N/A
'------------------------------------------------------------------------
Function ptc_draw(pBuffer:Byte Ptr)
'glDrawPixels(g_w,g_h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,pBuffer)
glDrawPixels(g_w,g_h,GL_RGBA,GL_UNSIGNED_BYTE,pBuffer)
End Function
'------------------------------------------------------------------------
' NAME : ptc_close()
' PURPOSE : This function closes the display
' INPUTS : none
' RETURNS : update
' NOTES : N/A
'------------------------------------------------------------------------
Function ptc_close()
' Doesnt seem needed but I might add cleanup code at some point if needed
End Function
I left the old lines there so you can see the changes, note the ptc_draw function doesnt do a flip, this means other ogl drawing could be done to the back buffer before flipping so additional effects could be done.
Oh and now I can attach the exe for none bmax users
