顯示具有 opengl 標籤的文章。 顯示所有文章
顯示具有 opengl 標籤的文章。 顯示所有文章

2018年6月18日 星期一

test emscription examples

python tests/runner.py

2018年5月23日 星期三

build OpenCV with OpenGL 在windows10上

1.安裝CMake for windows
2.download OpenCV source
3.建立C:\opencv3
4.建立sources和build資料夾
5.把OpenCV的檔案搬到sources下
6.Configure
7.勾選BUILD_EXAMPLES,WITH_OPENGL'
8.generate
9.用Visual Studio 2017 compile
10.
char files[10];
sprintf(files,"E:\\fire.avi");
 

    cv::VideoCapture cap;


cap.open(files);

11.cmd>opengl-example-opengl_interop.exe
12


OpenGL參考
Windows SDK which includes OpenGL and GLU (OpenGL Utility). The Visual C++ 2010 Express bundles the Microsoft Windows SDK, which would be installed in "C:\Program Files\Microsoft SDKs\Windows\v7.0A". (Otherwise, you need to download and install the Windows SDK separately).
The followings are used from Windows SDK:
  • gl.hglu.h: header for OpenGL and GLU in directory "C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\gl".
  • opengl32.libglu32.lib: libraries for OpenGL and GLU in directory "C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib".
  • opengl32.dllglu32.dll: dynamic link libraries for OpenGL and GLU in directory "C:\Windows\System32". This directory is to be included in PATH environment variable.
你可以把它放在與exe檔在一起

2015年3月25日 星期三

save graphics output as Windows Bitmap(*.bmp)

Uint32 rmask, gmask, bmask, amask;

    /* SDL interprets each pixel as a 32-bit number, so our masks must depend
       on the endianness (byte order) of the machine */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    rmask = 0xff000000;
    gmask = 0x00ff0000;
    bmask = 0x0000ff00;
    amask = 0x000000ff;
#else
    rmask = 0x000000ff;
    gmask = 0x0000ff00;
    bmask = 0x00ff0000;
    amask = 0xff000000;
#endif

w=400;
h=500;
unsigned char * pixels = new unsigned char[w*h*4]; // 4 bytes for RGBA
    glReadPixels(0,0,w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels);

     SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, width, height, 8*4, width*4, rmask, gmask, bmask, amask);                                                                                      
    SDL_SaveBMP(surf, filename);

    SDL_FreeSurface(surf);
    delete [] pixels;

2014年10月17日 星期五

nVidia gamework opengl samples build error

./../../../extensions/externals/lib/linux64/libglfw3.a(x11_gamma.c.o): In function `_glfwInitGammaRamp':
x11_gamma.c:(.text+0x49): undefined reference to `XRRGetScreenResources'
====================================================
linux ubuntu 14.04
  1. cd /usr/bin/
  2. sudo rm ld
  3. sudo ln -s ld.gold ld

2014年1月7日 星期二

PIX for windows擷取模擬樂園3的directx

PIX for windows 是DirectX SDK 的utility

在trace RCT3是遇到
PIX Experiment File Version Mismatch"
This program expects and experiment file version of 202, but the file 'C:\Some Directory Path\PIXD4.tmp ' has a version of 0.
Proceeding may cause this program to crash or behave incorrectly.
Continue loading file?

這是因為執行檔有中文路徑

Ref


2013年11月12日 星期二

halo effect and stencil buffer



         glEnable(GL_STENCIL_TEST);

         glStencilFunc(GL_ALWAYS, 1, 0xFF); // Set any stencil to 1
         glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
         glStencilMask(0xFF); // Write to stencil buffer
         glDepthMask(GL_FALSE); // Don't write to depth buffer
         glClear(GL_STENCIL_BUFFER_BIT); // Clear stencil buffer (0 by default)
glDisable(GL_BLEND);

//draw原來物件

         glStencilFunc(GL_EQUAL, 0, 0xFF); // Pass test if stencil value is 1
         glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);      
         glStencilMask(0x00); // Don't write anything to stencil buffer

glEnable(GL_BLEND);
//draw halo object
         glDepthMask(GL_TRUE);