实现一个简单的 HTTP Client

httpclient-cli

Linux 下用 C 语言实现发送 HTTP 请求并获取 html 文档内容的 CLI 程序

理论基础

HTTP 请求报文格式

一个 HTTP 请求报文由请求行(request line)、请求头部(header)、空行和请求数据 4 个部分组成,下图给出了请求报文的一般格式。

阅读更多

LibGDX 中图元 Mesh 的使用以及参考示例

这篇文章可能不完整

好吧最近撸码撸得想吐,什么都不想干了,抽点时间写写博客。以下是之前在 libGDX 学习中遇到的一些关于 Mesh 问题。关于 Mesh (图元)在 libgdx 中的使用,本来对于国内 libgdx 的开发资料比较缺乏,之前也看了网上的一些教程,感觉很对都没有写清楚(还是我理解能力太差?)或者是把它讲得比较复杂,难以理解。浏览了部分资料后自己写了一个 demo。 本文采用 libGDX-0.99 版本,1.x 版本 API 可能会有变化。

API

qute: A Mesh consists of vertices and optionally indices which specify which vertices define a triangle. Each vertex is composed of attributes such as position, normal, color or texture coordinate. Note that not all of this attributes must be given, except for position which is non-optional. Each attribute has an alias which is used when rendering a Mesh in OpenGL ES 2.0. The alias is used to bind a specific vertex attribute to a shader attribute. The shader source and the alias of the attribute must match exactly for this to work.

大致说明了一个 mesh 包含了多个 vertice 即顶点,每个顶点都有各自的属性,包括颜色、位置、纹理等等。平时常用的构造函数就是:

阅读更多