Restored from previous forum. Originally posted by dmoc.
Hi all!
just got PB last night. I obviously liked what I saw but what sold me was Fred's active participation in these forums and the helpful attitude of everyone here. So keep it up as I'm sure others will feel the same way and also sign up.
Q: Straight in at the deep end, I'm trying to convert a large chunk of OpenGL code. As a start I have a much smaller program I use as a quick test. Specifically it makes calls to gluPerspective and gluSphere. I've figured out that natively PB is not supporting calls involving floats, correct? So I got hold of glu32f but now need to know where to dump the files and how PB will find the new library? Any help appreciated.
Hello and a question.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kale.
for development any external .dlls should be placed within the 'compilers' folder so they can be found when the program is run from the editor, then included with your program's executable for distribution.
--Kale
New to PureBasic and falling in Love!
for development any external .dlls should be placed within the 'compilers' folder so they can be found when the program is run from the editor, then included with your program's executable for distribution.
--Kale
New to PureBasic and falling in Love!
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by dmoc.
Hi Kale, thanks for the advice but no dll involved. In the end I dropped the glu32f files in each directory in turn and restarted PB until it didn't complain. Ended up in the "UserLibraries" dir which, ahem, makes sense
Good news is my little tester worked! I don't claimed to be the original coder of this. It was a c file I got from one of the many demo crew sites and was named "512B.c" which I think denotes attempts at the best gfx effect done in 512 bytes (maybe source code size, I dunno). Anyway here it is for anyone who's interested... roll of drums... my first PB program (or more exactly "conversion")...
IncludeFile "OpenGL.pbi"
w.l = CreateWindowEx_(#WS_EX_TOPMOST,@"EDIT",@" ",#WS_VISIBLE+#WS_POPUP,0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN),0,0,0,0)
hdc = GetDC_(w)
Entry:
SetPixelFormat_(hdc,4,0)
hglrc = wglCreateContext_(hdc)
wglMakeCurrent_(hdc,hglrc)
glMatrixMode_(#GL_PROJECTION)
gluPerspectivef_(100.0, 1.0, 1.0, 100.0)
glMatrixMode_(#GL_MODELVIEW)
glEnable_(#GL_BLEND)
glEnable_(#GL_TEXTURE_2D)
glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA)
glColor4f_(1.0, 1.0, 1.0, 0.06)
gluBuild2DMipmaps_(#GL_TEXTURE_2D,4,16,16,#GL_RGBA,#GL_UNSIGNED_BYTE,?Entry)
quad.l = gluNewQuadric_()
gluQuadricTexture_(quad,#GL_TRUE)
t.f = 0.0
While (GetAsyncKeyState_(#VK_ESCAPE)=0)
; glClear(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
glLoadIdentity_()
glRotatef_(t, 1.0, 0.0, 0.0)
glRotatef_(t, 0.0, 1.0, 1.0)
glRotatef_(t, 0.0, 0.0, 1.0)
gluSpheref_(quad, 100.0, 10.0, 10.0)
t = t + 0.03
wglSwapBuffers_(hdc)
Wend
wglMakeCurrent_(0, 0)
wglDeleteContext_(hglrc)
DestroyWindow_(w)
Hi Kale, thanks for the advice but no dll involved. In the end I dropped the glu32f files in each directory in turn and restarted PB until it didn't complain. Ended up in the "UserLibraries" dir which, ahem, makes sense
Good news is my little tester worked! I don't claimed to be the original coder of this. It was a c file I got from one of the many demo crew sites and was named "512B.c" which I think denotes attempts at the best gfx effect done in 512 bytes (maybe source code size, I dunno). Anyway here it is for anyone who's interested... roll of drums... my first PB program (or more exactly "conversion")...
IncludeFile "OpenGL.pbi"
w.l = CreateWindowEx_(#WS_EX_TOPMOST,@"EDIT",@" ",#WS_VISIBLE+#WS_POPUP,0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN),0,0,0,0)
hdc = GetDC_(w)
Entry:
SetPixelFormat_(hdc,4,0)
hglrc = wglCreateContext_(hdc)
wglMakeCurrent_(hdc,hglrc)
glMatrixMode_(#GL_PROJECTION)
gluPerspectivef_(100.0, 1.0, 1.0, 100.0)
glMatrixMode_(#GL_MODELVIEW)
glEnable_(#GL_BLEND)
glEnable_(#GL_TEXTURE_2D)
glBlendFunc_(#GL_SRC_ALPHA, #GL_ONE_MINUS_SRC_ALPHA)
glColor4f_(1.0, 1.0, 1.0, 0.06)
gluBuild2DMipmaps_(#GL_TEXTURE_2D,4,16,16,#GL_RGBA,#GL_UNSIGNED_BYTE,?Entry)
quad.l = gluNewQuadric_()
gluQuadricTexture_(quad,#GL_TRUE)
t.f = 0.0
While (GetAsyncKeyState_(#VK_ESCAPE)=0)
; glClear(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
glLoadIdentity_()
glRotatef_(t, 1.0, 0.0, 0.0)
glRotatef_(t, 0.0, 1.0, 1.0)
glRotatef_(t, 0.0, 0.0, 1.0)
gluSpheref_(quad, 100.0, 10.0, 10.0)
t = t + 0.03
wglSwapBuffers_(hdc)
Wend
wglMakeCurrent_(0, 0)
wglDeleteContext_(hglrc)
DestroyWindow_(w)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by dmoc.
Hi all, I changed the CreateWindow call to what follows based on advice in other thread. Surprised it did not crash with the @'s, go figure. @Wolfgang: yeah, nice effect for a short piece of code. I never did get around to figuring it out and when I first saw it I was relunctant to run it because of the last parameter in the gluBuild2DMipmaps call.
w.l = CreateWindowEx_(#WS_EX_TOPMOST,"EDIT"," ",#WS_VISIBLE|#WS_POPUP,0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN),0,0,0,0)
Hi all, I changed the CreateWindow call to what follows based on advice in other thread. Surprised it did not crash with the @'s, go figure. @Wolfgang: yeah, nice effect for a short piece of code. I never did get around to figuring it out and when I first saw it I was relunctant to run it because of the last parameter in the gluBuild2DMipmaps call.
w.l = CreateWindowEx_(#WS_EX_TOPMOST,"EDIT"," ",#WS_VISIBLE|#WS_POPUP,0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN),0,0,0,0)
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ebs.
dmoc,
VERY nice effect for a 3.5KB program (after compression)! I added a line of code to hide the mouse cursor and I'm using it as my screen saver.
Thanks,
Eric
dmoc,
VERY nice effect for a 3.5KB program (after compression)! I added a line of code to hide the mouse cursor and I'm using it as my screen saver.
Thanks,
Eric
Originally posted by dmoc
Hi all, I changed the CreateWindow call to what follows based on advice in other thread. Surprised it did not crash with the @'s, go figure. @Wolfgang: yeah, nice effect for a short piece of code. I never did get around to figuring it out and when I first saw it I was relunctant to run it because of the last parameter in the gluBuild2DMipmaps call.
w.l = CreateWindowEx_(#WS_EX_TOPMOST,"EDIT"," ",#WS_VISIBLE|#WS_POPUP,0,0,GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN),0,0,0,0)