FBOs

Alejandro Segovia <[email protected]>
Newsgroups gmane.comp.python.opengl.user
Message-ID <CAAXrc9MUN9x_WaFygTSm4_aAoBtnZtN=Om+fTD5QB3-iM+736w@mail.gmail.com>
Hello list,

I am working with FBOs but am sadly running into some issues when
attempting to attach a 2D Texture to my FBO.

The problem I am having is that after setting everything up, when I call
the glCheckFramebufferStatus() function passing in GL_COLOR_ATTACHMENT0 as
a parameter, I get an "invalid enumerant" error.

Here's the shortest version of the code I could provide to trigger the
error:

import pygame
>
> from OpenGL.GL import *
>
> from OpenGL.GL.framebufferobjects import *
>
> import os
>
>
>> scr = pygame.display.set_mode((100,100), pygame.OPENGL)
>
> glClearColor(0.0,0.0,0.0,0.0)
>
> glClear(GL_COLOR_BUFFER_BIT)
>
> pygame.display.flip()
>
>
>> print "Renderer:"
>
> print glGetString(GL_VERSION), glGetString(GL_RENDERER)
>
> print os.uname()
>
>
>> tex_id = glGenTextures(1)
>
> glBindTexture(GL_TEXTURE_2D, tex_id)
>
> glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB,
>> GL_UNSIGNED_INT, None)
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)
>
>
>> fbo_id = glGenFramebuffersEXT(1)
>
> glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_id)
>
> glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
>> GL_TEXTURE_2D, tex_id, 0)
>
>
This is the line that triggers the error:


> assert (glCheckFramebufferStatusEXT(GL_COLOR_ATTACHMENT0_EXT) ==
>> GL_FRAMEBUFFER_STATUS_COMPLETE_EXT), "FBO creation failed!"
>
>
This is the output produced on my computer:

Renderer:
>
> 2.1 NVIDIA-1.6.36 NVIDIA GeForce 9600M GT OpenGL Engine
>
> ('Darwin', 'syaoran.local', '10.8.0', 'Darwin Kernel Version 10.8.0: Tue
>> Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386', 'i386')
>
> Traceback (most recent call last):
>
>   File "fbo.py", line 27, in <module>
>
>     assert (glCheckFramebufferStatusEXT(GL_COLOR_ATTACHMENT0_EXT) ==
>> GL_FRAMEBUFFER_STATUS_COMPLETE_EXT), "FBO creation failed!"
>
>   File
>> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/OpenGL/platform/baseplatform.py",
>> line 335, in __call__
>
>     return self( *args, **named )
>
>   File "errorchecker.pyx", line 50, in
>> OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError
>> (src/errorchecker.c:574)
>
> OpenGL.error.GLError: GLError(
>
>  err = 1280,
>
>  description = 'invalid enumerant',
>
>  baseOperation = glCheckFramebufferStatusEXT,
>
>  cArguments = (GL_COLOR_ATTACHMENT0_EXT,),
>
>  result = 0L
>
> )
>
>
>
Am I missing anything in the FBO creation code or am I bumping against a
bug in the OpenGL stack? I am not discarding this being a platform problem.

I have OpenGL 2.1 (so I am actually using the EXT version of the functions)
on Mac OS X 10.6 with an NVIDIA Geforce 9400m GPU.

Any help will be appreciated!

Best regards,
Alejandro.-

-- 
http://alejandrosegovia.net

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

_______________________________________________
PyOpenGL Homepage
http://pyopengl.sourceforge.net
_______________________________________________
PyOpenGL-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyopengl-users
fbo.py.txt (text/plain, 1 KB)
import pygame
from OpenGL.GL import *
from OpenGL.GL.framebufferobjects import *
import os

scr = pygame.display.set_mode((100,100), pygame.OPENGL)
glClearColor(0.0,0.0,0.0,0.0)
glClear(GL_COLOR_BUFFER_BIT)
pygame.display.flip()

print "Renderer:"
print glGetString(GL_VERSION), glGetString(GL_RENDERER)
print os.uname()

tex_id = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, tex_id)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_INT, None)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)

fbo_id = glGenFramebuffersEXT(1)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_id)
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex_id, 0)

assert (glCheckFramebufferStatusEXT(GL_COLOR_ATTACHMENT0_EXT) == GL_FRAMEBUFFER_STATUS_COMPLETE_EXT), "FBO creation failed!"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.