Have Byte Ptr , need Float Ptr
BlitzMax Forums/BlitzMax Beginners Area/Have Byte Ptr , need Float Ptr
| ||
glMap2f takes a Float Ptr as last argument it seems, I have my float data in a bank, I can get the Byte Ptr but BM says 'unable to convert form Byte Ptr to Float Ptr' How do I make a Float Ptr to a bank ? |
| ||
I'm pretty sure you can cast variables. Can you post some code to illustrate the problem? |
| ||
Local mybank mybank=CreateBank(192) Local bufPtr:Byte Ptr bufPtr= BankBuf(mybank) glMap2f GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, bufPtr |
| ||
untested...Local a:Byte Ptr Local b:Float Ptr=Float Ptr(a) |
| ||
@skidracer : wont that give me a pointer to a, not to the data a is pointing at? |
| ||
That does look more like **a (to use C syntax) but I think his example is to show a cast of a into a float pointer. |
| ||
Hi, Skids correct, ie: mybank=CreateBank(192) Local bufPtr:Byte Ptr bufPtr= BankBuf(mybank) glMap2f GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4, Float Ptr( bufPtr ) |
| ||
Ok, thanks, I'll try that out! |
| ||
Thanks. That worked well. Now I have a type that I want to send to glMaterialfv glMaterialfv declare is: Function glMaterialfv(face_,pname_,params_:Float Ptr) Type color4f Field r#,g#,b#,a# End Type Local ambient:color4f = New color4f ambient.r=0.2 ambient.g=0.2 ambient.b=0.2 ambient.a=1 All these gives an errors: glLightfv(GL_LIGHT0, GL_AMBIENT, ambient) glLightfv(GL_LIGHT0, GL_AMBIENT, Float Ptr(ambient)) glLightfv(GL_LIGHT0, GL_AMBIENT, Float Ptr(ambient.r)) [EDIT] glLightfv(GL_LIGHT0, GL_AMBIENT, Varptr(ambient.r)) seems ok, but not too elegant ? |
| ||
See what it was for here: Utah Teapot for BlitzMax - http://www.blitzbasic.com/Community/posts.php?topic=41645 |