The MASM Forum

General => The Workshop => Topic started by: Farabi on July 04, 2012, 12:50:57 PM

Title: [OpenGL] What Im doing wrong
Post by: Farabi on July 04, 2012, 12:50:57 PM
Anyone can notice what Im doing wrong when trying to use Vertex Buffer Object ??

Quote

invoke wglGetProcAddress,CADD("glGenBuffersARB")
      .if eax==0
         dec eax
         mov vbo_status,eax
         jmp no_vbo
      .else
         mov glGenBuffersARB,eax
         invoke wglGetProcAddress,CADD("glBindBufferARB")
         mov glBindBufferARB,eax
         invoke wglGetProcAddress,CADD("glBufferDataARB")
         mov glBufferDataARB,eax
         invoke wglGetProcAddress,CADD("glDeleteBuffersARB")
         mov glDeleteBuffersARB,eax
         
         mov edx,glGenBuffersARB
         and edx,glBindBufferARB
         and edx,glBufferDataARB
         and edx,glDeleteBuffersARB
         
         .if edx==0
            invoke MessageBox,0,CADD("One or more function is not exist, VBO Failed"),0,0
            xor eax,eax
            dec eax
            mov vbo_status,eax
            jmp no_vbo
         .endif



fglBindBufferARB proc  nTarget:dword,nbuffer:dword
   
   push nbuffer
   push nTarget
   call glBindBufferARB
   add esp,2*4
   
   ret
fglBindBufferARB endp

fglDeleteBuffersARB proc  nTarget:dword,lpbuffer:dword
   
   push lpbuffer
   push nTarget
   call glDeleteBuffersARB
   add esp,2*4
   
   ret
fglDeleteBuffersARB endp

fglGenBuffersARB proc  nSize:dword,lpbuffer:dword
   
   push lpbuffer
   push nSize
   call glGenBuffersARB
   add esp,2*4
   
   ret
fglGenBuffersARB endp

fglBufferDataARB proc  nTarget:dword,nSizei:dword,lpData:dword,nEnumUsage:dword
   
   push nEnumUsage
   push lpData
   push nSizei
   push nTarget
   call glBufferDataARB
   add esp,4*4
   
   ret
fglBufferDataARB endp

Thanks for your time.
Title: Re: [OpenGL] What Im doing wrong
Post by: qWord on July 04, 2012, 07:36:58 PM
Use a correct error detection.
Title: Re: [OpenGL] What Im doing wrong
Post by: Farabi on July 04, 2012, 08:48:42 PM
Quote from: qWord on July 04, 2012, 07:36:58 PM
Use a correct error detection.

That doesnot help  :P

Anyway I found where is my mistake.
Title: Re: [OpenGL] What Im doing wrong
Post by: qWord on July 04, 2012, 10:10:12 PM
So, what was the mistake that couldn't be detected by proper error handling?
;)
Title: Re: [OpenGL] What Im doing wrong
Post by: Farabi on July 06, 2012, 04:03:48 PM
Quote from: qWord on July 04, 2012, 10:10:12 PM
So, what was the mistake that couldn't be detected by proper error handling?
;)

I should point the buffer to a zero ID. Because the ID pointing to the GPU Memory.
I dont think there would be any error handling for such a thing.