We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › PImage-like objects to maniplate opengl textures
Pages: 1 2 3 
PImage-like objects to maniplate opengl textures (Read 7998 times)
Re: PImage-like objects to maniplate opengl textur
Reply #15 - Jul 26th, 2008, 7:09pm
 
I just tried the OffScreen example on a PC with ATI X1550 (latest catalyst driver, v8.7), and it works fine.

There is only one caveat. The textures of the GLGraphics objects need to be cleared in setup:

glg1.getTexture().clear(0);
glg2.getTexture().clear(0);

What platform are you using?

Re: PImage-like objects to maniplate opengl textur
Reply #16 - Jul 26th, 2008, 8:18pm
 
I guess if the problem appears on Mac, it probably means that the OSX drivers for the ATI don't support all the features of the FBO extensions.

As for the particle system demos, they won't work on ATI 1x00 since these demos use a technique called vertex texture fetch, which is not supported on the ATI cards. Supossedly, it is supported on the next generation, Radeon 2x00, but I haven't had the chance to check this.
Re: PImage-like objects to maniplate opengl textur
Reply #17 - Jul 27th, 2008, 1:32am
 
Hi AC, I'm on Mac OSX leopard. Mac Pro with X1900XT and MacbookPro with 1600XT - same problem on both. I can definitely use FBO's in C++ so its not the Mac drivers where the problem lies. Also in the other thread (http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1207160412;start=)

the sample code you've provided with the red screen works perfectly, but the example you posted before that gives the same 0506 error (GL_ERROR at top endDraw(): 0506  UNKNOWN) - and i've found the line that gives the 506 error in that piece of code (last line of setup), if you remove the marked line it works as well, dunno if this is linked to the actual code in the GLGraphics library at all or not:

Code:

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

int[] tex = {
0 };
int[] fbo = {
0 };

void setup()
{
size(640, 480, OPENGL);

pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;

// Create texture.
gl.glGenTextures(1, tex, 0);
gl.glBindTexture(GL.GL_TEXTURE_2D, tex[0]);

gl.glTexParameteri(GL.GL_TEXTURE_2D,
GL.GL_TEXTURE_MIN_FILTER,
GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D,
GL.GL_TEXTURE_MAG_FILTER,
GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D,
GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D,
GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0,
GL.GL_RGBA, 320, 240, 0, GL.GL_BGRA,
GL.GL_UNSIGNED_BYTE, null);

// Create FBO and attach texture to it.
gl.glGenFramebuffersEXT(1, fbo, 0);
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo[0]);
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT,
GL.GL_COLOR_ATTACHMENT0_EXT,
GL.GL_TEXTURE_2D, tex[0], 0);
int stat = gl.glCheckFramebufferStatusEXT(GL.GL_FRAMEBUFFER_EXT);
if (stat != GL.GL_FRAMEBUFFER_COMPLETE_EXT)
System.out.println("FBO error");
gl.glGenFramebuffersEXT(1, fbo, 0); <-- this is in twice, probably an oversight :P but maybe NVidia drivers just ignore it while ATI drivers get confused. Removing this line makes this chunk of code work...
}

void draw()
{
gl = pgl.beginGL();

// Bind FBO, now everything is rendered into the texture.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, fbo[0]);

gl.glBegin(GL.GL_QUADS);
gl.glVertex2f(0,0);
gl.glVertex2f(0,200);
gl.glVertex2f(200,200);
gl.glVertex2f(200,0);
gl.glEnd();

// Unbind FBO.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
pgl.endGL();
}


Hope this is helpful in some way, and looking forward to playing some ping pong with these textures and shaders! Tongue
Re: PImage-like objects to maniplate opengl textur
Reply #18 - Jul 28th, 2008, 6:22am
 
Ok, try this code:

Code:

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

int[] drawTex = { 0 };
int[] depthStencilTex = { 0 };
int[] drawFBO = { 0 };

int texWidth = 320;
int texHeight = 240;

int GL_DEPTH_STENCIL = 0x84F9;
int GL_UNSIGNED_INT_24_8 = 0x84FA;
int GL_DEPTH24_STENCIL8 = 0x88F0;

void setup()
{
size(640, 480, OPENGL);

pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;

// Creating texture.
gl.glGenTextures(1, drawTex, 0);
gl.glBindTexture(GL.GL_TEXTURE_2D, drawTex[0]);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, null);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

