Vertex Shader error while Passing mesh face index using glvertex4i

后端 未结 3 1272
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-29 13:52

Initializing GL_List for processing.

glBegin(GL_POINTS); 
for (i = 0; i < faceNum; i++)
{
    mesh->GetFaceNodes(i          


        
3条回答
  •  遥遥无期
    2021-01-29 14:12

    It would help if you actually posted the compilation error in your question, otherwise we don't know what your error is.

    So, since I'm taking random guesses in the dark, I'll make a couple of guesses here.

    1. You are assigning a float to an integer, which might be giving you a conversion error.
    // this might now compile, but it will probably only ever give you
    // zero or one. Was that the intent?
    final = int(gl_Vertex.w); 
    
    1. You are NOT writing to gl_Position within your vertex shader. If you don't write to that value, OpenGL cannot execute your vertex shader.

    2. In your fragment shader, you are checking the value color.z, but you have not declared color as a uniform, shader input, or const.

    3. Whilst this won't cause a compilation error, dividing final (an integer whose value is 1 or 0?), by an integer value of 100 or 1000 is only ever going to give you zero or one. Was the intention to use final as a float rather than integer?

    4. You are mixing integers and floats within the vec4 declaration in your fragment shader. This might be causing the compiler to baulk.

    Unfortunately, without access to the GLSL error log, there isn't going to be anything anyone can do to identify your problem beyond what I've listed above.

提交回复
热议问题