View Single Post
Old 01-12-07, 04:06 AM   #1
gensk
Registered User
 
Join Date: Jan 2007
Posts: 3
Thumbs down question on framebuffer object implementation

hi,

I'm programming some opengl demos in c++ under Linux (for os/system specs see end of posting).

I'm implementing some different reflection techniques.
I want to use a stencil render buffer attached to a fbo (stencil reflections) . But it seems to be not possible to make it attachment complete. Here is the code:

Code:
glGenFramebuffersEXT(1, &texture.fBuf);
glGenRenderbuffersEXT(1, &texture.dBuf);
glGenRenderbuffersEXT(1, &texture.sBuf);
glGenTextures(1, &texture.texID);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, texture.fBuf);

// initialize color texture
glBindTexture(GL_TEXTURE_2D, texture.texID);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, texture.width, texture.height, 0,GL_RGB, GL_INT, NULL);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, texture.texID, 0);

// initialize depth renderbuffer
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, texture.dBuf);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_DEPTH_COMPONENT24, texture.width, texture.height);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, texture.dBuf);

// initialize stencil renderbuffer
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, texture.sBuf);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,GL_STENCIL_INDEX, texture.width, texture.height);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,GL_STENCIL_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, texture.sBuf);

CHECK_FRAMEBUFFER_STATUS();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
If I omit the stencil buffer part I'm able to draw to the texture.
The code snipped is taken from http://www.opengl.org/registry/specs...fer_object.txt

Are there any errors or have I forgotten something important?

Here are the specs:

939 athlon 3000+ venice
2GB ram
geforce-7600gt with nvidia-drivers-1.0.9746

I'm on an gentoo system, so

Code:
Portage 2.1.2_rc4-r8 (default-linux/amd64/2006.1/desktop, gcc-4.1.1, glibc-2.5-r0, 2.6.19-gentoo-r3 x86_64)
=================================================================
System uname: 2.6.19-gentoo-r3 x86_64 AMD Athlon(tm) 64 Processor 3000+
Gentoo Base System version 1.12.8
Last Sync: Thu, 11 Jan 2007 16:01:01 +0000
ccache version 2.4 [enabled]
dev-java/java-config: 1.3.7, 2.0.31
dev-lang/python:     2.4.4
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r6
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.17
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.19
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe -msse3"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-march=athlon64 -O2 -pipe -msse3"
DISTDIR="/mnt/sda10/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="autoconfig ccache distlocks keeptemp keepwork metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="de_DE@euro"
LC_ALL="de_DE@euro"
LINGUAS="de"
MAKEOPTS="-j2"
PKGDIR="/mnt/sda10/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/mnt/sda10/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="16bit X aac acpi aio akode allegro alsa amd64 amr apm arts audiofile bash-completion bcp berkdb bitmap-fonts bjam blas boost branding bzip2 c++ cairo cdio cdparanoia cdr cdrom cli cpudetection cracklib crypt ctype cups dbus dio directfb dlloader dmi doc dri dts dvd dvdr dvdread eds emboss encode epson examples expat fam fbcon ffmpeg fftw firefox fixes font-server fontconfig foomaticdb fortran fortran95 gcc64 gdbm gif glib glitz glut gnome gnome-print gnomecanvas gnomedb gpm graphviz gstreamer gtk gtk2 gtkhtml hal icons iconv icq icu ipv6 isdnlog jack java jpeg kde kdeenablefinal kdehiddenvisibility kdm kqemu ladspa lcms ldap libg++ logitech-mouse mmap mng mp3 mpeg musepack ncurses net nls nptl nptlonly nsplugin nvidia ogg openexr opengl pam pam_console patented pcre pdf perl png portaudio posix ppds pppd python qt3 qt4 quicktime rdesktop readline reflection rrdtool rtc runlevels scanner sdl session slp sockets spell spl sse-filters ssl svg sysfs tcpd threads tidy tiff truetype truetype-fonts type1-fonts udev unicode usb utempter vim vorbis wxwindows xcomposite xine xml xorg xscreensaver xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="nvidia nv"
Unset:  CTARGET, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS
gensk is offline   Reply With Quote