// Create packed depth+stencil texture.
gl.glGenTextures(1, depthStencilTex, 0);
gl.glBindTexture(GL.GL_TEXTURE_2D, depthStencilTex[0]);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, 320, 240, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, null);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

// Creating FBO.
gl.glGenFramebuffersEXT(1, drawFBO, 0);
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, drawFBO[0]);
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_TEXTURE_2D, drawTex[0], 0);
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_TEXTURE_2D, depthStencilTex[0], 0);
int stat = gl.glCheckFramebufferStatusEXT(GL.GL_FRAMEBUFFER_EXT);
if (stat != GL.GL_FRAMEBUFFER_COMPLETE_EXT) System.out.println("FBO error");
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}

void draw()
{
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; // g may change
GL gl = pgl.beginGL(); // always use the GL object returned by beginGL

// Binding FBO.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, drawFBO[0]);

// Drawing to the first color attachement of drawFBO (this is where drawTex is attached to).
gl.glDrawBuffer(GL.GL_COLOR_ATTACHMENT0_EXT);

// Clearing Z-buffer to ensure that the new elements are drawn properly.
gl.glClearColor(0f, 0f, 0f, 0.0f);
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, texWidth, 0.0, texHeight, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, texWidth, texHeight);

// Just rendering a red quad.
gl.glDisable(GL.GL_TEXTURE_2D);
gl.glColor4f(1.0, 0.0, 0.0, 1.0);
gl.glBegin(GL.GL_QUADS);
gl.glVertex2f(0.0, 0.0);
gl.glVertex2f(texWidth, 0.0);
gl.glVertex2f(texWidth, texHeight);
gl.glVertex2f(0.0, texHeight);
gl.glEnd();

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

// Unbinding drawFBO. Now drawing to screen again.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, width, 0.0, height, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, width, height);

// Drawing texture to screen.
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glBindTexture(GL.GL_TEXTURE_2D, drawTex[0]);
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(0.0, 1.0);
gl.glVertex2f(0.0, 0.0);

gl.glTexCoord2f(1.0, 1.0);
gl.glVertex2f(width, 0.0);

gl.glTexCoord2f(1.0, 0.0);
gl.glVertex2f(width, height);

gl.glTexCoord2f(0.0, 0.0);
gl.glVertex2f(0.0, height);
gl.glEnd();
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

pgl.endGL();
}


Should display red screen. Let me know of any errors that show up on your Mac. The only difference with the old red screen code is the addition of the packed depth+stencil texture, which makes the FBO as a complete rendering context with depth and stencil buffers. If this works fine, then the offscreen mode of glgraphics should work as well (meaning that there must be some bug somewhere right now).
Re: PImage-like objects to maniplate opengl textur
Reply #19 - Jul 28th, 2008, 11:38am
 
Hi AC, doesn't work I'm afraid. Same error (and messed up red screen).
Quote:
FBO error
GL_ERROR at top endDraw(): 0506  UNKNOWN
GL_ERROR at top endDraw(): 0506  UNKNOWN
GL_ERROR at top endDraw(): 0506  UNKNOWN
GL_ERROR at top endDraw(): 0506  UNKNOWN
GL_ERROR at top endDraw(): 0506  UNKNOWN



if I comment out the chunk ' Create packed depth+stencil texture.' it works fine...
Re: PImage-like objects to maniplate opengl textur
Reply #20 - Jul 28th, 2008, 11:10pm
 
I changed the depth buffer thing. How does the following code work on your mac?

Code:

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

int[] colorBuffer = { 0 };
int[] depthBuffer = { 0 };
int[] offscreenFBO = { 0 };

int texWidth = 320;
int texHeight = 240;

void setup()
{
size(640, 480, OPENGL);

pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;

// Creating texture.
gl.glGenTextures(1, colorBuffer, 0);
gl.glBindTexture(GL.GL_TEXTURE_2D, colorBuffer[0]);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, null);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

// Create depth buffer.
gl.glGenRenderbuffersEXT(1, depthBuffer, 0);
gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, depthBuffer[0]);
gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, GL.GL_DEPTH_COMPONENT, texWidth, texHeight);

// Creating FBO.
gl.glGenFramebuffersEXT(1, offscreenFBO, 0);
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, offscreenFBO[0]);
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_TEXTURE_2D, colorBuffer[0], 0);
gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, depthBuffer[0]);

int stat = gl.glCheckFramebufferStatusEXT(GL.GL_FRAMEBUFFER_EXT);
if (stat != GL.GL_FRAMEBUFFER_COMPLETE_EXT) System.out.println("FBO error");
else System.out.println("FBO Complete");
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}

