Hi Petr
i want to implement this VBO code in
https://en.wikipedia.org/wiki/Vertex...ing_OpenGL_2.1
for opengl 1.5 to 2.1
i have added #Include "%app_includepath%\thinBasic_GLEXT.inc"
but i get errors about the function glGenBuffers:
A general declared function or sub has no process address. See DECLARE SET ADDRESS help for more info.
i have searched the file "thinBasic_GLEXT.inc" and the glGenBuffers is declared like:
DECLARE SUB glGenBuffers ( BYVAL Par1 AS GLsizei, BYREF Par2 AS GLuint)
so what is the mystery?
i have searched for glGenBuffers inside opengl32.dll which is located my windows xp32 system folder and can't find the glGenBuffers inside the DLL, the only place i find it is inside my nvidea card driver software. i also find it in mesa opengl32.dll https://fdossena.com/?p=mesa/index.frag in which its opengl32.dll have big size > 16MB and seems to contains all extensions.
best regards
Uses "tbgl", "MATH"
#Def %GL_GLEXT_PROTOTYPES
#Include "%app_includepath%\thinbasic_gl.inc"
#Include "%app_includepath%\thinbasic_glu.inc"
#Include "%app_includepath%\thinbasic_WGL.inc"
#Include "%app_includepath%\thinBasic_GLEXT.inc"
Dim HglGenBuffers As DWord = TBGL_GetProcAddress("glGenBuffers")
Declare Set Address glGenBuffers, HglGenBuffers
Dim hwnd As DWord
hwnd = TBGL_CreateWindowEx("glDrawArrays example - esc to exit", 600, 600, 32, 0)
TBGL_ShowWindow
TBGL_ResetKeyState()
'try float data[] = {0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0}
Global data(9) As Single
Array Assign data = 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, -1.0, 0.0, 1.0
'Create a New VBO And use the variable id To store the VBO id
Global triangleVBO As DWord
glGenBuffers(1, VarPtr(triangleVBO)) ' //Make the New VBO active
glBindBuffer(%GL_ARRAY_BUFFER, triangleVBO)
'Upload vertex data To the video device
glBufferData(%GL_ARRAY_BUFFER, SizeOf(data), data, %GL_STATIC_DRAW)
'Make the New VBO active. Repeat here incase changed since initialisation
glBindBuffer(%GL_ARRAY_BUFFER, triangleVBO)
While TBGL_IsWindow(hwnd)
TBGL_ClearFrame
display
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hwnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
'=================================================================================
'--------------------------------------------------------
'--------------------------------------------------------
Sub display()
glMatrixMode(%GL_PROJECTION)
glLoadIdentity()
gluPerspective(60.0, 800/600, 1.0, 100.0)
glMatrixMode(%GL_MODELVIEW)
'glTranslatef(0, 0, -40)
glShadeModel(%GL_SMOOTH)
glEnable(%GL_DEPTH_TEST)
gluLookAt( 0, 1, 1,
0, 1, 0,
0, 1, 0 )
glclear(%gl_color_buffer_bit)
TBGL_Rotate GetTickCount/30,0,1,0
'Initialise VBO - do only once, at start of program
'Create a variable To hold the VBO identifier GLuint triangleVBO;
'Vertices of a triangle (counter-clockwise winding)
'Draw Triangle from VBO - Do Each time Window, view point Or data changes
'Establish its 3 coordinates per vertex With zero stride In This Array; necessary here
glVertexPointer(3, %GL_FLOAT, 0, NULL)
'Establish Array Contains vertices (Not normals, colours, texture coords etc)
glEnableClientState(%GL_VERTEX_ARRAY)
'Actually Draw the triangle, giving the Number of vertices provided
glDrawArrays(%GL_TRIANGLES, 1, 9)
'Force display To be drawn Now
'glFlush;
glClear(%GL_COLOR_BUFFER_BIT Or %GL_DEPTH_BUFFER_BIT)
glClearColor(1, 1, 1, 1)
glDisableClientState(%GL_VERTEX_ARRAY)
'**************************************************
End Sub
Edit: i have added :
Dim HglGenBuffers As DWord = TBGL_GetProcAddress("glGenBuffers")
Declare Set Address glGenBuffers, HglGenBuffers
but still can't access glGenBuffers
Edit2:
my Last try, but still can't access the glGenBuffers
my card support VBO as i can run the VBO examples in other languages.
Uses "tbgl"
#Def %GL_GLEXT_PROTOTYPES
#Include "%app_includepath%\thinbasic_gl.inc"
#Include "%app_includepath%\thinbasic_glu.inc"
#Include "%app_includepath%\thinBasic_GLEXT.inc"
#Include "%app_includepath%\thinbasic_WGL.inc"
Declare Set Address glGenBuffers, wglGetProcAddress("glGenBuffers")
Declare Set Address glBindBuffer, wglGetProcAddress("glBindBuffer")
Declare Set Address glBufferData, wglGetProcAddress("glBufferData")
Dim hwnd As DWord
hwnd = TBGL_CreateWindowEx("glDrawArrays example - esc to exit", 600, 600, 32, 0)
TBGL_ShowWindow
TBGL_ResetKeyState()
'try float data[] = {0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0}
Global data(9) As Single
Array Assign data = 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, -1.0, 0.0, 1.0
'Create a New VBO And use the variable id To store the VBO id
Dim triangleVBO As DWord
glGenBuffers(1, triangleVBO) ' //Make the New VBO active
glBindBuffer(%GL_ARRAY_BUFFER, triangleVBO)
'Upload vertex data To the video device
glBufferData(%GL_ARRAY_BUFFER, SizeOf(data), data, %GL_STATIC_DRAW)
'Make the New VBO active. Repeat here incase changed since initialisation
glBindBuffer(%GL_ARRAY_BUFFER, triangleVBO)
While TBGL_IsWindow(hwnd)
TBGL_ClearFrame
display
TBGL_DrawFrame
If TBGL_GetWindowKeyState( hwnd, %VK_ESCAPE) Then Exit While
Wend
TBGL_DestroyWindow
'=================================================================================
Sub display()
glMatrixMode(%GL_PROJECTION)
glLoadIdentity()
gluPerspective(60.0, 800/600, 1.0, 100.0)
glMatrixMode(%GL_MODELVIEW)
'glTranslatef(0, 0, -40)
glShadeModel(%GL_SMOOTH)
glEnable(%GL_DEPTH_TEST)
gluLookAt( 0, 1, 1,
0, 1, 0,
0, 1, 0 )
glclear(%gl_color_buffer_bit)
TBGL_Rotate GetTickCount/30,0,1,0
'Initialise VBO - do only once, at start of program
'Create a variable To hold the VBO identifier GLuint triangleVBO;
'Vertices of a triangle (counter-clockwise winding)
'Draw Triangle from VBO - Do Each time Window, view point Or data changes
'Establish its 3 coordinates per vertex With zero stride In This Array; necessary here
glVertexPointer(3, %GL_FLOAT, 0, NULL)
'Establish Array Contains vertices (Not normals, colours, texture coords etc)
glEnableClientState(%GL_VERTEX_ARRAY)
'Actually Draw the triangle, giving the Number of vertices provided
glDrawArrays(%GL_TRIANGLES, 1, 9)
'Force display To be drawn Now
'glFlush;
glClear(%GL_COLOR_BUFFER_BIT Or %GL_DEPTH_BUFFER_BIT)
glClearColor(1, 1, 1, 1)
glDisableClientState(%GL_VERTEX_ARRAY)
'**************************************************
End Sub
Bookmarks