COpenGLPlayer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

COpenGLPlayer

David Faught
Here is a hopefully-small-enough-not-to-bother-anyone screenshot of an
SDK image Tweak-based OpenGL CPlayer running the code from the NeHe
OpenGL tutorial number 5 (or maybe now it's 6).  Not knowing what I'm
doing with OpenGL, it was a little bit difficult to get enough of the
initialization code presented in the earlier tutorials to work
properly with a lack of any platform-dependent code.  I finally got it
to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
which I'm not sure is really kosher since it has a (software
emulated?) call to a glu... method.

ScreenShot013.png (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

Joshua Gargus-2
Very nice, David!

I think that it's really handy to be able to futz around with OpenGL  
in Squeak without having to haul in all of Croquet.

Josh


On May 30, 2007, at 6:54 PM, David Faught wrote:

> Here is a hopefully-small-enough-not-to-bother-anyone screenshot of an
> SDK image Tweak-based OpenGL CPlayer running the code from the NeHe
> OpenGL tutorial number 5 (or maybe now it's 6).  Not knowing what I'm
> doing with OpenGL, it was a little bit difficult to get enough of the
> initialization code presented in the earlier tutorials to work
> properly with a lack of any platform-dependent code.  I finally got it
> to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
> which I'm not sure is really kosher since it has a (software
> emulated?) call to a glu... method.
> <ScreenShot013.png>

Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

Peter Moore-5
Cool. I'd like to play around with this if you don't mind sending me  
a changeset, or putting something into Contributions. Thanks David.

-Peter

On May 30, 2007, at 9:33 PM, Joshua Gargus wrote:

> Very nice, David!
>
> I think that it's really handy to be able to futz around with  
> OpenGL in Squeak without having to haul in all of Croquet.
>
> Josh
>
>
> On May 30, 2007, at 6:54 PM, David Faught wrote:
>
>> Here is a hopefully-small-enough-not-to-bother-anyone screenshot  
>> of an
>> SDK image Tweak-based OpenGL CPlayer running the code from the NeHe
>> OpenGL tutorial number 5 (or maybe now it's 6).  Not knowing what I'm
>> doing with OpenGL, it was a little bit difficult to get enough of the
>> initialization code presented in the earlier tutorials to work
>> properly with a lack of any platform-dependent code.  I finally  
>> got it
>> to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
>> which I'm not sure is really kosher since it has a (software
>> emulated?) call to a glu... method.
>> <ScreenShot013.png>
>

Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

Bert Freudenberg
In reply to this post by David Faught

On May 31, 2007, at 3:54 , David Faught wrote:

> Here is a hopefully-small-enough-not-to-bother-anyone screenshot of an
> SDK image Tweak-based OpenGL CPlayer running the code from the NeHe
> OpenGL tutorial number 5 (or maybe now it's 6).

Cool!

>   Not knowing what I'm
> doing with OpenGL, it was a little bit difficult to get enough of the
> initialization code presented in the earlier tutorials to work
> properly with a lack of any platform-dependent code.

Interesting. So you did that on your own, not based on my old  
COpenGLPlayer?

http://permalink.gmane.org/gmane.comp.lang.smalltalk.tweak/198

> I finally got it
> to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
> which I'm not sure is really kosher since it has a (software
> emulated?) call to a glu... method.
> <ScreenShot013.png>

Why shouldn't that be kosher? Nehe has a call to gluPerspective(),  
too ...

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
On 5/31/07, Bert Freudenberg <[hidden email]> wrote:

> On May 31, 2007, at 3:54 , David Faught wrote:
> >   Not knowing what I'm
> > doing with OpenGL, it was a little bit difficult to get enough of the
> > initialization code presented in the earlier tutorials to work
> > properly with a lack of any platform-dependent code.
>
> Interesting. So you did that on your own, not based on my old
> COpenGLPlayer?
>
> http://permalink.gmane.org/gmane.comp.lang.smalltalk.tweak/198

It IS based on your COpenGLPlayer (in fact, really this should have
been a subclass of that instead of just outright replacing the
rendering code), but I couldn't get it to work properly with the
viewport and frustum setup from that for some reason.

> > I finally got it
> > to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
> > which I'm not sure is really kosher since it has a (software
> > emulated?) call to a glu... method.
> > <ScreenShot013.png>
>
> Why shouldn't that be kosher? Nehe has a call to gluPerspective(),
> too ...

But glu* calls are typically for a platform-specific library, aren't
they?  And I noticed that this method is the only glu* method
available and is actually coded in Squeak rather than being an
external library like one might expect.  So I guess it's okay, but
other glu* calls are not available.
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

Bert Freudenberg
On May 31, 2007, at 14:23 , David Faught wrote:

