Thanks

!!!
Nice to see somebody interessted on my work ^^.
Uhm sorry, for no new Tutorials on PBGL, but the i-networx server is so slow at the moment. And on Tripod are too much spamming ad's. The next tutorial could be about Terrains with NURBS Objects.
[Offtopic]
Like this example(created by me

):
Code: Select all
XIncludeFile "C:\Programme\PureBASIC\Examples\Sources - Advanced\OpenGL Cube\OpenGL.pbi" ;Correct this path if it is wrong
#WindowWidth = 500
#WindowHeight = 400
#WindowFlags = #PB_Window_TitleBar | #PB_Window_MaximizeGadget | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_ScreenCentered
Version = 1
Procedure MyWindowCallback(WindowID, Message, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
If Message = #WM_SIZE
glViewport_(0, 0, WindowWidth(), WindowHeight())
Result = 1
EndIf
ProcedureReturn Result
EndProcedure
If OpenWindow(0, 0, 0, #WindowWidth, #WindowHeight, #WindowFlags, "Titel v. "+Str(Version))
SetWindowCallback(@MyWindowCallback())
hWnd = WindowID(0)
pfd.PIXELFORMATDESCRIPTOR ;OpenGL starten
hDC = GetDC_(hWnd)
pfd\nSize = SizeOf(PIXELFORMATDESCRIPTOR)
pfd\nVersion = 1
pfd\dwFlags = #PFD_SUPPORT_OPENGL | #PFD_DOUBLEBUFFER | #PFD_DRAW_TO_WINDOW
pfd\iLayerType = #PFD_MAIN_PLANE
pfd\iPixelType = #PFD_TYPE_RGBA
pfd\cColorBits = 24
pfd\cDepthBits = 32
pixformat = ChoosePixelFormat_(hDC, pfd)
SetPixelFormat_(hDC, pixformat, pfd)
hrc = wglCreateContext_(hDC)
wglMakeCurrent_(hDC, hrc)
SwapBuffers_(hDC)
floatX.f = 0.5
floatY.f = 0.25
floatZ.f = -0.5
gluObj = gluNewNurbsRenderer_()
glEnable_(#GL_FOG)
glEnable_(#GL_DEPTH_TEST)
glEnable_(#GL_AUTO_NORMAL)
glEnable_(#GL_CULL_FACE)
Dim uknots.f(7)
Dim vknots.f(7)
Dim ctrlP.f(3, 3, 2)
;Initialize the Terrain
For u=0 To 3
uknots(u) = 0.0
uknots(u+4) = 1.0
For v=0 To 3
If u = 0
vknots(v) = 0.0
vknots(v+4) = 1.0
EndIf
ctrlP(u, v, 0) = 0.8*((u/7)-0.5)
ctrlP(u, v, 2) = 0.8*((v/7)-0.5)
If (u=1 Or u=2) And (v=2 Or v=1) ;Create hill in the middle of the terrain
If u=1
ctrlP(u, v, 1) = 0.5
Else
ctrlP(u, v, 1) = 0.0
EndIf
Else
ctrlP(u, v, 1) = 0.0
EndIf
Next
Next
Repeat
glClear_(#GL_COLOR_BUFFER_BIT | #GL_DEPTH_BUFFER_BIT)
glLoadIdentity_()
glScalef_(2.5, 2.5, 2.5)
glTranslatef_(0.25, -0.25, 0.0)
glRotatef_(350.0, 1.0, -1.0, 0.0)
glColor3f_(0.25, 0.5, 0.0)
gluBeginSurface_(gluObj)
gluNurbsSurface_(gluObj,8,@uknots(),8,@vknots(),3*4,3,@ctrlP(),4,4,#GL_MAP2_VERTEX_3)
gluEndSurface_(gluObj)
SwapBuffers_(hDC)
Event = WindowEvent()
Delay(5)
Until Event = #PB_Event_CloseWindow
End
EndIf
[/Offtopic]