<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://jogamp.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.2"
          urlbase="https://jogamp.org/bugzilla/"
          
          maintainer="sgothel@jausoft.com"
>

    <bug>
          <bug_id>38</bug_id>
          
          <creation_ts>2003-09-09 01:13:33 +0200</creation_ts>
          <short_desc>swapBuffers switch</short_desc>
          <delta_ts>2015-09-27 03:15:03 +0200</delta_ts>
          <reporter_accessible>0</reporter_accessible>
          <cclist_accessible>0</cclist_accessible>
          <classification_id>3</classification_id>
          <classification>JogAmp</classification>
          <product>Jogl</product>
          <component>core</component>
          <version>1</version>
          <rep_platform>All</rep_platform>
          <op_sys>all</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>25</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sven Gothel">sgothel</reporter>
          <assigned_to name="Sven Gothel">sgothel</assigned_to>
          
          
          <cf_type>FEATURE</cf_type>
          <cf_scm_refs></cf_scm_refs>
          <cf_workaround>---</cf_workaround>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54</commentid>
    <comment_count>0</comment_count>
    <who name="Sven Gothel">sgothel</who>
    <bug_when>2010-03-24 07:45:51 +0100</bug_when>
    <thetext>


---- Reported by greggpatton 2003-09-09 13:13:33 ----

I am writing a patch modeler.  I use a method of picking that renders each 
primitive in a unique color.  I use glReadPixels to check the color under the cursor 
when the mouse is clicked.  If the color matches the color of a primitive then I 
know I clicked on the primitive.

I perform the rendering and color check without swapping buffers so the primitives 
will never appear on the screen in their &quot;pick&quot; color.  The whole process is never 
seen by the user.

Currently, jogl always swaps buffers at the end of rendering.  For this picking 
technique to work I have to be able to keep swapBuffers from occuring during the 
process.

I ended up modifying 3 classes.

I added two methods to glCanvas and two methods and a boolean to glContext.

glCanvas methods,

  public boolean getNoSwapBuffers() {
      return context.getNoSwapBuffers();
  }

  public void setNoSwapBuffers(boolean b) {
      context.setNoSwapBuffers(b);
  }

glContext methods and boolean,

    protected boolean noSwapBuffers;

    public boolean getNoSwapBuffers() {
        return noSwapBuffers;
    }

    public void setNoSwapBuffers(boolean b) {
        noSwapBuffers = b;
    }

Then, in WindowsOnscreenGLContext, I modified the swapBuffers method to look 
like this,

    protected synchronized void swapBuffers() throws GLException {
        if (!noSwapBuffers) {

            if (!WGL.SwapBuffers(hdc)) {
                throw new GLException(&quot;Error swapping buffers&quot;);
            }

        }
    }

This allows me, via glCanvas, to keep the buffers from being swapped.  

I&apos;ve been using jogl like this for several days with no problems.



---- Additional Comments From kbr 2004-04-08 12:01:04 ----

Will be fixed under issue #25.


*** This issue has been marked as a duplicate of 25 ***



--- Bug imported by sgothel@jausoft.com 2010-03-24 07:45 EDT  ---

This bug was previously known as _bug_ 38 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=38
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>