void draw()
{
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; // g may change
GL gl = pgl.beginGL(); // always use the GL object returned by beginGL

// Binding FBO.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, offscreenFBO[0]);

// Drawing to the first color attachement of offscreenFBO (this is where colorBuffer is attached to).
gl.glDrawBuffer(GL.GL_COLOR_ATTACHMENT0_EXT);

// Clearing Z-buffer to ensure that the new elements are drawn properly.
gl.glClearColor(0f, 0f, 0f, 0.0f);
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, texWidth, 0.0, texHeight, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, texWidth, texHeight);

// Just rendering a red quad.
gl.glDisable(GL.GL_TEXTURE_2D);
gl.glColor4f(1.0, 0.0, 0.0, 1.0);
gl.glBegin(GL.GL_QUADS);
gl.glVertex2f(0.0, 0.0);
gl.glVertex2f(texWidth, 0.0);
gl.glVertex2f(texWidth, texHeight);
gl.glVertex2f(0.0, texHeight);
gl.glEnd();

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

// Unbinding offscreenFBO. Now drawing to screen again.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, width, 0.0, height, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, width, height);

// Drawing texture to screen.
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glBindTexture(GL.GL_TEXTURE_2D, colorBuffer[0]);
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(0.0, 1.0);
gl.glVertex2f(0.0, 0.0);

gl.glTexCoord2f(1.0, 1.0);
gl.glVertex2f(width, 0.0);

gl.glTexCoord2f(1.0, 0.0);
gl.glVertex2f(width, height);

gl.glTexCoord2f(0.0, 0.0);
gl.glVertex2f(0.0, height);
gl.glEnd();
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

pgl.endGL();
}


There is only depth buffer and no stencil, but for most purposes this is ok.
Re: PImage-like objects to maniplate opengl textur
Reply #21 - Jul 29th, 2008, 12:09am
 
Hi AC, it sure does! red screen and no error on a Mac Pro with ATI 1900 and Macbook Pro with ATI 1600...
Re: PImage-like objects to maniplate opengl textur
Reply #22 - Jul 29th, 2008, 10:03pm
 
Great! I'll fix the code in the library now.

Just out of curiosity, does the following code work as well?

Code:

import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;

int[] colorBuffer = { 0 };
int[] depthStencilBuffer = { 0 };
int[] offscreenFBO = { 0 };

int texWidth = 320;
int texHeight = 240;

int GL_DEPTH24_STENCIL8 = 0x88F0;

void setup()
{
size(640, 480, OPENGL);

pgl = (PGraphicsOpenGL) g;
gl = pgl.gl;

// Creating texture.
gl.glGenTextures(1, colorBuffer, 0);
gl.glBindTexture(GL.GL_TEXTURE_2D, colorBuffer[0]);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_CLAMP);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_CLAMP);
gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, texWidth, texHeight, 0, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, null);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

// Create depth and stencil buffer.
gl.glGenRenderbuffersEXT(1, depthStencilBuffer, 0);
gl.glBindRenderbufferEXT(GL.GL_RENDERBUFFER_EXT, depthStencilBuffer[0]);
gl.glRenderbufferStorageEXT(GL.GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8, texWidth, texHeight);

// Creating FBO.
gl.glGenFramebuffersEXT(1, offscreenFBO, 0);
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, offscreenFBO[0]);
gl.glFramebufferTexture2DEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_COLOR_ATTACHMENT0_EXT, GL.GL_TEXTURE_2D, colorBuffer[0], 0);
gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_DEPTH_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, depthStencilBuffer[0]);
gl.glFramebufferRenderbufferEXT(GL.GL_FRAMEBUFFER_EXT, GL.GL_STENCIL_ATTACHMENT_EXT, GL.GL_RENDERBUFFER_EXT, depthStencilBuffer[0]);

int stat = gl.glCheckFramebufferStatusEXT(GL.GL_FRAMEBUFFER_EXT);
if (stat != GL.GL_FRAMEBUFFER_COMPLETE_EXT) System.out.println("FBO error");
else System.out.println("FBO Complete");
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}

void draw()
{
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g; // g may change
GL gl = pgl.beginGL(); // always use the GL object returned by beginGL

// Binding FBO.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, offscreenFBO[0]);

// Drawing to the first color attachement of offscreenFBO (this is where colorBuffer is attached to).
gl.glDrawBuffer(GL.GL_COLOR_ATTACHMENT0_EXT);

// Clearing Z-buffer to ensure that the new elements are drawn properly.
gl.glClearColor(0f, 0f, 0f, 0.0f);
gl.glClear(GL.GL_DEPTH_BUFFER_BIT);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, texWidth, 0.0, texHeight, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, texWidth, texHeight);

// Just rendering a red quad.
gl.glDisable(GL.GL_TEXTURE_2D);
gl.glColor4f(1.0, 0.0, 0.0, 1.0);
gl.glBegin(GL.GL_QUADS);
gl.glVertex2f(0.0, 0.0);
gl.glVertex2f(texWidth, 0.0);
gl.glVertex2f(texWidth, texHeight);
gl.glVertex2f(0.0, texHeight);
gl.glEnd();

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

// Unbinding offscreenFBO. Now drawing to screen again.
gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);

// Setting orthographic projection.
gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
gl.glOrtho(0.0, width, 0.0, height, -100.0, +100.0);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();

gl.glViewport(0, 0, width, height);

// Drawing texture to screen.
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glBindTexture(GL.GL_TEXTURE_2D, colorBuffer[0]);
gl.glBegin(GL.GL_QUADS);
gl.glTexCoord2f(0.0, 1.0);
gl.glVertex2f(0.0, 0.0);

gl.glTexCoord2f(1.0, 1.0);
gl.glVertex2f(width, 0.0);

gl.glTexCoord2f(1.0, 0.0);
gl.glVertex2f(width, height);

gl.glTexCoord2f(0.0, 0.0);
gl.glVertex2f(0.0, height);
gl.glEnd();
gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glPopMatrix();

pgl.endGL();
}
Re: PImage-like objects to maniplate opengl textur
Reply #23 - Jul 29th, 2008, 10:09pm
 
awesome news! it sure does work, on both computers...
Re: PImage-like objects to maniplate opengl textur
Reply #24 - Jul 29th, 2008, 11:22pm
 
Indeed!

This means that we can have a full offscreen rendering context, with depth and stencil buffers, compatible accross NVidia, ATI and Intel integrated (tested on X3100 and works fine) cards.

I'll upload a new version of the glgraphics library with this new code very soon.
Re: PImage-like objects to maniplate opengl textur
Reply #25 - Jul 29th, 2008, 11:28pm
 
awesome! best news I've heard this week! thanks for your efforts, looking forward to it...
Re: PImage-like objects to maniplate opengl textur
Reply #26 - Jul 30th, 2008, 12:41am
 
Seriously AC and Memo, this is exciting news.  Not a bad start to the week.  I'm looking forward to using this.
Re: PImage-like objects to maniplate opengl textur
Reply #27 - Aug 2nd, 2008, 4:26pm
 
allright, here is the new release of glgraphics that should solve the offscreen issues on ATI+OSX:

https://sourceforge.net/project/showfiles.php?group_id=225391&package_id=272650&
release_id=617326

Please let me know if works ok.
Re: PImage-like objects to maniplate opengl textur
Reply #28 - Aug 2nd, 2008, 4:59pm
 
Andres, yer a star! off-screen example now works perfectly on Mac Pro (1900) and Macbook Pro (1600) (on latest leopard)! Thanks for your efforts...

P.S. I tried the other examples too (apart from the ones that need gsvideo), all work except for the following (they still seem to work and do something, albeit with a warning and ultra slow on X1900XT:

Painter:
[quote]

Fragment shader compilation:
WARNING: 0:34: extension 'GL_ARB_draw_buffers' is not supported
ERROR: 0:70: 'max' : no matching overloaded function found
ERROR: 0:70: 'assign' :  cannot convert from 'const float' to 'int'
Re: PImage-like objects to maniplate opengl textur
Reply #29 - Aug 2nd, 2008, 5:03pm
 
well, the forum and/or firefox cut off my post! rest went along the lines of:

same error in SimpleGPUParticleSystem.

I tried replacing
#extension GL_ARB_draw_buffers : enable
with
#extension GL_ATI_draw_buffers : enable
and same warning.
App continues to run at 23fps... but with warning.
I removed that line, and the app ran as usual at 23fps with no warnings... so maybe its not nessecary for ATI? Dunno if thats any help.

Anyways, for me right now, I needed the offscreen stuff.. so many thanks for your efforts. THe particle stuff looks great as well.. will look into that in the near future too Tongue
Pages: 1 2 3