FAQ Database Discussion Community


C++ Opengl Lighting doesnt work

c++,opengl,lighting
I've already searched for the solution, but none worked. I have already inited the Lighting and all but the objects stay unlit. When i download examples they work but when i try to enable lighting on mine it doesnt work. Here is the code: #include <GLFW/glfw3.h> #include <glm\gtx\transform.hpp> #include <iostream>...

What is an effective implementation for dynamic lighting?

java,lighting
I am currently working on a 2D Java game, and am currently in the process of implementing dynamic lighting, for e.g. torches, light bulbs and the sun. I however, have run into a problem. Numerous attempts with different implementations have not yet provided the desired result, either not being what...

Simple GLSL Shader (Light) causes flickering

opengl,glsl,shader,lighting
I'm trying to implement some basic lighting and shading following the tutorial over here and here. Everything is more or less working but I get some kind of strange flickering on object surfaces due to the shading. I have two images attached to show you guys how this problem looks....

MATLAB: How to make camera light follow 3D Rotation

matlab,user-interface,3d,rotation,lighting
I have come into a problem recently when trying to rotate 3D objects. I am building a GUI and I have a separate figure where an object is plotted. In the figure, I allow the user to use MATLAB's built-in rotate button to move the object around. However, I am...

OpenGL 3.3 lighting gives really strange disortions

c++,opengl,3d,shader,lighting
I've, the last month, been following tutorials on a various pages (learnopengl.com) amongst others. I got to the lighting section (I created a loader to load meshes with Assimp first), my fragmentshader code is pretty much the same as the tutorials lighting ( learnopengl.com/basic_lighting). Frag code: #version 130 out vec4...

Normal mapping on flat water surface produces incorrect specular highlights

c++,opengl,lighting,bump-mapping
I have a flat water surface with a dudv and a normal map attached to it. The dudv map works correct and the normal map is attached correct as well (visualizing the normal map looks like it should). The specular highlights are always showing at the wrong place though as...

Monogame “lighting” specific objects

c#,monogame,lighting
I have done something similar to this in Monogame: My question is, what would I have to do to draw that lighting effect only on the pillar and not the background ? Is there something like ignoring certain sprites when using BlendState.Additive ? How would that work ? Here is...

DirectX 9 vertex colors ingored when lighting is enabled?

c++,directx,directx-9,lighting
Well, the question says it. When I have light disabled (pd3dDevice->SetRenderState(D3DRS_LIGHTING, TRUE);) I get the colors as expected, when I set it to true, I get pure black, even if I set the ambient light, but that's fixed when also setting a material. But the vertex colors are then ignored...

OpenGL lighting not acting on some shapes

opengl,lighting
I'm trying two methods to make a cube. The thing is, if I draw the cube manually, the lighting does not show. I'm a beginner so this might be trivial but I'm at a loss. What shows in my window is this: The cube which does show shades is the...

Ambient and Specular lighting not working correctly in GLSL

opengl,glsl,lighting,phong
In my lighting scene, for some reason the ambient lighting isn't working at all. The whole model is the same brightness, no matter which way it is facing. I tried getting rid of the attenuation but it still has the same results. Along with that, the specular lighting is always...

OPENGL Two LoadIdentitys

c++,opengl,camera,lighting
When i do two glLoadIdentity(), it looks like its 2d: glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); gluPerspective( 90, (double)windowWidth / (double)windowHeight, 0.1, 100 ); glMatrixMode(GL_MODELVIEW_MATRIX); glLoadIdentity(); Camera.Render(); // (gluLookAt) But, when i remove the last one, it works, but the light seems like its moving with the camera: glMatrixMode(GL_PROJECTION_MATRIX); glLoadIdentity(); gluPerspective( 90, (double)windowWidth /...

Camera-space Normals from depth texture

opengl,glsl,lighting,normals,deferred-rendering
I want to use a stored (non-linear) depth texture from 1st pass to produce screen-space normals. In 2nd pass I can render out depth, diffuse, ID etc., but I can't seem to get normals from depth working. Current understanding of getting normals from depth: texture() / texelFetch() p at the...