Commit 15542468 authored by Mark Frohnmayer's avatar Mark Frohnmayer
Browse files

nacl_test_tnl2 now runs properly

parent b81e4b96
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
<object type="application/x-torque-socket" id="torque_socket_plugin" width="0" height="0"> </object>
<h1>test_tnl2 embedded in a web page</h1>
 <p>
  You should a yellow box below, representing a server game world.  Red rectangles represent buildings in 
  You should a yellow box below, representing a client game world.  Red rectangles represent buildings in 
  the sample game world and the small blue squares represent players.
 </p>
 <p>
+2 −0
Original line number Diff line number Diff line
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --no-sandbox --enable-nacl localhost:5103/nacl_test_tnl2.html
+17 −10
Original line number Diff line number Diff line
@@ -135,26 +135,33 @@ static void test_game_render_frame_open_gl(test_game *the_game)
	glClearColor(1, 1, 0, 0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	enum {
		circle_vert_count = 30,
	};
	GLfloat circle_verts[3 * (circle_vert_count + 1)];
	glEnableVertexAttribArray(0);
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, circle_verts);

	/*if(the_game->_client_player)
	if(the_game->_client_player)
	{
		position p = the_game->_client_player->_render_pos;
		glEnable(GL_BLEND);
		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glBegin(GL_POLYGON);
		glColor4f(0.5f, 0.5f, 0.5f, 0.65f);
		for(float32 r = 0; r < 3.1415 * 2; r += 0.1f)
		for(uint32 i = 0; i < (circle_vert_count+1); i++)
		{
			glVertex2f(p.x + 0.25f * cos(r), p.y + 0.25f * sin(r));
			float r = (i / float(circle_vert_count)) * 3.1415 * 2;
			GLfloat *v = circle_verts + i * 3;
			v[0] = (p.x + 0.25f * cos(r)) * 2 - 1;
			v[1] = 1 - (p.y + 0.25f * sin(r)) * 2;
			v[2] = 0;
		}
		
		glEnd();
		glUniform4f(color_loc, 0.5, 0.5, 0.5, 0.65);
		glDrawArrays(GL_TRIANGLE_FAN, 0,circle_vert_count - 1);
		glDisable(GL_BLEND);
	}*/
	}
	
	GLfloat render_vertices[12];
	glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, render_vertices);
	glEnableVertexAttribArray(0);
	
	// then draw all the _buildings.
	glUniform4f(color_loc, 1, 0, 0, 1);
+4 −4
Original line number Diff line number Diff line
@@ -165,6 +165,8 @@ public:
	/// If force is true and there is space in the window, it will always send a packet.
	void check_packet_send(bool force, net::time current_time)
	{
		if(window_full() || !is_data_to_transmit())
			return;
		net::time delay = net::time( _current_packet_send_period );
		
		if(!force)
@@ -177,8 +179,6 @@ public:
				_send_delay_credit = net::time(1000);
		}
		prepare_write_packet();
		if(window_full() || !is_data_to_transmit())
			return;
		net::packet_stream stream(_current_packet_send_size);
		_last_update_time = current_time;
		
@@ -308,7 +308,7 @@ public:
	
	bool window_full()
	{
		return _notify_queue_head && (_last_send_sequence - _notify_queue_head->sequence >= torque_sockets_packet_window_size);
		return _notify_queue_head && (_last_send_sequence - _notify_queue_head->sequence >= torque_sockets_packet_window_size - 2);
	}
			
			
@@ -365,7 +365,7 @@ public:
protected:
	enum rate_defaults {
		default_fixed_bandwidth = 2500, ///< The default send/receive bandwidth - 2.5 Kb per second.
		default_fixed_send_period = 96, ///< The default delay between each packet send - approx 10 packets per second.
		default_fixed_send_period = 200, ///< The default delay between each packet send - approx 5 packets per second.
		max_fixed_bandwidth = 65535, ///< The maximum bandwidth for a connection using the fixed rate transmission method.
		max_fixed_send_period = 2047, ///< The maximum period between packets in the fixed rate send transmission method.
	};