Tag Info

Hot answers tagged

3

Your main issue is that you need to fix your normals. If you want to calculate smooth normals correctly please check my answers here and here. Also make sure that your normals are normalized. Your second issue is your attenuation values, I often get better results with one attenuation type. So try to use one type of attenuation and try to modify its value ...


2

That simple lighting does not know anything about other objects in scene, nor shadows they cast. It just does the lighting knowing the light position and surface normal (and eye position for specular). That's it. No occlusion info, no light refraction, no reflection, no anything, just lighting. If you need object shadows, there are separate techniques for ...


1

Error undefined reference means that linker can't find function's definition. Probably, you should link X11 library to your program by console parameter -lX11. So, it should be g++ -std=c++11 test.cpp -o test -lglfw3 -lX11. I think you should link OpenGL library too (by -lGL).


1

I think you would do to keep your GPUVec3 and your vec3 as two separate classes, not one containing the other. Here's an example: struct vec3 { float x,y,z; }; struct GPUVec3 { float x,y,z, pad; GPUVec3() { } GPUVec3( float x, float y, float z ) { } GPUVec3( const vec3 & v ) { } operator vec3 const & () const { return ...


1

Why are you moving the viewport? You should only really touch it when the screen resizes. because you move the viewport everything outside it will not be drawn. instead adjust the view matrix to move the "camera" to where the player is this allows you to have larger levels as well.



Only top voted, non community-wiki answers of a minimum length are eligible