VertexShader bugging

Started by jeussa, February 03, 2016, 15:24:18

Previous topic - Next topic

jeussa

Hello there,

I'm rather new to lwjgl and I've been working on this program. However when working on the vertex shader I stumbled upon odd issue. It appears to happen whenever I use the normalVector object. For some reason it adjusts the textures on the models, but not the shape.

Code (when the marked line is not added, the model will generated just fine. When it is marked, the model appears to be glitched)
http://i.imgur.com/xdunmeB.png

What the model looks like without the line above
http://i.imgur.com/pTziMQN.png

What the model looks like with the line above
http://i.imgur.com/mURPrRd.png

Thanks for the time!

jeussa

I would like to add that the issue above appears to occur only on my computer. When the projecting is run on a different computer it does work. (I tried this with two other computers)

I also noticed that when I used different values for the normal vectors, the textures on the objects would show in different colours. (colours from their texture files)



Edit: I've been trying/testing some more. I think the issue has something to do with the amount of data being passed to the vertex shader through VBOs. This conclusion I draw from the fact that the issue occurs whenever I use more than 2 'in' variables within my vertex shader.

(what I tried here is to see whether sending the individual floats of the normal vector to the vertex shader. The following would happen:

- When using a third (so 1 extra) 'in' variable:
Engine: http://i.imgur.com/PTbIbot.png
Code: http://i.imgur.com/xnxjTV1.png

- When using four or more (so 2 or more extra) 'in' variables
Engine: http://i.imgur.com/OWBZOML.png
Code: http://i.imgur.com/VCNdqCZ.png

I would like to note that with using a variable I actually mean using it. In both cases all variables are still present.



Edit 2:

I would like to note that I managed to find a temporary solution to the issue. Basically what I did is I stored the data of the 3 vectors (which is 8 floats) inside 2 4D vectors. I would then in the VertexShader split this data creating three individual vectors (geometric, texture and normal vectors)