IntBuffer eb = BufferUtils.createIntBuffer(elementArray.length) ViewProjMatrixLocation = glGetUniformLocation(program, "viewProjMatrix") ĬolorLocation = glGetUniformLocation(program, "color") įloatBuffer cb = BufferUtils.createFloatBuffer(colorArray.length) įloatBuffer vb = BufferUtils.createFloatBuffer(vertexArray.length) Int fs = glCreateShader(GL_FRAGMENT_SHADER) " gl_Position = viewProjMatrix * vec4(position, 1.0) \n" "layout(location=0) in vec3 position \n" Int vs = glCreateShader(GL_VERTEX_SHADER) Matrix4f viewProjMatrix = new Matrix4f() įloatBuffer fb = BufferUtils.createFloatBuffer(16) Other than that I can't seem to figure out what the problem is.Īnyway, my question is how can the shader code be fixed to show a cube? I've searched for days trying to find the answer, so any help would be appreciated. I also turned off backface culling and made sure the znear and zfar was set correctly. I tried making the cube large, so if it was behind the camera, it would still be visible. When I looked at the lwjglx debug output it didn't show any errors. So then I went on to add shaders and it all broke. It was using vbos and indicies and it did draw a colored cube like it should. The program worked fine until I added shaders. So I made a program to draw a simple cube with colors at each vertex.
0 Comments
Leave a Reply. |