Light appears to move with camera.

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Light appears to move with camera.

Post by Jae686 »

Good Evening.

I'm starting to implement lightning into my framework, but the light appears to move with the camera, despite the light having fixed coordinates.
This results in very odd artifacts.
Any ideas on what might be the issue?


https://bitbucket.org/jae686/vidfdc/src ... r.c#cl-407

Image

Best Regards.
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Light appers to move with camera.

Post by bogglez »

Does glLoadIdentity before glLight fix the issue?

https://www.opengl.org/sdk/docs/man2/xhtml/glLight.xml
GL_POSITION
params contains four integer or floating-point values that specify
the position of the light in homogeneous object coordinates.
Both integer and floating-point values are mapped directly.
Neither integer nor floating-point values are clamped.

The position is transformed by the modelview matrix when
glLight is called (just as if it were a point)
,
and it is stored in eye coordinates.
If the
w
component of the position is 0,
the light is treated as a directional source.
Diffuse and specular lighting calculations take the light's direction,
but not its actual position,
into account,
and attenuation is disabled.
Otherwise,
diffuse and specular lighting calculations are based on the actual location
of the light in eye coordinates,
and attenuation is enabled.
The initial position is (0, 0, 1, 0);
thus, the initial light source is directional,
parallel to, and in the direction of the



-
z


axis.
I.e., the light's position is not absolute, but affected by the modelview matrix just like a vertex would be.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

Good evening.
You mean like this :

Code: Select all

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// INIT LIGHTS
	
	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(projectionMatrix);
	glMatrixMode(GL_MODELVIEW);
	
	glLoadIdentity();

	glShadeModel(GL_SMOOTH);

	gluLookAt(c->start_pos.x, c->start_pos.y, c->start_pos.z, c->start_looking_direction.x, c->start_looking_direction.y, c->start_looking_direction.z, 0.0, 0.0, 1.0);

	glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
	glLightfv(GL_LIGHT0, GL_SPECULAR, light_color);
	
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

It still does not appear to work..
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Light appears to move with camera.

Post by PH3NOM »

What you are seeing is called "specular lighting."
Specular lighting is the reflected light off a surface, dependent upon view position.
So as the camera moves, so does the angle of reflection, hence the variance of light as you observed.

You are only setting the specular term of the light source in your code; what you really want to do there is set the diffuse term of the light source
instead of this

Code: Select all

glLightfv(GL_LIGHT0, GL_SPECULAR, light_color);
try this

Code: Select all

glLightfv(GL_LIGHT0, GL_DIFFUSE, light_color);
In GL, and my API, you can also set the material parameters, meaning you can simulate different surface types; a material set with a large specular term would simulate a highly reflective surface, a material set with a no specular term would simulate a non-reflective surface
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by bogglez »

Jae686 wrote:Good evening.
You mean like this :

Code: Select all

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// INIT LIGHTS
	
	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(projectionMatrix);
	glMatrixMode(GL_MODELVIEW);
	
	glLoadIdentity();

	glShadeModel(GL_SMOOTH);

	gluLookAt(c->start_pos.x, c->start_pos.y, c->start_pos.z, c->start_looking_direction.x, c->start_looking_direction.y, c->start_looking_direction.z, 0.0, 0.0, 1.0);

	glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
	glLightfv(GL_LIGHT0, GL_SPECULAR, light_color);
	
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);

It still does not appear to work..
Imagine the light is like any other mesh. To position a mesh you would perform matrix operations, then draw the mesh, then pop the matrix stack or move somewhere else using matrix operations.

The first glLoadIdentity() reset the model view matrix to the origin of the world. gluLookAt then moves you to the position of the camera. If you now call glLightfv(GL_LIGHT0, GL_POSITION, light_pos), your light will therefore always be where the camera is.
I noticed in your code that you called glLightfv without calling any matrix code before, so you would have the same matrix as you had at the end of the previous frame.
Call glLoadIdentity, then glLightfv, then gluLookAt. The position supplied to glLightfv is then absolute.

Also check out what ph3nom said, I didn't check for that.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

