Skip to content

Instantly share code, notes, and snippets.

View PharrellWANG's full-sized avatar

Pharrell PharrellWANG

View GitHub Profile
@PharrellWANG
PharrellWANG / Demo.c
Created January 6, 2021 08:15 — forked from mikeando/Demo.c
Example of using C++ from C.
#include "HMyClass.h"
#include <stdio.h>
void my_eh( const char * error_message, void * unused)
{
printf("my_eh: %s\n", error_message);
}
int main()
{
@PharrellWANG
PharrellWANG / How to Access Data in the Backbuffer in Direct3D 9.cpp
Created February 27, 2021 04:07 — forked from karlgluck/How to Access Data in the Backbuffer in Direct3D 9.cpp
This is the code for accessing pixel data from the backbuffer in a D3D9 application. Keywords: LPDIRECT3DSURFACE9 read backbuffer copy back buffer directly access back buffer Direct3D device DirectX 9
void demoExtractBackBufferPixels(LPDIRECT3DDEVICE9 d3d_device) {
// TODO: In your app, add FAILED() macros to check the HRESULTs passed back
// by each of the API calls. I leave these out for clarity.
// Grab the backbuffer from the Direct3D device
LPDIRECT3DSURFACE9 back_buffer = NULL;
d3d_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &back_buffer);
// Get the buffer's description and make an offscreen surface in system memory.
@PharrellWANG
PharrellWANG / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created July 13, 2021 12:41 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \