Examples of PGraphicsOpenGL


Examples of processing.opengl.PGraphicsOpenGL

   * @param fn
   *          String
   */ 
  public GLCgFXEffect(PApplet parent, String fn) {
    this.parent = parent;
    PGraphicsOpenGL pgl = (PGraphicsOpenGL) parent.g;
    gl = pgl.gl;
   
    context = (CGcontext)GLState.createCGResource(CG_CONTEXT);
    checkCgError();
    CgGL.cgGLRegisterStates(context);
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

  public void setup()
  {
    if (p.g.getClass().getName().equals(PApplet.OPENGL))
    {
      PGraphicsOpenGL gl = (PGraphicsOpenGL) p.g;
      gl.canvas.addKeyListener(this);
    } else
    {
      p.addKeyListener(this);
    }
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

  public void setup()
  {
    if (p.g.getClass().getName().equals(PApplet.OPENGL))
    {
      PGraphicsOpenGL gl = (PGraphicsOpenGL) p.g;
      gl.canvas.addMouseListener(this);
      gl.canvas.addMouseMotionListener(this);
      gl.canvas.addKeyListener(this);
      gl.canvas.addMouseWheelListener(this);
    } else
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

   * Kind of a hack to fit the scale of the foto tags to the map scale.
   * Has to be called each time the map scale changes.
   */
  private void updateTagContainerScale(){
    model.clear();
    PGraphicsOpenGL pgl = ((PGraphicsOpenGL)p.g);
//    GL gl = pgl.beginGL();
    GL gl = pgl.gl;
   
    gl.glPushMatrix();
    gl.glScalef(1, -1, 1);
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

      g.noSmooth();
      g.fill(255,255,255,255);
      g.tint(255,255,255,255);
     
      //FIXME TEST
      PGraphicsOpenGL pgl = (PGraphicsOpenGL)g;
      GL gl = pgl.gl;
      gl.glDisableClientState(GL.GL_VERTEX_ARRAY);
      gl.glDisableClientState(GL.GL_COLOR_ARRAY);
      gl.glDisable(GL.GL_LINE_SMOOTH);
      gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

      colArray = BufferUtil.newFloatBuffer(maxParticles * 3 * 2);
    }


    public void updateAndDraw(){
      PGraphicsOpenGL pgl = (PGraphicsOpenGL)p.g;         // processings opengl graphics object
      GL gl = pgl.beginGL();                // JOGL's GL object

      gl.glEnable( GL.GL_BLEND );             // enable blending
     
      if(!drawFluid)
        fadeToColor(p, gl, 0, 0, 0, 0.05f);

      gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE)// additive blending (ignore alpha)
      gl.glEnable(GL.GL_LINE_SMOOTH);        // make points round
      gl.glLineWidth(1);


      if(renderUsingVA) {
        for(int i=0; i<maxParticles; i++) {
          if(particles[i].alpha > 0) {
            particles[i].update();
            particles[i].updateVertexArrays(i, posArray, colArray);
          }
        }   
        gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
        gl.glVertexPointer(2, GL.GL_FLOAT, 0, posArray);

        gl.glEnableClientState(GL.GL_COLOR_ARRAY);
        gl.glColorPointer(3, GL.GL_FLOAT, 0, colArray);

        gl.glDrawArrays(GL.GL_LINES, 0, maxParticles * 2);
      }
      else {
        gl.glBegin(GL.GL_LINES);               // start drawing points
        for(int i=0; i<maxParticles; i++) {
          if(particles[i].alpha > 0) {
            particles[i].update();
            particles[i].drawOldSchool(gl);    // use oldschool renderng
          }
        }
        gl.glEnd();
      }

//      gl.glDisable(GL.GL_BLEND);
      //Reset blendfunction
      gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
      pgl.endGL();
    }
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

      double[] proj  = new double[16];
      double[] model = new double[16];
      double[] mousePosArr = new double[4];
     
      try{
      PGraphicsOpenGL pgl = ((PGraphicsOpenGL)applet.g);
      GL gl = pgl.beginGL()
      GLU glu = pgl.glu;
     
          gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
          gl.glGetDoublev(GL.GL_PROJECTION_MATRIX, proj, 0);
          gl.glGetDoublev(GL.GL_MODELVIEW_MATRIX, model, 0);
         
          /*
          System.out.println("OpenGL ProjectionMatrix: ");
          for (int i = 0; i < proj.length; i++) {
            double p = proj[i];
            System.out.print(p + ", ");
            //if (i%4 == 0 && i==3)
            if (i==3 || i== 7 || i== 11 || i==15) {
              System.out.println();
            }
            }
          */
         
          /*
          System.out.println("OpenGL ModelviewMatrix: ");
          for (int i = 0; i < model.length; i++) {
            double p = model[i];
            System.out.print(p + ", ");
            //if (i%4 == 0 && i==3)
            if (i==3 || i== 7 || i== 11 || i==15) {
              System.out.println();
            }
            }
          System.out.println();
          System.out.println("\n");
          */
         
          /*
          fbUn.clear();
          gl.glReadPixels((int)screenX, applet.height - (int)screenY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, fbUn);
          fbUn.rewind();
          glu.gluUnProject((double)screenX, applet.height - (double)screenY, (double)fbUn.get(0), model, 0, proj, 0, viewport, 0, mousePosArr, 0);
          */
         
          //FIXME test not using glReadpixel to get the depth at the location
          //instead we have to build a ray with the result, from the camera location going through the resulst and check for hits ourselves
          glu.gluUnProject((double)screenX, applet.height - (double)screenY, 0, model, 0, proj, 0, viewport, 0, mousePosArr, 0);
        pgl.endGL();
       
        returnVect = new Vector3D((float)mousePosArr[0], (float)mousePosArr[1], (float)mousePosArr[2]);
      }catch(Exception e){
        e.printStackTrace();
        //System.out.println("Use method getWorldForScreenCoords only when drawing with openGL! And dont put negative screen values in!");
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

   */
  public static Vector3D project(PApplet applet, Vector3D point){
    switch (MT4jSettings.getInstance().getRendererMode()) {
    case MT4jSettings.OPENGL_MODE:
      try{
        PGraphicsOpenGL pgl = ((PGraphicsOpenGL)applet.g);
        GL gl   = pgl.beginGL()
        GLU glu = pgl.glu;
        Vector3D returnVect = projectGL(gl, glu, point);
        pgl.endGL();
        return returnVect;
      }catch(Exception e){
        e.printStackTrace();
        //System.out.println("Use method getWorldForScreenCoords only when drawing with openGL! And dont put negative screen values in!");
      }
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

 
 

  @Override
  public void drawComponent(PGraphics g){
    PGraphicsOpenGL pgl = (PGraphicsOpenGL)g;
    GL gl = pgl.gl;

//    boolean b = false;
//    if (GLStencilUtil.getInstance().isClipActive()){
//      GLStencilUtil.getInstance().endClipping(gl);
View Full Code Here

Examples of processing.opengl.PGraphicsOpenGL

         
          Vector3D NewPt = bSphere.getIntersectionLocal(invertedRay);
         
         
          if (NewPt != null){
            PGraphicsOpenGL pgl = ((PGraphicsOpenGL)applet.g);
          GL gl   = pgl.beginGL()
            gl.glPushMatrix();
              gl.glMultMatrixf(shape.getGlobalMatrix().toFloatBuffer());
              NewPt = Tools3D.projectGL(gl, pgl.glu, NewPt, NewPt);
            gl.glPopMatrix();
            pgl.endGL();
           
            this.mapToSphere(NewPt, this.StVec);
          }else{
            logger.error(getName() + " Didnt hit sphere!");
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.