${#string}
返回$string的长度
${string:position}
在$string中,从$position位置之后开始提取子串
${string:position:length}
在$string中,从$position位置之后开始提取$length长度的子串
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
int main(int argc, const char *argv[]) | |
{ |
#include <time.h> | |
#include <iostream> | |
#include <limits> | |
int TimeZoneOffsetSecond() | |
{ | |
// cache, need compute only once | |
static int offset = std::numeric_limits<int>::min(); | |
if (offset != std::numeric_limits<int>::min()) | |
{ |
[user] | |
name = yourname | |
email = [email protected] | |
[push] | |
default = simple | |
[diff] | |
tool = vimdiff | |
[difftool] | |
prompt = false | |
[credential] |
#!/usr/bin/python | |
# coding: utf-8 | |
import json | |
import inspect | |
def html_form(func): | |
argspec = inspect.getargspec(func) | |
default_start = len(argspec[0]) - len(argspec[3]) | |
index = 0 | |
args = {} |
########## Encapsule Colored Logger Begin ########## | |
LOG_FORMAT = "%(asctime)s|%(filename)s:%(lineno)d|%(levelname)s|%(funcName)s|%(message)s" | |
class LoggerFactory: | |
def __init__(self, name, path=""): | |
self.__name = name | |
self.__path = path | |
timestr = time.strftime('%Y%m%d', time.localtime(time.time())) | |
self.__logfile = path + name + "_" + timestr + ".log" | |
def get_normal_logger(self): |
"""""""""""""""""""""""""""""""""""""""""" | |
""" Pre: Get the solarized colorscheme | |
""" mv solarized.vim ~/.vim/colors/ | |
"""""""""""""""""""""""""""""""""""""""""" | |
""" Be iMproved | |
set nocompatible | |
syntax enable | |
" syntax on |
CC := g++ | |
CFLAGS := -Wall -g | |
TARGET := test | |
# $(wildcard *.cpp /xxx/xxx/*.cpp): get all .cpp files from the current directory and dir "/xxx/xxx/" | |
SRCS := $(wildcard *.cpp) | |
# $(patsubst %.cpp,%.o,$(SRCS)): substitute all ".cpp" file name strings to ".o" file name strings | |
OBJS := $(patsubst %.cpp,%.o,$(SRCS)) | |
all: $(TARGET) |
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
VAOs act similarly to VBOs and textures with regard to how they are bound. Having a single VAO bound for the entire length of your program will yield no performance benefits because you might as well just be rendering without VAOs at all. In fact it may be slower depending on how the implementation intercepts vertex attribute settings as they're being drawn.
The point of a VAO is to run all the methods necessary to draw an object once during initialization and cut out all the extra method call overhead during the main loop. The point is to have multiple VAOs and switch between them when drawing.
In terms of best practice, here's how you should organize your code:
initialization:
for each batch
generate, store, and bind a VAO