Passing a bank to a GL function
BlitzMax Forums/BlitzMax Programming/Passing a bank to a GL function
| ||
temp:tbank=CreateBank(Len(s$)+1) PokeString temp,0,s$ glListBase listBase 'glRasterPos2f x,y glCallLists BankSize(temp)-1,GL_UNSIGNED_BYTE,bank buf(temp) I get an error on the last line: Unable to convert from 'Int' to 'Byte Ptr'. |
| ||
Try this.Local buffer@ Ptr = s.ToCString( ) ' Null-terminated glListBase( listBase ) glCallLists( s.Length, GL_UNSIGNED_BYTE, buffer ) MemFree( buffer ) |
| ||
It's because you put a space between the words `bank` and `buf`, it should be BankBuf(temp). |
| ||
How do I make this into a string? How do I make it say "Hello"? I just get an error saying "Identifier 'ToCString' not found". Local buffer@ Ptr = s.ToCString( ) ' Null-terminated glListBase( listBase ) glCallLists( s.Length, GL_UNSIGNED_BYTE, buffer ) MemFree( buffer ) |
| ||
Assuming s is a string, that will create a null-terminated C string (strings in BMax use UTF-16). Aside from that, I'm not sure what you're asking now. |
| ||
s has to be an already created string. local s = "Test string" Local buffer@ Ptr = s.ToCString( ) ' Null-terminated glListBase( listBase ) glCallLists( s.Length, GL_UNSIGNED_BYTE, buffer ) MemFree( buffer ) or you could do it on a string constant, local buffer:Byte ptr = "Test string.".toCstring() |