# Problem of environment mapping

Hi, all.

I encounter a odd phenomenon when I make a environment mapping effect on a cube.

It is shown as follow :

[ATTACH=CONFIG]413[/ATTACH]

Does some one encounter same situation as like as mine ?

(P.S I calculate the reflect vector in world matrix, I don’t use the gl_NormalMatrix. My cube only have a translation, no rotation and scale.)

hello
I want from y
to gave me delay instruction in opengl
ex i want to draw sphere in first time then in second time i will draw cube etc.

how can i make this?

[QUOTE=marahalsaidan;1250699]hello
I want from y
to gave me delay instruction in opengl
ex i want to draw sphere in first time then in second time i will draw cube etc.

how can i make this?[/QUOTE]

Does you mean that you want to draw sphere at current frame and then exchange the one to cube at next frame ?

If you want to do this thing, you can use the function glutSolidCube and glutSolidSphere with glut.

you can get the example and specification of those functions in Internet.

Then you can change drawn object by if-else statement in display function.

Hi, all.

Does someone happen the odd situation as like as mine?

[ATTACH=CONFIG]419[/ATTACH]

I attempt to check my matrix, but I think that isn’t related with my problem.

Because I saw my plane looked like two different plane in large reflect angle.

This problem confuse me already two weeks.

And I have no idea how and what I should check.

My code is as follow :

varying vec4 object_reflect_dir;

(In calculate world information function)
world_vertex = world_matrix * gl_Vertex;
world_normal = normalize(world_matrix * vec4(gl_Normal,0.0));
(In calculate world eye information function)
world_e = vec4(normalize(eye_position.xyz - world_vertex.xyz),0.0);

(In calculate world reflect dir information function)
vec4 world_reflect_dir = vec4(normalize(reflect((-1.0) * world_e.xyz,world_normal.xyz)),0.0);
object_reflect_dir = normalize(world_reflect_dir);

varying vec4 object_reflect_dir;

(calculate cube map color)

vec4 reflect_pixel_color = textureCube(environment_map,normalize(object_reflect_dir.xyz));

environment_color = reflect_pixel_color;

return environment_color;

Hi, All.