In order to get back the compile and link status of GLSL shader
programs, it is necessary to use OGL calls like: void glGetObjectParameterivARB(GLhandleARB object, GLenum type, int *param); where the returned value is stored into "param" by the called subroutine. How does this work with FFI and OGLExtManager extensions? Is there a nice simple example somewhere? Thanks for any help. Dave |
On Jul 4, 2007, at 15:08 , David Faught wrote: > In order to get back the compile and link status of GLSL shader > programs, it is necessary to use OGL calls like: > > void glGetObjectParameterivARB(GLhandleARB object, GLenum type, int > *param); > > where the returned value is stored into "param" by the called > subroutine. How does this work with FFI and OGLExtManager extensions? > Is there a nice simple example somewhere? Sure. See senders of #glGenTextures:with: or #glGenFramebuffersEXT:with: etc. Basically, you just make a temporary WordArray of suitable size and pass it into the call. The address of that array will be passed to the function. Then you just return the array's first element. - Bert - |
Thanks for your quick reply!
A WordArray will work for integers, but what about a String, as in glGetInfoLogARB(anObj, length, *actualLength, *infoLog) where infolog is a String of length length? |
On Jul 4, 2007, at 16:59 , David Faught wrote: > Thanks for your quick reply! > > A WordArray will work for integers, but what about a String, as in > > glGetInfoLogARB(anObj, length, *actualLength, *infoLog) Pass a ByteArray. - Bert - |
Thanks again, Bert!
I think I have it correct, but apparently NVidia GLSL compiles are not very wordy. I'm getting back an error status and an infoLog length of 1 (which is a little short), but when I try to get back the infoLog, the actualLength WordArray and the infoLog ByteArray both have a length of zero. Oh well! I was going to put my latest code on the Croquet repository again, but it looks like it's down at the moment. I guess it will have to wait. |
I've had success reading the length into an integer array:
length := IntegerArray new: 1. ogl glGetObjectParameterivARB: object with: GLObjectInfoLogLengthARB with: length. and then reading into heap-allocated memory: addr := ExternalAddress allocate: (length at: 1). data := ExternalData fromHandle: addr type: ExternalType char asPointerType. ogl glGetInfoLogARB: object with: (length at: 1) with: length with: data. string := data fromCString. (of course, remember to free the memory you allocated) Was this useful? Josh On Jul 4, 2007, at 9:27 AM, David Faught wrote: > Thanks again, Bert! > > I think I have it correct, but apparently NVidia GLSL compiles are > not very > wordy. I'm getting back an error status and an infoLog length of 1 > (which is a > little short), but when I try to get back the infoLog, the > actualLength > WordArray and the infoLog ByteArray both have a length of zero. Oh > well! > > I was going to put my latest code on the Croquet repository again, > but it looks > like it's down at the moment. I guess it will have to wait. |
Thanks Josh!
That also seems to work just fine, but I get the same results. After the glGetObjectParameterivARB call, the (length at:1) equals 1 and after the glGetInfoLogARB call it equals 0. And I know that there is a syntax error in the compile because I put it there. I think it's just NVidia's way of supporting GLSL ;-) On 7/4/07, Joshua Gargus <[hidden email]> wrote: > I've had success reading the length into an integer array: > > length := IntegerArray new: 1. > ogl glGetObjectParameterivARB: object with: GLObjectInfoLogLengthARB > with: length. > > and then reading into heap-allocated memory: > > addr := ExternalAddress allocate: (length at: 1). > data := ExternalData fromHandle: addr type: ExternalType char > asPointerType. > ogl glGetInfoLogARB: object with: (length at: 1) with: length with: > data. > string := data fromCString. > > (of course, remember to free the memory you allocated) > > Was this useful? > > Josh > > > On Jul 4, 2007, at 9:27 AM, David Faught wrote: > > > Thanks again, Bert! > > > > I think I have it correct, but apparently NVidia GLSL compiles are > > not very > > wordy. I'm getting back an error status and an infoLog length of 1 > > (which is a > > little short), but when I try to get back the infoLog, the > > actualLength > > WordArray and the infoLog ByteArray both have a length of zero. Oh > > well! > > > > I was going to put my latest code on the Croquet repository again, > > but it looks > > like it's down at the moment. I guess it will have to wait. > > |
In reply to this post by Joshua Gargus-2
But that should be equivalent to
length := WordArray new: 1. ogl glGetObjectParameterivARB: object with: GLObjectInfoLogLengthARB with: length. data := ByteArray new: length first. ogl glGetInfoLogARB: object with: data size with: nil with: data. string := data asString. ... and you avoid the heap allocation and freeing. Actually FFI should allow to pass a ByteString for a ByteArray but I'm not sure it does. - Bert - On Jul 4, 2007, at 18:44 , Joshua Gargus wrote: > I've had success reading the length into an integer array: > > length := IntegerArray new: 1. > ogl glGetObjectParameterivARB: object with: > GLObjectInfoLogLengthARB with: length. > > and then reading into heap-allocated memory: > > addr := ExternalAddress allocate: (length at: 1). > data := ExternalData fromHandle: addr type: ExternalType char > asPointerType. > ogl glGetInfoLogARB: object with: (length at: 1) with: length > with: data. > string := data fromCString. > > (of course, remember to free the memory you allocated) > > Was this useful? > > Josh > > > On Jul 4, 2007, at 9:27 AM, David Faught wrote: > >> Thanks again, Bert! >> >> I think I have it correct, but apparently NVidia GLSL compiles are >> not very >> wordy. I'm getting back an error status and an infoLog length of 1 >> (which is a >> little short), but when I try to get back the infoLog, the >> actualLength >> WordArray and the infoLog ByteArray both have a length of zero. >> Oh well! >> >> I was going to put my latest code on the Croquet repository again, >> but it looks >> like it's down at the moment. I guess it will have to wait. > |
In reply to this post by David Faught
Well, after re-reading NVidia's support docs, release notes, etc. I'm
thinking that it is possible that I need to upgrade the OGL extension definitions for GLSL. Apparently the stuff that Tobias gave me a couple of years ago was essentially for OGL version 1.5, where the fragment, vertex, and program definitions were there but in "ARB" status, whatever that is. In OGL version 2.0 where GLSL is officially included, a lot of the names have changed a bit (dropping the ARB suffix), and glGetInfoLogARB was split into two calls, one for shaders and one for the program objects. Maybe this makes a difference? I also found out that the NVEmulate program has a switch that turns on infoLog writing in the drivers, but what this does is write a text file in the local application directory with the infoLog data in it. It apparently has nothing to do with the API calls I'm trying to do. Maybe. On 7/4/07, David Faught <[hidden email]> wrote: > Thanks Josh! > > That also seems to work just fine, but I get the same results. After > the glGetObjectParameterivARB call, the (length at:1) equals 1 and > after the glGetInfoLogARB call it equals 0. And I know that there is > a syntax error in the compile because I put it there. I think it's > just NVidia's way of supporting GLSL ;-) > > On 7/4/07, Joshua Gargus <[hidden email]> wrote: > > I've had success reading the length into an integer array: > > > > length := IntegerArray new: 1. > > ogl glGetObjectParameterivARB: object with: GLObjectInfoLogLengthARB > > with: length. > > > > and then reading into heap-allocated memory: > > > > addr := ExternalAddress allocate: (length at: 1). > > data := ExternalData fromHandle: addr type: ExternalType char > > asPointerType. > > ogl glGetInfoLogARB: object with: (length at: 1) with: length with: > > data. > > string := data fromCString. > > > > (of course, remember to free the memory you allocated) > > > > Was this useful? > > > > Josh > > > > > > On Jul 4, 2007, at 9:27 AM, David Faught wrote: > > > > > Thanks again, Bert! > > > > > > I think I have it correct, but apparently NVidia GLSL compiles are > > > not very > > > wordy. I'm getting back an error status and an infoLog length of 1 > > > (which is a > > > little short), but when I try to get back the infoLog, the > > > actualLength > > > WordArray and the infoLog ByteArray both have a length of zero. Oh > > > well! > > > > > > I was going to put my latest code on the Croquet repository again, > > > but it looks > > > like it's down at the moment. I guess it will have to wait. > > > > > |
In reply to this post by Bert Freudenberg
I don't remember quite how I hacked my way to the code I wrote below
(FFI is still a bit magic to me, although I understand it much better than I used to). Your way looks like it should work too, and is definitely nicer than mine if it does. Thanks, Josh On Jul 4, 2007, at 12:18 PM, Bert Freudenberg wrote: > But that should be equivalent to > > length := WordArray new: 1. > ogl glGetObjectParameterivARB: object with: > GLObjectInfoLogLengthARB with: length. > > data := ByteArray new: length first. > ogl glGetInfoLogARB: object with: data size with: nil with: data. > string := data asString. > > ... and you avoid the heap allocation and freeing. Actually FFI > should allow to pass a ByteString for a ByteArray but I'm not sure > it does. > > - Bert - > > On Jul 4, 2007, at 18:44 , Joshua Gargus wrote: > >> I've had success reading the length into an integer array: >> >> length := IntegerArray new: 1. >> ogl glGetObjectParameterivARB: object with: >> GLObjectInfoLogLengthARB with: length. >> >> and then reading into heap-allocated memory: >> >> addr := ExternalAddress allocate: (length at: 1). >> data := ExternalData fromHandle: addr type: ExternalType char >> asPointerType. >> ogl glGetInfoLogARB: object with: (length at: 1) with: length >> with: data. >> string := data fromCString. >> >> (of course, remember to free the memory you allocated) >> >> Was this useful? >> >> Josh >> >> >> On Jul 4, 2007, at 9:27 AM, David Faught wrote: >> >>> Thanks again, Bert! >>> >>> I think I have it correct, but apparently NVidia GLSL compiles >>> are not very >>> wordy. I'm getting back an error status and an infoLog length of >>> 1 (which is a >>> little short), but when I try to get back the infoLog, the >>> actualLength >>> WordArray and the infoLog ByteArray both have a length of zero. >>> Oh well! >>> >>> I was going to put my latest code on the Croquet repository >>> again, but it looks >>> like it's down at the moment. I guess it will have to wait. >> > > > > |
Oh hurray! I finally got the infoLog to work properly without needing to
upgrade everything! All it took was rereading the tutorial I was following for the umteenth time and trying yet another variation of the code ;-) Actually, who would have thought that error=GLtrue means things worked okay and error=GLfalse means they didn't? Having the condition reversed is why I kept getting zero length messages. Duh ... |
Free forum by Nabble | Edit this page |