FreeB 1.09 #include "GL/glu.bi" Problem

New to FreeBASIC? Post your questions here.
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Hello!
Please tell me why the example supplied with Freebasic 1.09 does not start for me
The compiler writes: ld: cannot find -lGLU
That is, he doesn't like #include "GL/glu.bi"
Freebasic 1.07 compiled fine
As far as I understand, this file is not supplied with Freebasic 1.09. Or am I doing something wrong?
The program itself:

Code: Select all

''
''	This is a quick port of NeHe lesson 4
''
''	Go to http://nehe.gamedev.net for his other great OpenGL tutorials!
''


#include "fbgfx.bi"
#include "GL/gl.bi"
#include "GL/glu.bi"


	dim rtri as single, rquad as single
	
	screen 18, 32, , FB.GFX_OPENGL or FB.GFX_MULTISAMPLE
	
	glViewport 0, 0, 640, 480
	glMatrixMode GL_PROJECTION
	glLoadIdentity
	gluPerspective 45.0, 640.0/480.0, 0.1, 100.0
	glMatrixMode GL_MODELVIEW
	glLoadIdentity
	
	glShadeModel GL_SMOOTH
	glClearColor 0.0, 0.0, 0.0, 1.0
	glClearDepth 1.0
	glEnable GL_DEPTH_TEST
	glDepthFunc GL_LEQUAL
	glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
	
	do
		glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
		glLoadIdentity
		glTranslatef -1.5, 0.0, -6.0
		glRotatef rtri, 0, 1, 0
		glBegin GL_TRIANGLES
			glColor3f 1.0, 0.0, 0.0
			glVertex3f 0.0, 1.0, 0.0
			glColor3f 0.0, 1.0, 0.0
			glVertex3f -1.0, -1.0, 0.0
			glColor3f 0.0, 0.0, 1.0
			glVertex3f 1.0, -1.0, 0.0
		glEnd
		
		glLoadIdentity
		glTranslatef 1.5, 0.0, -6.0
		glColor3f 0.5, 0.5, 1.0
		glRotatef rquad, 1, 0, 0
		glBegin GL_QUADS
			glVertex3f -1.0, 1.0, 0.0
			glVertex3f 1.0, 1.0, 0.0
			glVertex3f 1.0, -1.0, 0.0
			glVertex3f -1.0, -1.0, 0.0
		glEnd

		glFlush

		rtri += 0.2
		rquad += 0.15
		flip
	loop while inkey = ""

dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by dodicat »

It is OK here, win 10, tested fb 32,64,-gen gas64.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by srvaldez »

hello PavelUT
what OS are you using?
if you are on a Debian flavored Linux like Ubuntu then you may need to install the library
sudo apt install freeglut3-dev
sudo apt install mesa-utils
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Yes, yes, sorry, please forgot to mention that I really have
FreeBasic 1.09
Raspberry 4B (Linux OS)
There were no problems with Freebasic 1.07. I wonder why the files were not submitted?
By the way, glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) stopped working for me in Freebasic 1.09
(no grid mode enabled)
In Freebasic 1.07 everything was fine
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by srvaldez »

PavelUT wrote: Mar 19, 2022 15:02 ld: cannot find -lGLU
the message you got tells you that the linker couldn't find the GL library not that FB couldn't find GL/glu.bi
try my first suggestion by installing the library, then let us know if it worked or not
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Yes, thanks for helping.
And what's about
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) can you tell me? Grid mode not enabled
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by srvaldez »

sorry, don't know
hopefully someone knowledgeable on the subject will chime in
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Can anyone tell me how to turn on the grid mode in the above program?
Just using glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) doesn't help. What else needs to be done?
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by dodicat »

glPolygonMode works OK here.
Example plus info about your opengl.

Code: Select all

 

#include "gl/glu.bi"
 #include "crt.bi"    
Screen 18,32,,2
dim as string driver
screeninfo ,,,,,,driver

dim as string s,tmp
s+= "Card: "+*glGetString(GL_RENDERER)+chr(10)
s+= "Manufacturer "+*glGetString(GL_VENDOR)+chr(10)
s+= "OpenGL Version "+*glGetString(GL_VERSION)+chr(10)
s+= "FreebASIC Driver = " +driver+chr(10)
s+= " " +chr(10)
s+= "EXTENSIONS:"+chr(10)