Well, declaring the glLight before or after glLookat or the geometry declaration did not work. The only occasion were the light was fixed relative to the scene was only when I've declared the lights on initialization.

Any thoughts?
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by bogglez »

Uhm, actually I don't see any matrix code in gl-light.c:171. I think params should be multiplied with the current model view matrix there? Ph3nom should know.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

bogglez , how would I get the light position coords transformed under the current glLib ?
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by bogglez »

You would need to apply the same matrix as to the triangles' vertices. So ModelViewMatrix * lightPos. See for example gl-arrays.c:221. _glKosMatrixLoadModelView() seems to load the matrix into the matrix register, then mat_trans* will apply the matrix to a point.

I didn't check in-depth, but if this is indeed not done, then it's a bug and Ph3nom will be interested in fixing it.
For the time being you may decide to just supply a light position that you multiplied with a matrix before yourself.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

PH3NOM, any thoughts on the issue ?
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

I've been looking further into it, and, after performing some tests with a static camera and I have the same issues.
The vertex normal vectors are normalized, and the light is declared and enabled before the call to gluLookAt.
The cube also has hard edges along the edge of each face.
I have also :

Code: Select all

 
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glShadeModel(GL_SMOOTH);
Oddly, when the mesh rotates, the lightning is moving with the object.

Attachments
Screenshot of the issue
Screenshot of the issue
User avatar
PH3NOM
DC Developer
DC Developer
Posts: 576
Joined: Fri Jun 18, 2010 9:29 pm
Has thanked: 0
Been thanked: 5 times

Re: Light appears to move with camera.

Post by PH3NOM »

Jae686-
You never commented on my first reply.
I mention you set the Specular term when you should be setting the Diffuse term of the light.
Have you tried that yet?
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

PH3NOM wrote:Jae686-
You never commented on my first reply.
I mention you set the Specular term when you should be setting the Diffuse term of the light.
Have you tried that yet?

Good Morning PH3N0N.

Indeed I had set the diffuse term of the light when you mentioned it.
I've been running some tests and I'm beginning to believe that it might be some issue with my obj loader (regarding the handling of the vertex normals).
It may probably be related to the fact that I'm unindexing the array and, well, messing up the normals on the process. (and yes, my normal vectors are normalized).

I will probably replace my loader with this one http://syoyo.github.io/tinyobjloader/ and make further tests.

Best Regards!
Jae686
Insane DCEmu
Insane DCEmu
Posts: 112
Joined: Sat Sep 22, 2007 9:43 pm
Location: Braga - Portugal
Has thanked: 0
Been thanked: 0

Re: Light appears to move with camera.

Post by Jae686 »

Good afternoon.

I've been making some tests with this exporter (in order to single out my .obj importer bug's), and the issue still remains.

The lighting issue can been seen even on the static mesh (light rotates with mesh?).
The missing triangles are also an unexpected issue.

For obvious reasons, I've changed the code suggested on the exporter page to :

Code: Select all

void draw_cube_header()
{
	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, sizeof (struct vertex_struct), &vertices[0].x );

	glEnableClientState(GL_NORMAL_ARRAY);
	glNormalPointer(GL_FLOAT, sizeof (struct vertex_struct), &(vertices[0].nx) );	

	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
	glTexCoordPointer(2, GL_FLOAT,sizeof (struct vertex_struct),&vertices[0].u);

	glDrawElements(GL_TRIANGLES, vertex_count[0], INX_TYPE, indexes);

	glDisableClientState(GL_VERTEX_ARRAY);
	glDisableClientState(GL_NORMAL_ARRAY);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
I'm really getting quite lost on this lightning issue.....

The geometry information is, as exported :

Code: Select all


#ifndef _BLENDER_EXPORT_H_
#define _BLENDER_EXPORT_H_

#define OBJECTS_COUNT 1
#define CUBE 0
/***************************************
 *          local transformations
 ***************************************/

float transformations[][16]={
	{1.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 0.000000f, 0.000000f, 1.000000f},
 };
/***************************************
 *	faces count for each mesh 
 ***************************************/
