Go Back   nV News Forums > Software Forums > Software Development

Newegg Daily Deals

Reply
 
Thread Tools
Old 01-12-07, 03: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
Old 01-12-07, 06:42 AM   #2
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: question on framebuffer object implementation

I would use a EXT_packed_depth_stencil renderbuffer with packed depth (24bit) and stencil (8 bit).
What prints CHECK_FRAMEBUFFER_STATUS(); out? Does the other code work with disabled FBO?
__________________
Will code GLSL for food.
oc2k1 is offline   Reply With Quote
Old 01-12-07, 03:08 PM   #3
gensk
Registered User
 
Join Date: Jan 2007
Posts: 3
Default Re: question on framebuffer object implementation

With stencil code I get the error code "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT"!

The code is working perfectly including depth buffer without stencil buffer. I have tried to init a stencil buffer as texture. I can initialize it but it seems not working at rtt time?????
gensk is offline   Reply With Quote
Old 01-12-07, 05:06 PM   #4
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: question on framebuffer object implementation

in my opinion it's not possible to use a texture as stencil attachment (maybe in future?) Try to use EXT_packed_depth_stencil insteat two buffers.
__________________
Will code GLSL for food.
oc2k1 is offline   Reply With Quote
Old 01-13-07, 05:08 AM   #5
gensk
Registered User
 
Join Date: Jan 2007
Posts: 3
Default Re: question on framebuffer object implementation

Over night I googled - one more time - and found the same solution. But - the extension registry entry is very tight-lipped. I will further test it... It seems to be a kludge

If anyone has got an example how to use it at hand, feel free to post it here. Otherwise consider this post as answered and closed. Thanks for reading and helping!
gensk is offline   Reply With Quote
Old 01-15-07, 05:33 AM   #6
squeen
Registered User
 
Join Date: Dec 2006
Location: Greenbelt, MD
Posts: 33
Default Re: question on framebuffer object implementation

I thought I saw in the list of GL extension for the n80 something about adding a stencil to FBOs. You might peek at the spec.
squeen is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
1st post - XP Restore question Needa916 Microsoft Windows XP And Vista 2 09-12-02 05:24 PM
Newby question about nforce.... superconti NVIDIA Linux 2 09-07-02 11:46 PM
Dual boot question.. Tactics General Hardware 15 09-07-02 10:39 AM

All times are GMT -5. The time now is 12:48 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.