[Patch] Rendering of FreeBasic graphic on OpenGL
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
This is compiled for Windows 32 bit: https://ufile.io/xump3 (I compiled it under Wine)
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
That confirmed my suspicions. I compiled it correctly, it just will not show on the machine I am currently using. Other OpenGL apps work fine. I will test from another machine as soon as I can.
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
What happens if you remove the line:
from function fb_hGL_SetupProjection in gfx_opengl.c ?
Code: Select all
__fb_gl.Enable(GL_TEXTURE_2D);
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
The code you showed me is the unpatched file, provided with original FreeBasic. In the patch I made, the subroutine is completely different. Have you download the file I included on Sourceforge and extracted the modified files from it?
The link is: https://sourceforge.net/p/fbc/patches/3 ... ib2.tar.gz
The link is: https://sourceforge.net/p/fbc/patches/3 ... ib2.tar.gz
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
No difference.
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
I tried clicking on it now, and looking at the file inside. The routine should be:
Can you see it? Otherwise, something went wrong in your download
Code: Select all
void fb_hGL_SetupProjection(void)
{
const GLfloat vert[]={-1,-1,-1,1,1,1,1,-1};
__fb_gl.PushAttrib(GL_ALL_ATTRIB_BITS);
__fb_gl.Viewport(0, 0, __fb_gfx->w * __fb_gl_params.scale, __fb_gfx->h * __fb_gl_params.scale);
__fb_gl.MatrixMode(GL_PROJECTION);
__fb_gl.PushMatrix();
__fb_gl.LoadIdentity();
__fb_gl.Ortho(-1, 1, -1, 1, -1, 1);
__fb_gl.MatrixMode(GL_MODELVIEW);
__fb_gl.LoadIdentity();
__fb_gl.ShadeModel(GL_FLAT);
__fb_gl.Disable(GL_DEPTH_TEST);
__fb_gl.DepthMask(GL_FALSE);
__fb_gl.Enable( GL_VERTEX_ARRAY );
__fb_gl.Enable( GL_TEXTURE_COORD_ARRAY );
__fb_gl.VertexPointer(2, GL_FLOAT, 0, vert);
__fb_gl.TexCoordPointer(2, GL_FLOAT, 0, texcoords);
//__fb_gl.ActiveTexture(GL_TEXTURE0);
__fb_gl.BindTexture(GL_TEXTURE_2D, ScreenTex);
switch(__fb_gfx->depth){
case 32:
case 24:
__fb_gl.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, __fb_gfx->w, __fb_gfx->h, GL_BGRA, GL_UNSIGNED_BYTE, (unsigned char *)__fb_gfx->framebuffer);
break;
case 16:
case 15:
__fb_gl.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, __fb_gfx->w, __fb_gfx->h, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, (unsigned char *)__fb_gfx->framebuffer);
break;
case 8:
case 4:
case 2:
case 1:
__fb_gl.PixelTransferi(GL_MAP_COLOR, GL_TRUE );
__fb_gl.PixelMap(GL_PIXEL_MAP_I_TO_R,256, map_r);
__fb_gl.PixelMap(GL_PIXEL_MAP_I_TO_G,256, map_g);
__fb_gl.PixelMap(GL_PIXEL_MAP_I_TO_B,256, map_b);
__fb_gl.TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, __fb_gfx->w, __fb_gfx->h, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, (unsigned char *)__fb_gfx->framebuffer);
}
__fb_gl.Enable(GL_TEXTURE_2D);
__fb_gl.DrawArrays(GL_TRIANGLE_FAN,0,4);
__fb_gl.PopMatrix();
__fb_gl.PopAttrib();
}
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
Sorry. I had the source code in a couple different places on my drive. I was looking at the unmodified code. If you look you will see I deleted that post because I was in error. I removed the line of code you suggested and still had the same results. No rendering at all.
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
Screen is white, or black? Also, try adding the line
to see if the subroutine is executed
Code: Select all
printf ("test");
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
Also, this is a file I compiled on my system: does it work? https://ufile.io/ij4hl (warning, executable file)
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
Black screen, and yes it gets executed.
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
It also does not work.angros47 wrote:Also, this is a file I compiled on my system: does it work? https://ufile.io/ij4hl (warning, executable file)
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
If you try to draw a triangle in OpenGL, does it show on the screen? And does it show if you use screencontrol 150,1?
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
The OpenGL examples bundled with FB work, but your code when using the screencontrol command does not. If I remove it, the code works in normal FBGFX.
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
If you take one of the normal example, and add the screencontrol 150,1 command before the screen command, what happens?
Re: [Patch] Rendering of FreeBasic graphic on OpenGL
Black screen.angros47 wrote:If you take one of the normal example, and add the screencontrol 150,1 command before the screen command, what happens?