Tweak-ish OpenGL

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

Tweak-ish OpenGL

David Faught
Attached is a changeset that is a non-functional OpenGL CPlayer for
Tweak.  It is pretty much entirely Dr. Bert Freudenberg's code from
the earlier Jasmine version of Croquet and referenced recently in some
comments on his blog.

I have been playing with it, trying to get it to work in the new
Croquet Consortium SDK (and the Croquet Collaborative's release before
that), but haven't been able to figure it out.  In order to try it
out, do this:

1. install this changeset in the SDK,
2. optionally make changes go to this, rather than somewhere else,
3. open a Tweak Project and then enter it (NOT a Tweak Project WINDOW!)
4. get a Workspace from the Tools menu and put in "COpenGLPlayer open" and doIt.

What you SHOULD see is a multicolored triangle steadily rotating in
the center of a black background, but instead it quickly shrinks out
of sight.

I would like to use this as a simple tool to play more directly with
things OpenGL with Tweak supplying the 2D UI aspect, although that
puts the UI outside of the OpenGL space.

Please let me know if you figure out what is wrong with this, and
thanks for your time!

COpenGLPlayer.6.cs.gz (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Tweak-ish OpenGL

Benjamin Schroeder-2

On Mar 31, 2007, at 4:06 PM, David Faught wrote:

> What you SHOULD see is a multicolored triangle steadily rotating in
> the center of a black background, but instead it quickly shrinks out
> of sight.
>
> I would like to use this as a simple tool to play more directly with
> things OpenGL with Tweak supplying the 2D UI aspect, although that
> puts the UI outside of the OpenGL space.
>
> Please let me know if you figure out what is wrong with this, and
> thanks for your time!

I must admit that I haven't tried this, but what comes to mind is  
that the OpenGL transform matrix is accumulating translations,  
sending your triangle further and further back on each draw. Does it  
work if you insert a call to glLoadIdentity() at the beginning of  
your draw? That should clear transformations from previous runs.  
(Perhaps in Jasmine something else is doing this already, so the code  
works there.)

Hope this helps,
Ben Schroeder

Reply | Threaded
Open this post in threaded view
|

Re: Tweak-ish OpenGL

Bert Freudenberg
In reply to this post by David Faught

On Mar 31, 2007, at 22:06 , David Faught wrote:
> What you SHOULD see is a multicolored triangle steadily rotating in
> the center of a black background, but instead it quickly shrinks out
> of sight.

Simple OpenGL problem - your transformations are accumulating since  
you do not reset them.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: Tweak-ish OpenGL

David Faught
Thanks you both for your answers.  Adding the glLoadIdentity() call works!  I
was wondering why the triangle was getting smaller at a much quicker rate than
the phi angle was incrementing.

In the original code there was an "opengl reset" message that did something
with the old B3D classes that are not part of Croquet anymore. I replaced it
with an "opengl cleanup" message that seemed to help the stability a bit, but
apparently isn't really the same thing.  I haven't really looked at the OpenGL
code itself up to this point, I was just trying to get a simple Tweak framework
to play with OpenGL within.  Now it looks like I have it!  But I'm sure I'll
break it again before too long ;)