unsigned int faces_count[]={12};

/***************************************
 *	vertices count for each mesh 
 ***************************************/
unsigned int vertex_count[]={24};

/***************************************
 *	offset tables for each mesh  
 ***************************************/
unsigned int vertex_offset_table []={
	0, 
};
unsigned int indices_offset_table []={
	0, 
};
/***************************************
 *	vertices definition
 ***************************************/

struct vertex_struct {
	float x,y,z;
	float nx,ny,nz;
	float u,v;
};
struct vertex_struct vertices[]={
	/* CUBE: 24 vertices */
	{1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 0.000000f},
	{1.000000f, -1.000000f, -1.000000f, 0.000000f, 0.000000f, -1.000000f, 1.000000f, 0.000000f},
	{-1.000000f, -1.000000f, -1.000000f, 0.000000f, 0.000000f, -1.000000f, 1.000000f, 1.000000f},
	{-1.000000f, 1.000000f, -1.000000f, 0.000000f, 0.000000f, -1.000000f, 0.000000f, 1.000000f},
	{1.000000f, 0.999999f, 1.000000f, 0.000000f, -0.000000f, 1.000000f, 0.000000f, 0.000000f},
	{-1.000000f, 1.000000f, 1.000000f, 0.000000f, -0.000000f, 1.000000f, 1.000000f, 0.000000f},
	{-1.000000f, -1.000000f, 1.000000f, 0.000000f, -0.000000f, 1.000000f, 1.000000f, 1.000000f},
	{0.999999f, -1.000001f, 1.000000f, 0.000000f, -0.000000f, 1.000000f, 0.000000f, 1.000000f},
	{1.000000f, 1.000000f, -1.000000f, 1.000000f, -0.000000f, 0.000000f, 0.000000f, 0.000000f},
	{1.000000f, 0.999999f, 1.000000f, 1.000000f, -0.000000f, 0.000000f, 1.000000f, 0.000000f},
	{0.999999f, -1.000001f, 1.000000f, 1.000000f, -0.000000f, 0.000000f, 1.000000f, 1.000000f},
	{1.000000f, -1.000000f, -1.000000f, 1.000000f, -0.000000f, 0.000000f, 0.000000f, 1.000000f},
	{1.000000f, -1.000000f, -1.000000f, -0.000000f, -1.000000f, -0.000000f, 0.000000f, 0.000000f},
	{0.999999f, -1.000001f, 1.000000f, -0.000000f, -1.000000f, -0.000000f, 1.000000f, 0.000000f},
	{-1.000000f, -1.000000f, 1.000000f, -0.000000f, -1.000000f, -0.000000f, 1.000000f, 1.000000f},
	{-1.000000f, -1.000000f, -1.000000f, -0.000000f, -1.000000f, -0.000000f, 0.000000f, 1.000000f},
	{-1.000000f, -1.000000f, -1.000000f, -1.000000f, 0.000000f, -0.000000f, 0.000000f, 0.000000f},
	{-1.000000f, -1.000000f, 1.000000f, -1.000000f, 0.000000f, -0.000000f, 1.000000f, 0.000000f},
	{-1.000000f, 1.000000f, 1.000000f, -1.000000f, 0.000000f, -0.000000f, 1.000000f, 1.000000f},
	{-1.000000f, 1.000000f, -1.000000f, -1.000000f, 0.000000f, -0.000000f, 0.000000f, 1.000000f},
	{1.000000f, 0.999999f, 1.000000f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 0.000000f},
	{1.000000f, 1.000000f, -1.000000f, 0.000000f, 1.000000f, 0.000000f, 1.000000f, 0.000000f},
	{-1.000000f, 1.000000f, -1.000000f, 0.000000f, 1.000000f, 0.000000f, 1.000000f, 1.000000f},
	{-1.000000f, 1.000000f, 1.000000f, 0.000000f, 1.000000f, 0.000000f, 0.000000f, 1.000000f},
};

#define INX_TYPE GL_UNSIGNED_SHORT
unsigned short indexes[]={
/* CUBE 12 faces */
0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23, 
};
#endif

