Skip to content

Instantly share code, notes, and snippets.

prife

Block or report user

Report or block prife

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View hammerspoon.init.lua
local hyper = {'shift', 'cmd'}
local hyper2 = {'ctrl', 'cmd'}
-- hyper + up maximize the current window
hs.hotkey.bind(hyper, 'up', function()
hs.grid.maximizeWindow()
end)
hs.hotkey.bind(hyper, "Left", function()
local win = hs.window.focusedWindow()
local f = win:frame()
View Using GL_OES_EGL_image_external on Android
1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls.
2. In the fragment shader define a requirement to use the extension:
#extension GL_OES_EGL_image_external : require
3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D.
Everything below here is all in the C code, no more Java.
4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions.
@prife
prife / sth_about_struct_in_C.txt
Created Oct 2, 2012
ANSI C中struct型数据的内存布局与对齐问题
View sth_about_struct_in_C.txt
《ANSI C中struct型数据的内存布局与对齐问题》
楼主自述:本文是笔者的一篇读书笔记,原文见参考文献1。笔者从原文中获取了很多知识,并根据编译器输出做了进一步的总结。
下面是正文。
--------------------------------------------------------------------------------
在VS2005中,如果使用/zp指定了内存对齐的边界,将这个边界记为ZP
1. ANSI C标准规定结构体类型的对齐要求不能比它所有字段中要求最严格的那个宽松,可以更严格(但此非强制要求,VC7.1就仅仅是让它们一样严格)将struct所有字段中要求最严格的字段的对齐记为ST。
2. 如果没有指定ZP时,对结构体内的某个域(假设其基本数据类型为T)的对齐模数(也就是此域的对齐地址)就是T的大小,即sizeof(T)。如果指定了ZP,此时结构体每个feild的对齐地址为当前这个域的sizeof值与ZP的中较小的值。
You can’t perform that action at this time.