PDF out for direct openGL calls, possible?
in
Programming Questions
•
2 years ago
hello!
I'd like to write graphics based on direct openGL calls to a pdf, but just get an empty file
this is how I try:
any help appreciated!
thanks
leo
I'd like to write graphics based on direct openGL calls to a pdf, but just get an empty file
this is how I try:
- import processing.opengl.*;
import javax.media.opengl.*;
import processing.pdf.*;
// Direct OPENGL
PGraphicsOpenGL pgl;
GL gl;
Boolean record=false;
void setup()
{
size (1024,1024,OPENGL);
pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;
}
void draw()
{
if (record)
{ PGraphicsPDF pdf=(PGraphicsPDF)beginRaw(PDF, "pdfOut"+frameCount+".pdf");
}
background (255);
stroke(0);
noFill();
gl=((PGraphicsOpenGL)g).beginGL();
gl.glColor4f(0f,0f,0f,1f);
gl.glBegin(GL.GL_LINES);
gl.glVertex3f(0,0,0);
gl.glVertex3f(800,800,800);
gl.glEnd();
((PGraphicsOpenGL)g).endGL(); // end of the gl queue
if (record)
{endRaw();
record = false;
}
}
void keyPressed()
{
if(key==' ') record=true;
}
any help appreciated!
thanks
leo
1
