【发布时间】:2013-08-14 14:09:55
【问题描述】:
glClearColor( 1.0f, 1.0f, 1.0f, 1.0f );
AttachVertexShader( shader, "szescian_vs.glsl" );
AttachFragmentShader( shader, "szescian_fs.glsl" );
LinkProgram( shader );
glBindVertexArray( vertexVAO );
glGenBuffers( 1, &positionBuffer );
glGenBuffers( 1, &positionBuffer );
glBindBuffer( GL_ARRAY_BUFFER, positionBuffer );
glBufferData( GL_ARRAY_BUFFER, sizeof( position ), position, GL_STATIC_DRAW );
positionLoc = glGetAttribLocation( shader, "inPosition" );
glEnableVertexAttribArray ( positionLoc );
glVertexAttribPointer ( positionLoc, 3, GL_FLOAT, GL_FALSE, 0, ( void* ) 0 ); //here gDEBugger GL breaks on OpenGL Error
它是我的 init 函数的一部分,我真的不知道为什么 gDEBugger 会中断它,谁能帮我解释一下?
中断原因 OpenGL 错误中断 glVertexAttribPointer(0 , 3 , GL_FLOAT , FALSE , 0 , 0x00000000) 错误代码
GL_INVALID_OPERATION 错误描述 指定的操作是 当前状态不允许。有问题的功能被忽略, 除了设置错误标志之外没有任何副作用。 * 在函数执行前停止
这是休息信息。
【问题讨论】:
-
我的猜测是 (void*) 0 是指向 0x00000000 处内存的指针,因为它是内存的开头,所以可能无法访问,应该保留
-
我不太喜欢 openGL。但是文档对每个参数及其用途有什么看法?
-
@Xtroce 不,该指针被解释为当前绑定缓冲区的偏移量。