RubyCocoa parameter conversion ?

T

the.rubist

hi all

i try to set the right parameter for the following Cocoa-Method with
RubyCocoa:

OSX::NSOpenGLPixelFormat.alloc.init.initWithAttributes

i don't know how i must initialize the "attribs" - parameter with
RubyCocoa. is there someone that can help me ? :)

thanks

the.rubist
 
C

Charles Steinman

the.rubist said:
i try to set the right parameter for the following Cocoa-Method with
RubyCocoa:

OSX::NSOpenGLPixelFormat.alloc.init.initWithAttributes

i don't know how i must initialize the "attribs" - parameter with
RubyCocoa.

The docs for the Objective-C version say it's a list of integers and
booleans. It looks like you'll need to define the appropriate constants
yourself (Apple's documentation has a list of them), but once you do
that, it should work pretty much as documented (assuming RubyCocoa
properly supports varargs).

By the way, you're not actually writing init.initWithAttributes, are
you?
 
T

the.rubist

thanks for info. i've tried many variants to transfer this
constant/int-array to this function with RubyCocoa, but nothing works.
yes, you're right, i've made a typo. i mean:

OSX::NSOpenGLPixelFormat.alloc.initWithAttributes( attribs )
 
T

the.rubist

someone on the mailinglist of rubycocoa helped me:

attribs = [OSX::NSOpenGLPFADoubleBuffer,
OSX::NSOpenGLPFAAccelerated,
OSX::NSOpenGLPFAColorSize, BITS_PER_PIXEL,
OSX::NSOpenGLPFADepthSize, DEPTH_SIZE, 0].pack("i*")

nsglFormat = OSX::NSOpenGLPixelFormat.alloc.initWithAttributes(
attribs )

that was the solution.
 
T

the.rubist

someone on the mailinglist of rubycocoa helped me:

attribs = [OSX::NSOpenGLPFADoubleBuffer,
OSX::NSOpenGLPFAAccelerated,
OSX::NSOpenGLPFAColorSize, BITS_PER_PIXEL,
OSX::NSOpenGLPFADepthSize, DEPTH_SIZE, 0].pack("i*")

nsglFormat = OSX::NSOpenGLPixelFormat.alloc.initWithAttributes(
attribs )

that was the solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
474,170
Messages
2,570,924
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top