[Pharo-project] more evidence that I am a newbie
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0... (Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'. (Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'. OpenGL example I wasn't quite sure how to load them with Gofer so I did it manually with Monticello. However, when I "doIt" with 'OpenGL example' I get the error: MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example No doubt its something totally trivial... Suggestions? Lawson
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') Â install: 'FFI-Pools'; Â install: 'FFI-Kernel'; Â install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') Â install: '3DTransform'; Â install: 'OpenGL-Pools'; Â install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Lawson
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Easy... TOO easy... :-) Lawson
On 15.04.2010 22:47, Lawson English wrote:
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Easy... TOO easy... :-)
Lawson SMALLTALK easy! :D
Cheers, Henry
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Unfortunately lots of nested references to it, starting with Smalltalk platformName. I can get as far as changing it to SmalltalkImage current platformName but things get strange after that... new Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize]. Smalltalk platformName = 'unix' ifTrue: [(Smalltalk windowSystemName = 'Quartz') "implicitly big endian" ifTrue: [^OGLUnixQuartz basicNew initialize]. "default to X11 window system" Smalltalk isLittleEndian ifTrue: [^OGLUnixX11LE basicNew initialize] ifFalse: [^OGLUnixX11BE basicNew initialize]]. Smalltalk platformName = 'Mac OS' ifTrue:[ Smalltalk osVersion asNumber < 1000 ifTrue: [^OGLMacOS9 basicNew initialize] ifFalse:[^OGLMacOSX basicNew initialize]. ]. ^self error:'Cannot identify platform'
On 16.04.2010 01:10, Lawson English wrote:
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Unfortunately lots of nested references to it, starting with Smalltalk platformName.
I can get as far as changing it to SmalltalkImage current platformName but things get strange after that...
new Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize]. Smalltalk platformName = 'unix' ifTrue: [(Smalltalk windowSystemName = 'Quartz') "implicitly big endian" ifTrue: [^OGLUnixQuartz basicNew initialize]. "default to X11 window system" Smalltalk isLittleEndian ifTrue: [^OGLUnixX11LE basicNew initialize] ifFalse: [^OGLUnixX11BE basicNew initialize]]. Smalltalk platformName = 'Mac OS' ifTrue:[ Smalltalk osVersion asNumber < 1000 ifTrue: [^OGLMacOS9 basicNew initialize] ifFalse:[^OGLMacOSX basicNew initialize]. ]. ^self error:'Cannot identify platform' Try replacing windowSystemName with (SmalltalkImage current getSystemAttribute: 1005).
1.0 (1.1 too, actually) does not include some of the abstraction methods introduced in Squeak, which OpenGL uses. Cheers, Henry
Henrik Sperre Johansen wrote:
On 16.04.2010 01:10, Lawson English wrote:
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Unfortunately lots of nested references to it, starting with Smalltalk platformName.
I can get as far as changing it to SmalltalkImage current platformName but things get strange after that...
new Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize]. Smalltalk platformName = 'unix' ifTrue: [(Smalltalk windowSystemName = 'Quartz') "implicitly big endian" ifTrue: [^OGLUnixQuartz basicNew initialize]. "default to X11 window system" Smalltalk isLittleEndian ifTrue: [^OGLUnixX11LE basicNew initialize] ifFalse: [^OGLUnixX11BE basicNew initialize]]. Smalltalk platformName = 'Mac OS' ifTrue:[ Smalltalk osVersion asNumber < 1000 ifTrue: [^OGLMacOS9 basicNew initialize] ifFalse:[^OGLMacOSX basicNew initialize]. ]. ^self error:'Cannot identify platform' Try replacing windowSystemName with (SmalltalkImage current getSystemAttribute: 1005).
1.0 (1.1 too, actually) does not include some of the abstraction methods introduced in Squeak, which OpenGL uses.
Sob... Almost... Worked my way through everything and now it blows up AFTER reserving an OGL context (there's an blank rectangle in the window at least) with the error: improper store into indexable object at the line ensure:[ogl destroy]. in OpenGL>>example example "OpenGL example" "A very simple OpenGL example" | ogl frames startTime deltaTime framesPerSec bounds font | font := StrikeFont familyName: 'Atlanta' pointSize: 11. bounds := 0@0 extent: 400@400. ogl := OpenGL newIn: bounds. ogl ifNil:[^self error: 'Unable to create renderer']. [frames := 0. startTime := Time millisecondClockValue. [Sensor anyButtonPressed] whileFalse:[ "start counting at second frame since first frame is penalized by the upload of the bitmap font outside of ogl." frames = 1 ifTrue:[startTime := Time millisecondClockValue]. ogl beginFrame. "--- this is the actual scene content ---" ogl glDisable: GLDepthTest. "for the simple example only" ogl glDisable: GLLighting. "for the simple example only" ogl glClearColor: 1.0 with: 1.0 with: 1.0 with: 1.0. ogl glClear: GLColorBufferBit. ogl glRotatef: 5.0 with: 0.0 with: 0.0 with: 1.0. ogl glColor3f: 1.0 with: 0.0 with: 0.0. ogl glBegin: GLPolygon. ogl glVertex2f: -0.7 with: -0.7. ogl glVertex2f: 0.7 with: -0.7. ogl glVertex2f: 0.7 with: 0.7. ogl glVertex2f: -0.7 with: 0.7. ogl glEnd. "--- here is the 2d overlay setup ---" ogl glMatrixMode: GLProjection. ogl glPushMatrix. ogl glLoadIdentity. ogl glMatrixMode: GLModelview. ogl glPushMatrix. ogl glLoadIdentity. ogl glTranslated: -1 with: 1 with: 0.0. ogl glScaled: (2.0 / bounds width) with: (-2.0 / bounds height) with: 1.0. ogl glDisable: GLDepthTest. ogl glEnable: GLBlend. ogl glBlendFunc: GLOne with: GLOneMinusSrcAlpha. "--- here is the 2d overlay rendering ---" deltaTime := Time millisecondsSince: startTime. framesPerSec := frames * 1000 / (deltaTime max: 1) asFloat. "@@@@: Fixme. It appears as if #drawString: depends on glColor being set. Makes no sense but I'm not going to figure this out - probably some mishap wrt. GLLighting being disabled." ogl glColor3f: 0.0 with: 0.0 with: 0.0. ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black. ogl glDisable: GLBlend. ogl glMatrixMode: GLModelview. ogl glPopMatrix. ogl glMatrixMode: GLProjection. ogl glPopMatrix. ogl glMatrixMode: GLModelview. "--- end the end frame operations" ogl endFrame. ogl swapBuffers. frames := frames + 1. ]. ] ensure:[ogl destroy].
Lawson English wrote:
Sob... Almost...
Worked my way through everything and now it blows up AFTER reserving an OGL context (there's an blank rectangle in the window at least) with the error:
improper store into indexable object
my bad. Was at ', (framesPerSec truncateTo: 0.1), in line ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black.
in OpenGL>>example
example "OpenGL example" "A very simple OpenGL example"
| ogl frames startTime deltaTime framesPerSec bounds font | font := StrikeFont familyName: 'Atlanta' pointSize: 11. bounds := 0@0 extent: 400@400. ogl := OpenGL newIn: bounds. ogl ifNil:[^self error: 'Unable to create renderer']. [frames := 0. startTime := Time millisecondClockValue. [Sensor anyButtonPressed] whileFalse:[ "start counting at second frame since first frame is penalized by the upload of the bitmap font outside of ogl." frames = 1 ifTrue:[startTime := Time millisecondClockValue]. ogl beginFrame.
"--- this is the actual scene content ---"
ogl glDisable: GLDepthTest. "for the simple example only" ogl glDisable: GLLighting. "for the simple example only"
ogl glClearColor: 1.0 with: 1.0 with: 1.0 with: 1.0. ogl glClear: GLColorBufferBit.
ogl glRotatef: 5.0 with: 0.0 with: 0.0 with: 1.0. ogl glColor3f: 1.0 with: 0.0 with: 0.0.
ogl glBegin: GLPolygon. ogl glVertex2f: -0.7 with: -0.7. ogl glVertex2f: 0.7 with: -0.7. ogl glVertex2f: 0.7 with: 0.7. ogl glVertex2f: -0.7 with: 0.7. ogl glEnd.
"--- here is the 2d overlay setup ---"
ogl glMatrixMode: GLProjection. ogl glPushMatrix. ogl glLoadIdentity. ogl glMatrixMode: GLModelview. ogl glPushMatrix. ogl glLoadIdentity. ogl glTranslated: -1 with: 1 with: 0.0. ogl glScaled: (2.0 / bounds width) with: (-2.0 / bounds height) with: 1.0. ogl glDisable: GLDepthTest. ogl glEnable: GLBlend. ogl glBlendFunc: GLOne with: GLOneMinusSrcAlpha.
"--- here is the 2d overlay rendering ---" deltaTime := Time millisecondsSince: startTime. framesPerSec := frames * 1000 / (deltaTime max: 1) asFloat. "@@@@: Fixme. It appears as if #drawString: depends on glColor being set. Makes no sense but I'm not going to figure this out - probably some mishap wrt. GLLighting being disabled." ogl glColor3f: 0.0 with: 0.0 with: 0.0. ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black.
ogl glDisable: GLBlend. ogl glMatrixMode: GLModelview. ogl glPopMatrix. ogl glMatrixMode: GLProjection. ogl glPopMatrix. ogl glMatrixMode: GLModelview.
"--- end the end frame operations"
ogl endFrame. ogl swapBuffers. frames := frames + 1. ]. ] ensure:[ogl destroy].
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Lawson English wrote:
Lawson English wrote:
Sob... Almost...
Worked my way through everything and now it blows up AFTER reserving an OGL context (there's an blank rectangle in the window at least) with the error:
improper store into indexable object
my bad. Was at
', (framesPerSec truncateTo: 0.1),
in line
ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black. Sobs again. reran code again and the error line was indeed
] ensure:[ogl destroy]. shrug.
On 16 April 2010 03:32, Lawson English <lenglish5@cox.net> wrote:
Henrik Sperre Johansen wrote:
 On 16.04.2010 01:10, Lawson English wrote:
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') Â install: 'FFI-Pools'; Â install: 'FFI-Kernel'; Â install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') Â install: '3DTransform'; Â install: 'OpenGL-Pools'; Â install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Unfortunately lots of nested references to it, starting with Smalltalk platformName.
I can get as far as changing it to SmalltalkImage current platformName but things get strange after that...
new  Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize].  Smalltalk platformName = 'unix'    ifTrue:      [(Smalltalk windowSystemName = 'Quartz')        "implicitly big endian"        ifTrue: [^OGLUnixQuartz basicNew initialize].        "default to X11 window system"        Smalltalk isLittleEndian          ifTrue: [^OGLUnixX11LE basicNew initialize]          ifFalse: [^OGLUnixX11BE basicNew initialize]].  Smalltalk platformName = 'Mac OS' ifTrue:[    Smalltalk osVersion asNumber < 1000      ifTrue: [^OGLMacOS9 basicNew initialize]      ifFalse:[^OGLMacOSX basicNew initialize].  ].  ^self error:'Cannot identify platform'
Try replacing windowSystemName with (SmalltalkImage current getSystemAttribute: 1005).
1.0 (1.1 too, actually) does not include some of the abstraction methods introduced in Squeak, which OpenGL uses.
Sob... Almost...
Worked my way through everything and now it blows up AFTER reserving an OGL context (there's an blank rectangle in the window at least) with the error:
improper store into indexable object
at the line  ensure:[ogl destroy].
in OpenGL>>example
example   "OpenGL example"  "A very simple OpenGL example"
 | ogl frames startTime deltaTime framesPerSec bounds font |  font := StrikeFont familyName: 'Atlanta' pointSize: 11.  bounds := 0@0 extent: 400@400.  ogl := OpenGL newIn: bounds.  ogl ifNil:[^self error: 'Unable to create renderer'].  [frames := 0.  startTime := Time millisecondClockValue.  [Sensor anyButtonPressed] whileFalse:[    "start counting at second frame since first frame is penalized    by the upload of the bitmap font outside of ogl."    frames = 1 ifTrue:[startTime := Time millisecondClockValue].    ogl beginFrame.
 "--- this is the actual scene content ---"
   ogl glDisable: GLDepthTest.   "for the simple example only"    ogl glDisable: GLLighting.     "for the simple example only"
   ogl glClearColor: 1.0 with: 1.0 with: 1.0 with: 1.0.    ogl glClear: GLColorBufferBit.
   ogl glRotatef: 5.0 with: 0.0 with: 0.0 with: 1.0.    ogl glColor3f: 1.0 with: 0.0 with: 0.0.
   ogl glBegin: GLPolygon.      ogl glVertex2f: -0.7 with: -0.7.      ogl glVertex2f:  0.7 with: -0.7.      ogl glVertex2f:  0.7 with:  0.7.      ogl glVertex2f: -0.7 with:  0.7.    ogl glEnd.
 "--- here is the 2d overlay setup ---"
   ogl glMatrixMode: GLProjection.    ogl glPushMatrix.    ogl glLoadIdentity.    ogl glMatrixMode: GLModelview.    ogl glPushMatrix.    ogl glLoadIdentity.    ogl glTranslated: -1 with: 1 with: 0.0.    ogl glScaled: (2.0 / bounds width) with: (-2.0 / bounds height) with: 1.0.    ogl glDisable: GLDepthTest.    ogl glEnable: GLBlend.    ogl glBlendFunc: GLOne with: GLOneMinusSrcAlpha.
 "--- here is the 2d overlay rendering ---"    deltaTime := Time millisecondsSince: startTime.    framesPerSec := frames * 1000 / (deltaTime max: 1) asFloat.       "@@@@: Fixme. It appears as if #drawString: depends on glColor being set.    Makes no sense but I'm not going to figure this out - probably some mishap    wrt. GLLighting being disabled."
it makes sense. The font is a bit mask, which defines an opaque and (semi)transparent pixels, not black and white ones. So, you need to provide a color, which will be used to paint opaque pixels.
   ogl glColor3f: 0.0 with: 0.0 with: 0.0.    ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps'      at: 0@font height@0 font: font color: Color black.
   ogl glDisable: GLBlend.    ogl glMatrixMode: GLModelview.    ogl glPopMatrix.    ogl glMatrixMode: GLProjection.    ogl glPopMatrix.    ogl glMatrixMode: GLModelview.
 "--- end the end frame operations"
   ogl endFrame.    ogl swapBuffers.    frames := frames + 1.  ].  ] ensure:[ogl destroy].
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
Igor Stasenko wrote:
On 16 April 2010 03:32, Lawson English <lenglish5@cox.net> wrote:
Henrik Sperre Johansen wrote:
On 16.04.2010 01:10, Lawson English wrote:
Igor Stasenko wrote:
On 15 April 2010 23:02, Lawson English <lenglish5@cox.net> wrote:
I tried to load Andreas Raab's ffi-based OpenGL packages into Pharo 1.0...
(Installer repository: 'http://source.squeak.org/FFI') install: 'FFI-Pools'; install: 'FFI-Kernel'; install: 'FFI-Tests'.
(Installer repository: 'http://www.squeaksource.com/CroquetGL') install: '3DTransform'; install: 'OpenGL-Pools'; install: 'OpenGL-Core'.
OpenGL example
I wasn't quite sure how to load them with Gofer so I did it manually with Monticello.
However, when I "doIt" with 'OpenGL example'
I get the error:
MessageNotUnderstood: SystemDictionary>>platformName OpenGL class>>new OpenGL class>>newIn: OpenGL example
No doubt its something totally trivial... Suggestions?
Select a #platformname selector with mouse , and then press alt-m to see who implements that message. Then try sending it from workspace until to make sure you found right implementor. Then modify the source code in OpenGL class>>new accordingly. ;)
Unfortunately lots of nested references to it, starting with Smalltalk platformName.
I can get as far as changing it to SmalltalkImage current platformName but things get strange after that...
new Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize]. Smalltalk platformName = 'unix' ifTrue: [(Smalltalk windowSystemName = 'Quartz') "implicitly big endian" ifTrue: [^OGLUnixQuartz basicNew initialize]. "default to X11 window system" Smalltalk isLittleEndian ifTrue: [^OGLUnixX11LE basicNew initialize] ifFalse: [^OGLUnixX11BE basicNew initialize]]. Smalltalk platformName = 'Mac OS' ifTrue:[ Smalltalk osVersion asNumber < 1000 ifTrue: [^OGLMacOS9 basicNew initialize] ifFalse:[^OGLMacOSX basicNew initialize]. ]. ^self error:'Cannot identify platform'
Try replacing windowSystemName with (SmalltalkImage current getSystemAttribute: 1005).
1.0 (1.1 too, actually) does not include some of the abstraction methods introduced in Squeak, which OpenGL uses.
Sob... Almost...
Worked my way through everything and now it blows up AFTER reserving an OGL context (there's an blank rectangle in the window at least) with the error:
improper store into indexable object
at the line ensure:[ogl destroy].
in OpenGL>>example
example "OpenGL example" "A very simple OpenGL example"
| ogl frames startTime deltaTime framesPerSec bounds font | font := StrikeFont familyName: 'Atlanta' pointSize: 11. bounds := 0@0 extent: 400@400. ogl := OpenGL newIn: bounds. ogl ifNil:[^self error: 'Unable to create renderer']. [frames := 0. startTime := Time millisecondClockValue. [Sensor anyButtonPressed] whileFalse:[ "start counting at second frame since first frame is penalized by the upload of the bitmap font outside of ogl." frames = 1 ifTrue:[startTime := Time millisecondClockValue]. ogl beginFrame.
"--- this is the actual scene content ---"
ogl glDisable: GLDepthTest. "for the simple example only" ogl glDisable: GLLighting. "for the simple example only"
ogl glClearColor: 1.0 with: 1.0 with: 1.0 with: 1.0. ogl glClear: GLColorBufferBit.
ogl glRotatef: 5.0 with: 0.0 with: 0.0 with: 1.0. ogl glColor3f: 1.0 with: 0.0 with: 0.0.
ogl glBegin: GLPolygon. ogl glVertex2f: -0.7 with: -0.7. ogl glVertex2f: 0.7 with: -0.7. ogl glVertex2f: 0.7 with: 0.7. ogl glVertex2f: -0.7 with: 0.7. ogl glEnd.
"--- here is the 2d overlay setup ---"
ogl glMatrixMode: GLProjection. ogl glPushMatrix. ogl glLoadIdentity. ogl glMatrixMode: GLModelview. ogl glPushMatrix. ogl glLoadIdentity. ogl glTranslated: -1 with: 1 with: 0.0. ogl glScaled: (2.0 / bounds width) with: (-2.0 / bounds height) with: 1.0. ogl glDisable: GLDepthTest. ogl glEnable: GLBlend. ogl glBlendFunc: GLOne with: GLOneMinusSrcAlpha.
"--- here is the 2d overlay rendering ---" deltaTime := Time millisecondsSince: startTime. framesPerSec := frames * 1000 / (deltaTime max: 1) asFloat. "@@@@: Fixme. It appears as if #drawString: depends on glColor being set. Makes no sense but I'm not going to figure this out - probably some mishap wrt. GLLighting being disabled."
it makes sense. The font is a bit mask, which defines an opaque and (semi)transparent pixels, not black and white ones. So, you need to provide a color, which will be used to paint opaque pixels.
That was a comment by the original programmer. I'm hopelessly confused at this point... :-/
ogl glColor3f: 0.0 with: 0.0 with: 0.0. ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black.
ogl glDisable: GLBlend. ogl glMatrixMode: GLModelview. ogl glPopMatrix. ogl glMatrixMode: GLProjection. ogl glPopMatrix. ogl glMatrixMode: GLModelview.
"--- end the end frame operations"
ogl endFrame. ogl swapBuffers. frames := frames + 1. ]. ] ensure:[ogl destroy].
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
On 16 April 2010 03:56, Lawson English <lenglish5@cox.net> wrote:
That was a comment by the original programmer. I'm hopelessly confused at this point... :-/
I tried to run this stuff, but it ended up with 'unable to create a renderer' Strange, though VM having a required plugin B3DAcceleratorPlugin. It refuses to create GL context :( So i can't tell what really happening.. What system you are running on? -- Best regards, Igor Stasenko AKA sig.
Oh.. on a second try i passed this step. The error 'improper store' is because a mistake in given line of code: ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1), ' fps' at: 0@font height@0 font: font color: Color black. should be: ogl drawString: frames printString, ' frames: ', (framesPerSec truncateTo: 0.1) asString , ' fps' at: 0@font height@0 font: font color: Color black. but then there some other errors in #uploadFont: method. i just commented out a #flipvertically send and two lines with 'Smalltalk isLittleEndian' ... since its not important.. after that last fix it was able to run w/o errors, showing a swirling red rectangle. Here's a hacked uploadfont method. uploadFont: aFont | glFontID form | glFontID := glx glGenLists: 256. 0 to: 255 do:[:i| form := aFont characterFormAt: (i asCharacter). " form flipVertically. Smalltalk isLittleEndian ifTrue: [self swapBytesOf: form bits]." glx glNewList: glFontID+i with: GLCompile. glx glBitmap: form width with: form height with: 0 with: 0 with: form width with: 0 with: form bits. glx glEndList. " form flipVertically. Smalltalk isLittleEndian ifTrue: [self swapBytesOf: form bits]." ]. ^glFontID (btw, its a complete waste of CPU cycles to flip the form. It can be flipped by a simple glScalef(1.0, -1.0) of a texture coordinate matrix, or use a different texture coordinates :) So, a texture's up will become down and vise versa :) On 16 April 2010 04:12, Igor Stasenko <siguctua@gmail.com> wrote:
On 16 April 2010 03:56, Lawson English <lenglish5@cox.net> wrote:
That was a comment by the original programmer. I'm hopelessly confused at this point... :-/
I tried to run this stuff, but it ended up with 'unable to create a renderer' Strange, though VM having a required plugin B3DAcceleratorPlugin. It refuses to create GL context :( So i can't tell what really happening.. What system you are running on?
-- Best regards, Igor Stasenko AKA sig.
-- Best regards, Igor Stasenko AKA sig.
http://code.google.com/p/pharo/issues/detail?id=2318
new Smalltalk platformName = 'Win32' ifTrue:[^OGLWin32 basicNew initialize]. Smalltalk platformName = 'unix' ifTrue: [(Smalltalk windowSystemName = 'Quartz') "implicitly big endian" ifTrue: [^OGLUnixQuartz basicNew initialize]. "default to X11 window system" Smalltalk isLittleEndian ifTrue: [^OGLUnixX11LE basicNew initialize] ifFalse: [^OGLUnixX11BE basicNew initialize]]. Smalltalk platformName = 'Mac OS' ifTrue:[ Smalltalk osVersion asNumber < 1000 ifTrue: [^OGLMacOS9 basicNew initialize] ifFalse:[^OGLMacOSX basicNew initialize]. ]. ^self error:'Cannot identify platform' Try replacing windowSystemName with (SmalltalkImage current getSystemAttribute: 1005).
1.0 (1.1 too, actually) does not include some of the abstraction methods introduced in Squeak, which OpenGL uses.
Cheers, Henry
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (4)
-
Henrik Sperre Johansen -
Igor Stasenko -
Lawson English -
Stéphane Ducasse