OpenGL:glAccum错误1282(无效操作) [英] OpenGL: glAccum error 1282 (Invalid Operation)

查看:1679
本文介绍了OpenGL:glAccum错误1282(无效操作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:添加了一些错误检查代码,当我执行glAccum(..)时发现抛出了错误'1282'。

added some error checking code and found error '1282' is being thrown when I do glAccum(..)

Edit2:我已经尝试了确切的方法

I've tried the exact same code on a different computer, it works perfectly there.

Edit3:'Solution'ATI HD4xxx和up卡不再支持累积缓冲区:*(

'Solution' ATI HD4xxx and up cards dont support accumulation buffers anymore :*(

所以它不能在带有HD4850和最新驱动程序的Windows 7 64位上运行
它可以在带有Intel系列4 IGP的Windows 7 32位上运行。(GL_ACCUM_RED_BITS = 16)。
我也在基于Linux的计算机上真的非常快地尝试了它,但我不知道确切的规格,它也在那里工作,所以我认为它确实与计算机中的某些东西有关:(

So it doesn't work on Windows 7 64bit with a HD4850 and up-to-date drivers It does work on Windows 7 32bit with an Intel series 4 IGP. (GL_ACCUM_RED_BITS = 16). I also tried it really really quick on a Linux based machine of which I don't know the exact specs, it worked there too. So I guess it really has todo with something in my computer :(. I dont know what though, so any tips are welcome.

这里是原始问题。

我我正在尝试使用glAccum生成DOF效果,但对glAccum的调用似乎没有任何效果。我已将问题简化为一个简单的测试用例,其中在for循环中我翻译了一些sph沿x轴倾斜。如您所见,当我尝试将颜色缓冲区数据复制到累积缓冲区时,报告了错误。

I'm trying to use glAccum to generate a DOF effect, but the calls to glAccum don't seem to have any effect. I've reduced the problem to a simple test case where in a for loop I translate some spheres along the x-axis. As you can see an error is reported when I try to copy the colour buffer data to the accumulation buffer.

另外,当我检查累积中可用的红色位数时缓冲区,结果为0。这意味着它尚未初始化?!

Additionally when I check the number of red bits available in the accumulation buffer, the result is 0. Which would mean that its not initialized?!

我已经设置了显示模式,如下所示:

I've setup the display mode like this:

glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_ACCUM | GLUT_DEPTH);
glClearAccum(0.0, 0.0, 0.0, 0.0);

因此累积缓冲区应该可用。

So the accumulation buffer should be available.

我的显示方法如下:

void display(void)
{
    int i;
    GLint test[1];
    float weigth = 1.0/(float)apertureSamples;

    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_DEPTH_TEST);

    HandleKeyboardInput();
    glLoadIdentity();
    UpdateCamera();

    glClear(GL_ACCUM_BUFFER_BIT);
glGetIntegerv(GL_ACCUM_RED_BITS, test);

    //No errors here but the number of red bits is 0!?
    for(i = 0; i < apertureSamples; i++)
    {       
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
        glPushMatrix();
        glTranslatef(10*i, 0, 0);
        DrawScene(); //draw a couple of spheres
        glPopMatrix();
            //Still no errors here
        glAccum(GL_ACCUM, weigth);
            //If I check for errors here I get error 1282
        glFlush();
    }
    glAccum(GL_RETURN, 1.0);

    glutSwapBuffers();
}

我现在希望看到球体的模糊轨迹,移至是的,但是我没有,相反,我只看到了forloop的最后一次迭代(所有球体在x轴上平移了10 * appertureSamples)。

I would now expect to see a blurred trail of the spheres, moved to the right, but I don't, instead I only see the last iteration of the forloop (all the spheres translated on the x-axis by 10*appertureSamples).

到测试glAccum是否在做任何事情,我已经将weigth变量更改为0.00001,这应该会影响到每个帧的绘制都非常细(我的英语词汇把我留在这里)。但这似乎没有任何影响。然后我将glAccum(GL_RETURN,1.0)更改为gl_Accum(GL_RETURN,0.0001);再次没有执行任何操作(但应该使整个输出图片变薄。

To test if glAccum was doing anything at all, I've changed the weigth variable to 0.00001 which should have as affect that the each frame is drawn very 'thin' (my English vocabulary left me here). But this doesnt seem to have any affect. Then I changed glAccum(GL_RETURN, 1.0) to gl_Accum(GL_RETURN, 0.0001); which again did nothing (but should've made the entire output picture thinner.

我从这里开始执行DOF和JITTER下的所有步骤: http://glprogramming.com/red/chapter10.html ,我找不到任何我想念的东西。有人吗?有任何提示吗?

I've followed all the steps under DOF and JITTER from here: http://glprogramming.com/red/chapter10.html and I cant find anything that I'm missing. Does anybody have any tips?

(顺便说一句,我正在具有Radeaon HD4850 GPU的Windows 7计算机上执行此操作)。

(Btw I'm doing this on a Windows 7 computer with a Radeaon HD4850 GPU).

推荐答案

如果GL_ACCUM_RED_BITS为零,则意味着您没有累积缓冲区,您的GL实现应至少在软件中支持该缓冲区。glAccum上的错误提示还表明没有

If the GL_ACCUM_RED_BITS is zero, it means you don't have a accumlation buffer, your GL implementation should support it at least in software. The error at glAccum suggests also suggests that no accumulation buffer exists.

为什么首先要使用累积缓冲区?您可以使用着色器,帧缓冲对象和浮点纹理来实现相同的效果,而且与现代OpenGL实现兼容。

Why are you using the accumulation buffer in the first place? You can do the same effect using Shaders, Framebuffer Objects and Floating point textures, and it's also compatible with modern OpenGL implementations.

这篇关于OpenGL:glAccum错误1282(无效操作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