tmp=*glGetString(GL_EXTENSIONS)
tmp=trim(tmp)+" "
'screen 0
'width , 500
puts s
dim as long i,ctr
do
    ctr+=1
    i=instr(tmp," ")
    if i=len(tmp) then puts str(ctr)+"            "+ mid(tmp,1,i): exit do
    puts str(ctr)+ "            "+mid(tmp,1,i)
    tmp=mid(tmp,i+1)
loop until i=0
print
print "Press a key to end"
dim rtri as single, rquad as single
glViewport 0, 0, 640, 480
	glMatrixMode GL_PROJECTION
	glLoadIdentity
	gluPerspective 45.0, 640.0/480.0, 0.1, 100.0
	glMatrixMode GL_MODELVIEW
	glLoadIdentity
	
	glShadeModel GL_SMOOTH
	glClearColor 0.0, 0.0, 0.5, 1.0
	glClearDepth 1.0
	glEnable GL_DEPTH_TEST
	glDepthFunc GL_LEQUAL
	glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
	
	do
		glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
		glLoadIdentity
		glTranslatef -1.5, 0.0, -6.0
		glRotatef rtri, 0, 1, 0
            glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
		glBegin GL_TRIANGLES
			glColor3f 1.0, 0.0, 0.0
			glVertex3f 0.0, 1.0, 0.0
			glColor3f 0.0, 1.0, 0.0
			glVertex3f -1.0, -1.0, 0.0
			glColor3f 0.0, 0.0, 1.0
			glVertex3f 1.0, -1.0, 0.0
		glEnd
		
		glLoadIdentity
		glTranslatef 1.5, 0.0, -6.0
		glColor3f 0.5, 0.5, 1.0
		glRotatef rquad, 1, 0, 0
            glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
		glBegin GL_POLYGON
                 glColor3f 1.0, 0.0, 0.0
			glVertex3f -1.0, 1.0, 0.0
                  glColor3f 1.0, 1.0, 1.0
			glVertex3f 1.0, 1.0, 0.0
                  glColor3f 0, 1.0, 0.0
			glVertex3f 1.0, -1.0, 0.0
                  glColor3f 0, 0.0, 1.0
			glVertex3f -1.0, -1.0, 0.0
                  glColor3f 0, 0.0, 0.0
                  glVertex3f -1.5, -.5, 0.0
		glEnd

		glFlush

		rtri += 0.2
		rquad += 0.15
		flip
	loop while inkey = ""
end
sleep
   

    
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

An interesting example, but both figures turned out to be multi-colored, and instead of
'#include "gl/glu.bi"
had to put for successful compilation
#include "GL/glu.bi"
(I have Freebasic 1.09
Raspberry 4B (OS Linux))
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Card: V3D 4.2
Manufacturer Broadcom
OpenGL Version 2.1 Mesa 20.3.5
FreebASIC Driver = OpenGL
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by dodicat »

Card: Intel(R) HD Graphics 2000
Manufacturer Intel
OpenGL Version 3.1.0 - Build 9.17.10.4459
FreebASIC Driver = OpenGL

EXTENSIONS:
(115 of 'em)
I made the shapes multicoloured, they are basically the example you first posted, with more colours and the polygon thing.
But you got glu.bi which is the main thing.
I must get one of these Raspberry devices some day.
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

EXTENSIONS:
(207 of 'em)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
does not work
Probably the result of some changes in the language FB 1.09
PavelUT
Posts: 78
Joined: Jun 14, 2021 14:42

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by PavelUT »

Yes, I recommend Raspberry 4 the size of a business card, 4 core processor, 4 gigabytes of memory. If you don’t like to mess with iron, Raspberry 400 is better.
But modern 3D games will not pull
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: FreeB 1.09 #include "GL/glu.bi" Problem

Post by badidea »

Here on Ubuntu 18.04 laptop with fbc 1.09.0 (32 & 64 bit), glPolygonMode() works fine with GL_FILL, GL_LINE or GL_POINT.

Card: Mesa DRI Intel(R) HD Graphics 5500 (BDW GT2)
Manufacturer Intel Open Source Technology Center
OpenGL Version 3.0 Mesa 20.0.8
FreebASIC Driver = OpenGL

And 260 extentions
Post Reply