My render code is as follows...

Code: Select all

void new_draw(pDemoAssetList a) {
	// measures the time it took to render in order to keep the animation time dependent instead of frame rate dependent.
	// the scene descriptor WILL get modified during the demo execution

	uint64 ms_start;
	uint64 ms_end;
	uint64 ms_elapsed;

	pDemoAssetList iter;
	p3DModelList m;
	pTextureList t;
	pSceneDescription d;
	pCameraList c;
	pTransformList tr;
	pStats s ;

	pmesh curr_model;
	pmesh aux_model;
	int curr_texture;
	int curr_texture_pos;

	iter = a;

	

	m = iter->m;  // model list
	t = iter->t;  // texture list
	d = iter->d;  // scene descriptor
	c = iter->c;  // camera descriptor
	s = iter->s;  // stats descriptor

	pSceneDescription d_light = d ;

	ms_start = timer_ms_gettime64();

	
	while(isCameraInTime(c, iter->milisec_elapsed) == 0) {
		c = c->next;  // seeks the camera in the current time frame
	}

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glMatrixMode(GL_PROJECTION);
	glLoadMatrixf(projectionMatrix);
	glMatrixMode(GL_MODELVIEW);
	
	glLoadIdentity();

	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	
	

	
	while(d_light != NULL) //d_light != NULL)
	{
		
		
		if(d_light->render_effects & SIMPLE_LIGHT)
		{
			
	
			for(tr = (pTransformList)d_light->transforms; tr != NULL; tr = (pTransformList)tr->next) {

				if((tr->transformType == LIGHT_DIFFUSE) && (d_light->render_effects & SIMPLE_LIGHT)) {
					GLfloat diffuse_val[] = {tr->transformData.x, tr->transformData.y, tr->transformData.z, 1.0} ;
					
					//printf("light color : %f %f %f \n", tr->transformData.x, tr->transformData.y, tr->transformData.z);
					glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_val);	
				}

				if((tr->transformType == TRANSLATION) && (d_light->render_effects & SIMPLE_LIGHT)) {
					//glTranslatef( -(c->start_pos.x), -(c->start_pos.y), -(c->start_pos.z));
					GLfloat position_val[] = {tr->transformData.x, tr->transformData.y, tr->transformData.z, 0.0} ;
					//GLfloat position_val[] = {1.0, 1.0, 1.0, 0.0} ;
					//printf("light position : %f %f %f \n", tr->transformData.x, tr->transformData.y, tr->transformData.z);
					
					glLightfv(GL_LIGHT0, GL_POSITION, position_val);
				}

			}
			
		}
		
		
		d_light = d_light->next;  // goes to the next element
		
	}

	
	gluLookAt(c->start_pos.x, c->start_pos.y, c->start_pos.z, 
			 c->start_looking_direction.x, c->start_looking_direction.y, 
			 c->start_looking_direction.z, 0.0, 0.0, 1.0);


	//printf("Camera x %f y %f z %f \n",c->start_pos.x, c->start_pos.y, c->start_pos.z );

	
	
	while(d != NULL)  // goes trough all the meshes on the asset list
	{

		glPushMatrix();
		
		if(d->render_effects & DRAW_WIREFRAME) {
			// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		}

		if(d->render_effects & DRAW_FLAT) {
			// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		}

		
		for(tr = (pTransformList)d->transforms; tr != NULL; tr = (pTransformList)tr->next) {

			
			if((tr->transformType == ROTATION) && !(d->render_effects & SIMPLE_LIGHT)) {
				
				
				glRotatef(tr->scalar_val, tr->transformData.x, tr->transformData.y, tr->transformData.z);
				tr->scalar_val++ ;
				
			}
			if((tr->transformType == TRANSLATION) && !(d->render_effects & SIMPLE_LIGHT)) {
				
				glTranslatef(tr->transformData.x , tr->transformData.y , tr->transformData.z );
			}
			if((tr->transformType == SCALE) && !(d->render_effects & SIMPLE_LIGHT)) {
				
				glScalef(tr->transformData.x, tr->transformData.y, tr->transformData.z);
			}


		}
		
		if(d->render_effects & DRAW_REGULAR)  // regular model drawing
		{

			// if fade_in == fade_out , start == end, assume the mesh is "allways alive"
			if((d->start == d->end))
			{
				curr_texture_pos = getTexturePos(t, d->texture_name);
				curr_texture = retrieveTextureHandle(t, curr_texture_pos);
				glBindTexture(GL_TEXTURE_2D, curr_texture);
				curr_model = retrieveMesh(m, getMeshPos(m, d->mesh_name));
				addMeshStat(s, curr_model) ;
				//draw_p(curr_model);
				draw_cube_header();
			}
			else
			{
				if(is_it_on_time(iter->milisec_elapsed, d->start, d->end))
				{
					curr_texture_pos = getTexturePos(t, d->texture_name);
					curr_texture = retrieveTextureHandle(t, curr_texture_pos);
					glBindTexture(GL_TEXTURE_2D, curr_texture);
					curr_model = retrieveMesh(m, getMeshPos(m, d->mesh_name));
					addMeshStat(s, curr_model);
					draw_p(curr_model);
				}
			}
		}
		if(d->render_effects & DRAW_GRID)  // renders a given mesh multiple times on a grid mesh
		{

			curr_texture_pos = getTexturePos(t, d->texture_name);
			curr_texture = retrieveTextureHandle(t, curr_texture_pos);

			glBindTexture(GL_TEXTURE_2D, curr_texture);

			curr_model = retrieveMesh(m, (getMeshPos(m, d->name)));    // the grid mesh. Cant figure out WHY I must -1 on the position.
			aux_model = retrieveMesh(m, getMeshPos(m, d->mesh_name));  // the mesh to be rendered on the grid

			gridDraw(aux_model, curr_model, a);
		}

		if(d->render_effects & DRAW_2D_OVERLAY)  // 2d overlay
		{
			if(is_it_on_time(iter->milisec_elapsed, d->start, d->end)) {
				tr = (pTransformList)d->transforms;
				float opac = opacity_level(iter->milisec_elapsed, d->start, d->end, d->fade_in, d->fade_out);
				//  printf("opacity : %f\n", opac );
				texture_overlay_at(t, d->texture_name, (unsigned int)tr->transformData.x, (unsigned int)tr->transformData.y, opac);
			}
		}

		glPopMatrix();

		d = d->next;  // goes to the next element
		
	}

	char hackjob[512];
	snprintf(hackjob, sizeof(hackjob), "ms elapsed : %lu ms", iter->milisec_elapsed);
	hackjob[511] = 0;

	print_text(a, "font_2", "Vollumetric Illusions Demo Framework v0.0.1", 10, 40, 0.4);
	print_text(a, "font", hackjob, 10, 80, 0.8);

	snprintf(hackjob, sizeof(hackjob), "vertex_count : %lu ", s->totalVerticesPerFrame);
	
	print_text(a, "font", hackjob, 10, 120, 0.5);

	glutSwapBuffers();

	resetStatsPerFrame(s);

	ms_end = timer_ms_gettime64();

	ms_elapsed = diff_msec(ms_start, ms_end);

	
	// HOTFIX FOR ERROR ON MS_ELAPSED ERROR CALCULATION ITS ONLY OBSERVED ON LXDREAM
	if(ms_elapsed > 100)
	{
		printf("ms_elapsed > 100 \n") ;
		printf("ms_elapsed = %llu ; ms_start = %llu ; ms_end = %llu \n", ms_elapsed, ms_start, ms_end);

	}
	else
	{
		iter->milisec_elapsed = iter->milisec_elapsed + ms_elapsed;
	}
	
	CameraListPosUpdate(iter->c, (iter->milisec_elapsed));

// check for OpenGL errors in debug releases with libgl15 (kgl has no support for glGetError)
#if !defined(NDEBUG) && defined(GLAPIENTRY)
	GLenum error;
	while((error = glGetError())) {
		printf("GL error: %s\n", gluErrorString(error));
	}
#endif
}
Post Reply