08-12-2005, 09:14 AM
Ummm...Hi, I havent been here awhile...It was due to the fact that I had some troubles at home...and I'll try to check in once and a while to see how things are going, sooo...whats new?
Ya, I got a little openGL code problem, its a simple problem but I just dont know all of the new stuff in FB yet and how to convert C code to FB, so without further redo:
Ok, Im trying to get a certain pixel color value at a certain point in the buffer, I know this is the code to do it...I tryed to convert some of it...but mostly with no luck.
Here are my errors:
Line: glGetIntegerv GL_VIEWPORT, viewport()
Message: C:\Folder\NameofProgram.bas(LineNumber) : Warning level 0: Passing scalar as pointer, at parameter: 2
Error Message: Expected 'END SUB' or 'END FUNCTION', found: '('
Line: (Line after the first error message[glReadPixels])
Error: Array access, index expected
So? Could somebody help out and tell me what I need to do to change that code so it works?
Oh ya, here's the unmodded C version:
Thank you,
Thrawn89 (<--Thats me :wink: )
Ya, I got a little openGL code problem, its a simple problem but I just dont know all of the new stuff in FB yet and how to convert C code to FB, so without further redo:
Code:
Sub Draw_Clicked (Cursor_X As Integer, Cursor_Y As Integer)
'pushmatrix
'Some openGL drawing stuff going on here
....
'popmatrix
Dim viewport(4) As GLint
Dim pixel(3) As GLubyte
glGetIntegerv GL_VIEWPORT, viewport()
glReadPixels Cursor_X, viewport(3)-Cursor_Y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, *pixel
End Sub
Ok, Im trying to get a certain pixel color value at a certain point in the buffer, I know this is the code to do it...I tryed to convert some of it...but mostly with no luck.
Here are my errors:
Line: glGetIntegerv GL_VIEWPORT, viewport()
Message: C:\Folder\NameofProgram.bas(LineNumber) : Warning level 0: Passing scalar as pointer, at parameter: 2
Error Message: Expected 'END SUB' or 'END FUNCTION', found: '('
Line: (Line after the first error message[glReadPixels])
Error: Array access, index expected
So? Could somebody help out and tell me what I need to do to change that code so it works?
Oh ya, here's the unmodded C version:
Code:
GLint viewport[4];
GLubyte pixel[3];
glGetIntegerv(GL_VIEWPORT,viewport);
glReadPixels(cursorX,viewport[3]-cursorY,1,1, GL_RGB,GL_UNSIGNED_BYTE,(void *)pixel);
Thank you,
Thrawn89 (<--Thats me :wink: )
i]"But...it was so beautifully done"[/i]