On 9 June 2013 20:47, kilon <[email protected]> wrote: > Ok I am moving towards the direction you indicated , its just takes time > because I am clueless. > > Af far as macos is concerned I was sucessful into intialising opengl context > following your instructions and using clearColor assigned green-blue > background to it. Works like a charm even changing the code updates the > window to the corresponding color, live coding in all its glory. I am having > tons of fun with it. > > I have a strange bug , well it seems that opengl looses a connection with > memory and i have to reinitialize my GLTutorial1 class and pops a > framebuffer error. It does it only after some time passes and pharo is idle, > its a strange bug, but if it starts appearing again I will try to pin point > it, because my code is not up to the opengl standards yet so it may be me > that cause this issue. > > My problem right now is that I follow the tutorial at arcsynth and I am > stuck here > > http://www.arcsynthesis.org/gltut/Basics/Tut01%20Following%20the%20Data.html > <http://www.arcsynthesis.org/gltut/Basics/Tut01%20Following%20the%20Data.html> > > glBufferData(GL_ARRAY_BUFFER, sizeof(vertexPositions), vertexPositions, > GL_STATIC_DRAW); > > the question is how i find the size in smalltalk . There is > bufferData_target: size: data: usage: which corresponds to that function > but I have no idea how to convert sizeof() to smalltalk. Any clues ? >
Yes. (NBExternalType sizeOf: 'float') * number of floats in your buffer or (NBExternalType sizeOf: 'double') * number of floats in your buffer For arrays of static type, i would recommend you using NBExternalArray, which gives you a convenient way to deal with arrays of any static type in smalltalk way. For passing it as argument to function you can use 'array address' idiom. See class comments for details. Btw, getting the size of array, in bytes, would be: sizeInBytes ^ self size * self class elementSize (i think this method would be nice to have). > If you want to see my code I have commited it in NBOpengl smalltalkhub the > latest is NBOpenGL-Morphic-kilon.10 for NBOpenGL-Morphic. > > > > -- > View this message in context: > http://forum.world.st/Understanding-NBOpenGL-tp4686514p4692494.html > Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com. > -- Best regards, Igor Stasenko.
