First of all thanks a lot for the in-depth answer. It's kinda tough to get
started with Factor because of the relative lack of examples (though the extra
workspace has been very helpful), but I am making fast progress.
I haven't been able to get OGL 3.2 to work though. I added the core-profile
symbol in ui.pixel-formats, then I added in cocoa.views:
CONSTANT: NSOpenGLPFAOpenGLProfile 99
CONSTANT: NSOpenGLProfileVersionLegacy 0x1000
CONSTANT: NSOpenGLProfileVersion3_2Core 0x3200
and in ui.backend.cocoa to the PIXEL-FORMAT-ATTRIBUTE-TABLE:
{ core-profile { $ NSOpenGLPFAOpenGLProfile $
NSOpenGLProfileVersion3_2Core } }
Now I just get a invalid-pixel-format-attributes error.
OpenGL 3.2 would be nice to have for the newer GLSL version, 1.20 seems very
restrictive.
In the meantime I have been continuing on my Windows machine and run into
anther problem:
http://paste.factorcode.org/paste?id=2777
This is basically just a more or less straight port from this tutorial
(https://bitbucket.org/alfonse/gltut/src/3ee6f3dd04a7/Tut%2001%20Hello%20Triangle/tut1.cpp?at=default).
The line that bothers Factor is:
0 4 GL_FLOAT GL_FALSE 0 0 glVertexAttribPointer
To be exact the last parameter, which yields this error:
Generic word underlying>> does not define a method for the fixnum class.
Dispatching on object: 0
I'm not sure exactly what it is expecting since the word glVertexAttribPointer
is a few layers removed from the plain C function which makes it hard for me to
understand. Stepping through everything just leads through a hundred utility
words I don't know the effect of.
Anyways I hope someone has an answer to this, I searched the whole Factor
source code and couldn't find a single use of glVertexAttribPointer to
reference. Thank you very much in advance!
On 11.10.2012, at 18:40, Joe Groff <arc...@gmail.com> wrote:
> On Thu, Oct 11, 2012 at 8:39 AM, PGGB <grizzlysc...@gmail.com> wrote:
>> I've been messing around with Factor the last couple weeks and it is a lot
>> of fun. At the same time I am learning some graphics programming with
>> OpenGL. Now even though version 3.2 was added with Lion, the windows Factor
>> creates only seem to allow version 2.1.
>>
>> I was looking for a way to add the required flag but my knowledge of both
>> Cocoa and Factor is to small to really know what I am doing. Does anyone
>> have any suggestions?
>
> OS X only supports core profile OpenGL 3.2, so to get a 3.2-capable
> context, you have to ask for one explicitly by initializing the
> NSOpenGLPixelFormat with these attributes:
>
> ```
> NSOpenGLPixelFormatAttribute pfa[] = {
> /* ... other attributes ... */
> NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
> 0
> };
> ```
>
> You could make this work in Factor by adding a `core-profile` symbol
> to `ui.pixel-formats`, and updating `ui.backend.cocoa` to use those
> pixel format attributes. You could then create a core profile window
> with this code:
>
> ```
> USE: ui.gadgets.worlds.null
> <world-attributes>
> "Core Profile World" >>title
> null-world >>world-class
> {
> windowed
> double-buffered
> backing-store
> T{ depth-bits f 24 }
> core-profile
> } >>pixel-format-attributes
> { 512 512 } >>pref-dim
> f swap open-window*
> ```
>
> That will open a window and leave the window object on the listener's
> stack. You can then use `into-window` to send GL commands to the
> window interactively:
>
> ```
> dup [ 1.0 1.0 0.0 0.0 glClearColor GL_COLOR_BUFFER_BIT glClear ] into-window
> ```
>
> Note that, although compatibility profile contexts in OS X report 2.1,
> on most 3.2-capable graphics cards, all of the 3.2 features are also
> supported by ARB extensions to 2.1, and Factor's OpenGL binding is
> smart enough to substitute ARB or EXT entry points for standardized
> entry points when the standard entry points are unavailable. If you
> can't get core profile mode to work, you should be able to write 3.2
> code and have it still just work, if your graphics driver supports
> 3.2.
>
> -Joe
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk