Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Jogl - No explicit glSwapBuffers & glEnd oddity  (Read 4085 times)
0 Members and 1 Guest are viewing this topic.
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Posted 2003-06-18 17:36:51 »

Either I'm just being blind, or this method seems to be hidden Sad I'm guessing that the underlying Canvas likes to take care of this, but its not totally obvious.

I'm unsure of how the Animator class is actually useful - it seems to perform some voodoo with    gldrawable.setNoAutoRedrawMode() to get a screen repaint, but I'm not sure. And i'm uneasy with letting the Animator control my main game loop - especially if i want to use Swing at the same time, its not obvious how best to use the two together.

Anyone else had a look at this?

Edit: Have a shufti at this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
public void display(GLDrawable canvas)
{
  // some setup
  gl.glBegin(GL.GL_LINES);
  {
    // some line drawing
  }
  gl.glEnd();
}

Doesn't work Sad I tinkered around with matrix setups and a whole bunch of other initialisation, but to no avail. After looking at the Gears demo, I spot:
1  
      //      gl.glEnd(); // DELIBERATE ERROR!

At the end of the drawing method. Commenting out my own glEnd produces the right output Shocked What on earth is going on here? Huh

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline ckline

Senior Newbie





« Reply #1 - Posted 2003-06-18 19:24:23 »

Oops! That commented-out "deliberate error" glEnd oddity is some debugging code I left in when I was testing the DebugGL component of the composable pipeline. What I was doing there was doing two glEnd() calls in a row, which is illegal, and making sure that DebugGL caught that error.

That call is commented out in the demo, and can safely be ignored (it should be removed from the Gears demo).

As for glSwapBuffers(), you are correct -- this is handled automatically by the GLCanvas and GLJPanel classes. The reason is that there is no need to expose these calls, and by not exposing them we can both hide all the platform-dependent special case code for window system interactions, and and also ensure that AWT/Swing threading issues are handled correctly.

You can definitely drive your demos without using the Animator. We have several demos that do this (by doing essentially the same work that the Animator does) , but I do not think that they are available online yet. I know some people at Sun are working hard to get these available ASAP.

-chris
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2003-06-18 20:58:53 »

So, whats the replacement in the canvas for glSwapBuffers? As I mentioned the Animator seems to manage some voodoo with noAutoRedraw toggling on and off, and i can't figure out why this causes the behaviour it does.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Ken Russell

JGO Coder




Java games rock!


« Reply #3 - Posted 2003-06-19 05:23:47 »

SwapBuffers is called automatically after the display() method in your GLEventListener returns.

Producing documentation for this and other semantics in the library is a high priority, but the highest priority right now is getting the sources for the demos we ported for JavaOne online.

-Ken
Offline josgood

Senior Newbie




Nudge reality.


« Reply #4 - Posted 2003-06-23 01:48:22 »

OT-

Quote
I'm unsure of how the Animator class is actually useful - it seems to perform some voodoo with    gldrawable.setNoAutoRedrawMode() to get a screen repaint, but I'm not sure.


Yea, I splunked thru JOGL to figure out how it worked.  The GLCanvas class has "autosense" threading technology so that it will always correctly use the underlying OpenGL context.  That means it'll behave correctly when driven by the main thread (e.g. when components are painted before the AWT thread kicks off), the AWT thread (e.g. a reshape event), or an outside thread like the Animator.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (72 views)
2014-11-26 15:22:04

toopeicgaming1999 (62 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!