[Patch] Rendering of FreeBasic graphic on OpenGL

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

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 16:38

Hmmm.... so, the texture quad is drawn, but for some reason it is black.
Perhaps, before the flip, try putting the command "glColor4f(1, 1, 1, 1)"
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 17:51

Also black screen.

I decided to alter the gfx_opengl.c file to add some more printf's so I could see exactly what it is actually doing. Here is the result:

Code: Select all

fb_hGL_Init
fb_hGL_ExtensionSupported
fb_hGL_ExtensionSupported
fb_hGL_NormalizeParameters
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetPalette
fb_hGL_SetupProjection
fb_hGL_SetPalette
fb_hGL_SetupProjection


That result is with this code:

Code: Select all

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

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

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


I don't know if that is helpful at all or not.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 19:46

Is "fb_hGL_ScreenCreate" ever executed?
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 20:13

Nope. I added a print out to each and every function inside the gfx_opengl.c file.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 20:20

Something is wrong, since that routine is supposed to create the texture. In the subdirectory win32 there is the file gfx_driver_opengl.c.

In the function driver_init, toward the end, you should locate the lines:

Code: Select all

   if (__fb_gl_params.mode_2d!=0)
      fb_hGL_ScreenCreate();


Put a "printf" just before it, to show the value of __fb_gl_params.mode_2d, and to see if that part of code is executed or not
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 20:34

It is 0 and no, fb_hGL_ScreenCreate in not called.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 20:41

It is supposed to be a 1. Wait... in your test, you put ScreenControl after ScreenRes, you should put it BEFORE.

(ScreenControl is also used to set which driver will be used, so it has to be used before setting the graphic mode)
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 20:57

Okay. So that time it was 1. and the ScreenCreateFunction did run.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 21:18

Weird.... what happens if you force it to be called, by removing the "if", replacing :

Code: Select all

   if (__fb_gl_params.mode_2d!=0)
      fb_hGL_ScreenCreate();


with

Code: Select all

   /*if (__fb_gl_params.mode_2d!=0)*/
      fb_hGL_ScreenCreate();
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 21:24

Already tried that. Still black screen.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 21:37

In ScreenCreate, can you print the variable "id"? Place the print before the switch instruction
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 06, 2017 21:45

id = 1

Also, would it be better if we took this off-forum so we are not blowing up this thread with it? I seem to be in the minority of people who can't use it.
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 06, 2017 22:55

I sent you a mail
angros47
Posts: 1407
Joined: Jun 21, 2005 19:04

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby angros47 » Sep 08, 2017 20:33

I found the issue, and I uploaded the updated files
Imortis
Posts: 1563
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: [Patch] Rendering of FreeBasic graphic on OpenGL

Postby Imortis » Sep 13, 2017 21:34

Okay, so I have a question:

Should this have defines or enums for the two OpenGL 2D mode options? As it stands it is the only screencontrol command with parameters whose meaning is not immediately obvious.

I don't feel like leaving them as 1 and 2 is very intuitive.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests