Jump to content
  • Advertisement
Sign in to follow this  
reiko

FBO glitch on ATI?

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In order to convert my old pbuffer code, I'm doing a quick FBO test. A couple of white quads are rendered to a framebuffer (just color buffer, no depth etc., no mipmaps). The texture is then used to render another pair of quads to the screen. As you can see, the texture has a constant off-center black border around it. Has anyone seen this before, or does anyone know how to fix it?

Share this post


Link to post
Share on other sites
Advertisement
Hmmmm I cant say I've seen it that error at all with my FBO code on my X800... you might well have to post some code, see if someone else can spot the problem or even reproduce it.

Which driver version do you have installed?

Share this post


Link to post
Share on other sites
Using fglrx 8.14.13 on X.org 4.3.0. The card is an r9500.

Here's the render code:



// render.cpp

#include "main.h"


float ang;


GLuint fb_rtt;
GLuint tex_rtt;
GLuint rb_rtt_color;

int tex_cx, tex_cy;


void rdr_projection ();


bool rdr_init ()
{

ang = 0.0f;

tex_cx = 128;
tex_cy = 128;

rdr_projection ();

glGenFramebuffersEXT (1, &fb_rtt);
glGenTextures (1, &tex_rtt);
glGenRenderbuffersEXT (1, &rb_rtt_color);

glBindTexture (GL_TEXTURE_2D, tex_rtt);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGB8, tex_cx, tex_cy, 0, GL_RGB, GL_INT, 0);
glGenerateMipmapEXT (GL_TEXTURE_2D);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, fb_rtt);

glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex_rtt, 0);

rdr_projection ();
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);

return true;
}

void rdr_shutdown ()
{
}

void rdr_tick (float delta)
{
ang += delta * 0.2f;
}

void rdr_projection ()
{
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();

float
fnear = 0.1f,
faspect = 0.6f * fnear,
fside = 1.33f * faspect;

glFrustum (-fside, fside, -faspect, faspect, fnear, 10000.0f);

glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
}

void rdr_cube ()
{
glBegin (GL_QUADS);
glTexCoord2f (1.0f, 1.0f);
glVertex3f (1.0f, 1.0f, 1.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f (-1.0f, 1.0f, 1.0f);
glTexCoord2f (0.0f, 0.0f);
glVertex3f (-1.0f, -1.0f, 1.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f (1.0f, -1.0f, 1.0f);

glTexCoord2f (0.0f, 0.0f);
glVertex3f (1.0f, 1.0f, -1.0f);
glTexCoord2f (0.0f, 1.0f);
glVertex3f (1.0f, -1.0f, -1.0f);
glTexCoord2f (1.0f, 1.0f);
glVertex3f (-1.0f, -1.0f, -1.0f);
glTexCoord2f (1.0f, 0.0f);
glVertex3f (-1.0f, 1.0f, -1.0f);
glEnd ();
}

void rdr_render ()
{
// Render to FBO

glBindTexture (GL_TEXTURE_2D, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, fb_rtt);

glViewport (0,0, tex_cx, tex_cy);
glClearColor (0.1, 0.3, 0.1, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix ();
glTranslatef (0.0f, 0.0f, -3.0f);
glRotatef (DEGREES(ang * 3.0f), 0.0f, 1.0f, 0.0f);
rdr_cube ();
glPopMatrix ();

// Render to main viewport

glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
glBindTexture (GL_TEXTURE_2D, tex_rtt);
glGenerateMipmapEXT (GL_TEXTURE_2D);

glEnable (GL_TEXTURE_2D);

glViewport (0,0, win_cx, win_cy);
glClearColor (0.3, 0.1, 0.1, 0.0);
glClear (GL_COLOR_BUFFER_BIT);
glPushMatrix ();
glTranslatef (0.0f, 0.0f, -3.0f);
glRotatef (DEGREES(ang), 0.0f, 1.0f, 0.0f);
rdr_cube ();
glPopMatrix ();

glDisable (GL_TEXTURE_2D);
}


Share this post


Link to post
Share on other sites
I have problems with ATI too, I have an ATI x850 and my textures seem to be shifted by a few pixels . No probs on nvidia 6800. I am also using fragment shaders so i am not sure whether its bcoz of shader or fixed function pipeline

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!