> On 5/31/07, Bert Freudenberg <[hidden email]> wrote:
>> On May 31, 2007, at 3:54 , David Faught wrote:
>> >   Not knowing what I'm
>> > doing with OpenGL, it was a little bit difficult to get enough  
>> of the
>> > initialization code presented in the earlier tutorials to work
>> > properly with a lack of any platform-dependent code.
>>
>> Interesting. So you did that on your own, not based on my old
>> COpenGLPlayer?
>>
>> http://permalink.gmane.org/gmane.comp.lang.smalltalk.tweak/198
>
> It IS based on your COpenGLPlayer (in fact, really this should have
> been a subclass of that instead of just outright replacing the
> rendering code),

Nah, this was just a quick hack anyway. I'm glad someone is putting  
it to some sensible use.

> but I couldn't get it to work properly with the
> viewport and frustum setup from that for some reason.

I see ... well my setup code was just for 2D rendering IIRC.

>> > I finally got it
>> > to work by using the OpenGL#initFrustum:bounds:zNear:zFar: method,
>> > which I'm not sure is really kosher since it has a (software
>> > emulated?) call to a glu... method.
>> > <ScreenShot013.png>
>>
>> Why shouldn't that be kosher? Nehe has a call to gluPerspective(),
>> too ...
>
> But glu* calls are typically for a platform-specific library, aren't
> they?  And I noticed that this method is the only glu* method
> available and is actually coded in Squeak rather than being an
> external library like one might expect.  So I guess it's okay, but
> other glu* calls are not available.

GLU is the OpenGL Utility library and actually is cross-platform (it  
only uses GL functions). See

        http://www.opengl.org/documentation/specs/

It's just that it is not strictly necessary because all of its  
functions can be written in Smalltalk and we didn't want to bother  
with two libraries if one suffices ...

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
On 5/31/07, Bert Freudenberg <[hidden email]> wrote:

> On May 31, 2007, at 14:23 , David Faught wrote:
> > On 5/31/07, Bert Freudenberg <[hidden email]> wrote:
> >> On May 31, 2007, at 3:54 , David Faught wrote:
> >> >   Not knowing what I'm
> >> > doing with OpenGL, it was a little bit difficult to get enough
> >> of the
> >> > initialization code presented in the earlier tutorials to work
> >> > properly with a lack of any platform-dependent code.
> >>
> >> Interesting. So you did that on your own, not based on my old
> >> COpenGLPlayer?
> >>
> >> http://permalink.gmane.org/gmane.comp.lang.smalltalk.tweak/198
> >
> > It IS based on your COpenGLPlayer (in fact, really this should have
> > been a subclass of that instead of just outright replacing the
> > rendering code),
>
> Nah, this was just a quick hack anyway. I'm glad someone is putting
> it to some sensible use.

That along with your quick hack to get the global screen position
correct based on the differences in the mouse pointer position.  Your
quick hacks are very useful, thank you!

> > but I couldn't get it to work properly with the
> > viewport and frustum setup from that for some reason.
>
> I see ... well my setup code was just for 2D rendering IIRC.

Yes, in fact remembering what's in #initFrustum... (I don't have the
code in front of me) I think that what was missing was the
initialization of one of the two big matrices needed for 3D.
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
In reply to this post by Joshua Gargus-2
On 5/30/07, Joshua Gargus <[hidden email]> wrote:

> I think that it's really handy to be able to futz around with OpenGL
> in Squeak without having to haul in all of Croquet.

Yes, I'm planning on using this as the base for the procedural
texturing project that I keep threatening to do.
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
In reply to this post by Peter Moore-5
On 5/30/07, Peter Moore <[hidden email]> wrote:
> Cool. I'd like to play around with this if you don't mind sending me
> a changeset, or putting something into Contributions. Thanks David.

I'll make it available somewhere in the next few days.
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
In reply to this post by Bert Freudenberg
On 5/31/07, Bert Freudenberg <[hidden email]> wrote:
> On May 31, 2007, at 14:23 , David Faught wrote:
...

> > But glu* calls are typically for a platform-specific library, aren't
> > they?  And I noticed that this method is the only glu* method
> > available and is actually coded in Squeak rather than being an
> > external library like one might expect.  So I guess it's okay, but
> > other glu* calls are not available.
>
> GLU is the OpenGL Utility library and actually is cross-platform (it
> only uses GL functions). See
>
>        http://www.opengl.org/documentation/specs/
>
> It's just that it is not strictly necessary because all of its
> functions can be written in Smalltalk and we didn't want to bother
> with two libraries if one suffices ...

It must be GLUT that I am thinking of.  Of course I really don't know
much about it either ...
Reply | Threaded
Open this post in threaded view
|

Re: COpenGLPlayer

David Faught
Okay, now this code is available in the Hedgehog PublicContribs
repository in the Tweak-OpenGL package.  Let me know how it goes!