亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? render.cpp

?? wince 3d tutorial, it has various examples
?? CPP
字號:
#include "render.h" //We need the defines and prototypes of there

EGLDisplay glesDisplay;  // EGL display
EGLSurface glesSurface;	 // EGL rendering surface
EGLContext glesContext;	 // EGL rendering context

//Variables declared in main.cpp, but used here too
extern HWND hWnd; // A handle to the window we will create
extern HDC hDC;   // A handle to the device context of the window. Needed to 
extern bool drawInOrtho;

bool InitOGLES()
{  
  EGLConfig configs[10];
  EGLint matchingConfigs;	

  /*configAttribs is a integers list that holds the desired format of 
   our framebuffer. We will ask for a framebuffer with 24 bits of 
   color and 16 bits of z-buffer. We also ask for a window buffer, not 
   a pbuffer or pixmap buffer*/	
  const EGLint configAttribs[] =
  {
      EGL_RED_SIZE,       8,
      EGL_GREEN_SIZE,     8,
      EGL_BLUE_SIZE,      8,
      EGL_ALPHA_SIZE,     EGL_DONT_CARE,
      EGL_DEPTH_SIZE,     16,
      EGL_STENCIL_SIZE,   EGL_DONT_CARE,
      EGL_SURFACE_TYPE,   EGL_WINDOW_BIT,
      EGL_NONE,           EGL_NONE
  };
  
  hDC = GetWindowDC(hWnd);
  glesDisplay = eglGetDisplay(hDC);	 //Ask for an available display

  //Display initialization (we don't care about the OGLES version numbers)
  if(!eglInitialize(glesDisplay, NULL, NULL)) 
    return false;
	
  /*Ask for the framebuffer confiburation that best fits our 
  parameters. At most, we want 10 configurations*/
  if(!eglChooseConfig(glesDisplay, configAttribs, &configs[0], 10,  &matchingConfigs)) 
   return false;
	
  //If there isn't any configuration enough good
  if (matchingConfigs < 1)  return false;	  

  /*eglCreateWindowSurface creates an onscreen EGLSurface and returns 
  a handle  to it. Any EGL rendering context created with a 
  compatible EGLConfig can be used to render into this surface.*/
  glesSurface = eglCreateWindowSurface(glesDisplay, configs[0], hWnd, configAttribs);	
  if(!glesSurface) return false;
  
  // Let's create our rendering context
  glesContext=eglCreateContext(glesDisplay,configs[0],0,configAttribs);

  if(!glesContext) return false;

  //Now we will activate the context for rendering	
  eglMakeCurrent(glesDisplay, glesSurface, glesSurface, glesContext); 
    
  /*Remember: because we are programming for a mobile device, we cant 
  use any of the OpenGL ES functions that finish in 'f', we must use 
  the fixed point version (they finish in 'x'*/
  glClearColorx(0, 0, 0, 0);
  //Do not want to see smoothed colors, only a plain color for face
  glShadeModel(GL_FLAT);  
  //Enable the depth test in order to see the cube correctly
  glEnable(GL_DEPTH_TEST);
  /*Taking care of specifying correctly the winding order of the 
  vertices (counter clock wise order), we can cull up all back faces.
  This is probably one of the better optimizations we could work,
  because we are avoiding a lot of computations that wont be reflected
  in the screen, using  glEnable(GL_CULL_FACE) to do the work*/
  glEnable(GL_CULL_FACE);

  /*In order to set a viewport that fits entirely our window, we need 
  to know the window dimensions. They could be obtained through the   
  WinCE call GetWindowRect, using our window handle*/
  RECT r;
  GetWindowRect(hWnd, &r);  
  glViewport(r.left, r.top, r.right - r.left, r.bottom - r.top);		  
  SetOrtho();
  return true;
}
//----------------------------------------------------------------------------
void Render()
{
  static int rotation = 0;
    
  // We are going to draw a cube centered at origin, and with an edge of 10 units
  /*
           7                      6
            +--------------------+
          / |                   /|
        /   |                 /  |
   3  /     |             2 /    |
    +---------------------+      |
    |       |             |      |
    |       |             |      |
    |       |             |      |
    |       |             |      |
    |       |             |      |
    |       |             |      |
    |       |             |      |
    |       |4            |      |5
    |       +-------------|------+
    |     /               |     /
    |   /                 |   /
    | /                   | /
    +---------------------+
   0                      1
  
  */
  

  static GLubyte front[]  = {2,1,3,0}; //front face
  static GLubyte back[]   = {5,6,4,7}; //back face
  static GLubyte top[]    = {6,2,7,3}; //top face
  static GLubyte bottom[] = {1,5,0,4}; //bottom face    
  static GLubyte left[]   = {3,0,7,4}; //left face
  static GLubyte right[]  = {6,5,2,1}; //right face

  static GLshort vertices[] = {-5,-5,-5,  5,-5,-5,  5,5,-5, -5,5,-5,  
                               -5,-5,5,   5,-5,5,   5,5,5,  -5,5,5};
                       
  
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  

  glLoadIdentity();
  if(!drawInOrtho)    
    glTranslatex(0, 0, FixedFromInt(-30));

  glRotatex(FixedFromInt(45), ONE, 0, 0);
  glRotatex(FixedFromInt(rotation++), 0, ONE,0); 
  

  //Enable the vertices array  
  glEnableClientState(GL_VERTEX_ARRAY);
  glVertexPointer(3, GL_SHORT, 0, vertices);
  //3 = XYZ coordinates, GL_SHORT = data type, 0 = 0 stride bytes
  
  /*We are going to draw the cube, face by face, with different colors for 
  each face, using indexed vertex arrays and triangle strips*/
  glColor4x(ONE,0,0,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, front);

  glColor4x(0,ONE,0,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, back);

  glColor4x(0,0,ONE,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, top);

  glColor4x(ONE,ONE,0,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, bottom);

  glColor4x(0,ONE,ONE,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, left);

  glColor4x(ONE,0,ONE,0);
  glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, right);

  
  glDisableClientState(GL_VERTEX_ARRAY);   	
  eglSwapBuffers(glesDisplay, glesSurface);
}
//----------------------------------------------------------------------------
void Perspective (GLfloat fovy, GLfloat aspect, GLfloat zNear,  GLfloat zFar)
{
  GLfixed xmin, xmax, ymin, ymax, aspectFixed, znearFixed;     
  
  aspectFixed = FixedFromFloat(aspect);
  znearFixed = FixedFromFloat(zNear);

  ymax = MultiplyFixed(znearFixed, FixedFromFloat((GLfloat)tan(fovy * 3.1415962f / 360.0f)));  
  ymin = -ymax;

  xmin = MultiplyFixed(ymin, aspectFixed);
  xmax = MultiplyFixed(ymax, aspectFixed);  
  glFrustumx(xmin, xmax, ymin, ymax, znearFixed, FixedFromFloat(zFar));
}
//----------------------------------------------------------------------------
void SetOrtho()
{
  /*Setup of the orthographic matrix. We use an ortho cube centered 
  at (0,0,0) with 40 units of edge*/
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();    
  glOrthox(FixedFromInt(-20), FixedFromInt(20), 
           FixedFromInt(-20), FixedFromInt(20), 
           FixedFromInt(-20) , FixedFromInt(20));
  glMatrixMode(GL_MODELVIEW);
  SetWindowText(hWnd, L"OpenGLES ortho"); // change the window title
}
//----------------------------------------------------------------------------
void SetPerspective()
{
  RECT r;
  GetWindowRect(hWnd, &r);    
  float ratio = (float)(r.right - r.left)/(r.bottom - r.top);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();        
  Perspective(45.0f,ratio, 1.0f, 40.0f);
  glMatrixMode(GL_MODELVIEW);
  SetWindowText(hWnd, L"OpenGLES perspective"); //change the window title
}
//----------------------------------------------------------------------------
void Clean()
{
  if(glesDisplay)
  {
    eglMakeCurrent(glesDisplay, NULL, NULL, NULL);  
    if(glesContext) eglDestroyContext(glesDisplay, glesContext);
    if(glesSurface) eglDestroySurface(glesDisplay, glesSurface);
    eglTerminate(glesDisplay);
  }  
}










?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品亚洲免费视频| 日韩视频在线永久播放| 中文字幕制服丝袜一区二区三区| 成人av在线一区二区三区| 欧美精品v日韩精品v韩国精品v| 一区二区三区在线观看动漫| 色欧美日韩亚洲| 亚洲国产精品人人做人人爽| 欧美一区二区在线免费播放| 黑人巨大精品欧美一区| 18成人在线观看| 欧美精品在线视频| 国产成人综合亚洲网站| 亚洲电影激情视频网站| 一区二区三区在线免费播放| 三级不卡在线观看| 国产精品美女久久久久aⅴ| 成人深夜福利app| 日韩**一区毛片| 亚洲视频在线一区二区| 日韩欧美卡一卡二| 欧美日本在线一区| 91免费小视频| 99热这里都是精品| 大胆亚洲人体视频| 极品少妇xxxx偷拍精品少妇| 亚洲bt欧美bt精品777| 一区二区三区欧美| 亚洲欧美日韩一区二区| 国产欧美日韩在线看| 久久尤物电影视频在线观看| 在线成人免费观看| 日韩一区二区免费电影| 91精品在线麻豆| 在线成人av网站| 日韩欧美国产高清| 精品精品国产高清一毛片一天堂| 成人丝袜视频网| 91在线国内视频| 欧美日韩aaaaaa| 精品奇米国产一区二区三区| 欧美xxxx在线观看| 国产亚洲自拍一区| 又紧又大又爽精品一区二区| 亚洲欧美国产高清| 午夜视频在线观看一区二区三区| 亚洲成人av一区二区三区| 亚洲一区在线免费观看| 久久成人羞羞网站| 丰满少妇在线播放bd日韩电影| 91在线观看高清| 欧美不卡一区二区| 中文字幕五月欧美| 久久99精品久久久久久| 99国产精品99久久久久久| 欧美一区二区三区系列电影| 国产精品美女一区二区三区 | 欧美在线观看18| 欧美大片顶级少妇| 亚洲一区在线电影| 成人短视频下载| 日韩精品一区在线| 99视频在线观看一区三区| 欧美中文字幕不卡| 国产精品毛片a∨一区二区三区| 午夜视黄欧洲亚洲| 色婷婷国产精品综合在线观看| 精品国产一区二区精华| 免费在线成人网| 欧美日韩高清一区| 午夜视频一区二区三区| 色哟哟在线观看一区二区三区| 国产日韩欧美激情| www.成人网.com| 国产精品成人网| 在线观看视频91| 免费在线看成人av| 精品美女被调教视频大全网站| 男人的天堂久久精品| 日韩一级高清毛片| 国产乱码精品一区二区三区av| 精品日韩一区二区三区| 丰满亚洲少妇av| 一区二区三区欧美日韩| 欧美一三区三区四区免费在线看| 日日摸夜夜添夜夜添国产精品| 欧美美女激情18p| 国产伦理精品不卡| 国产精品污污网站在线观看| 色一情一伦一子一伦一区| 五月天视频一区| 中文字幕精品一区二区精品绿巨人 | 美女尤物国产一区| 国产肉丝袜一区二区| 欧美日免费三级在线| 久久99国产精品免费| 亚洲精品一区二区三区影院| 久久精品国产色蜜蜜麻豆| 中文字幕不卡在线观看| 日韩一区二区三区高清免费看看| 国产福利一区二区三区在线视频| 一卡二卡欧美日韩| 国产精品无圣光一区二区| 91精品国产综合久久精品麻豆| 国产在线精品不卡| 日一区二区三区| 亚洲国产aⅴ成人精品无吗| 欧美激情中文字幕一区二区| 欧美一区二区三区影视| 欧美日韩另类一区| 欧美亚洲一区二区在线| 99精品久久免费看蜜臀剧情介绍| 国产综合色精品一区二区三区| 亚洲综合色婷婷| 亚洲欧美日韩人成在线播放| 中文字幕精品一区二区三区精品| 91精品国产综合久久国产大片| 欧美日韩在线播放一区| 欧美理论片在线| 日韩三级.com| 国产亚洲一区二区三区在线观看 | 欧美乱妇15p| 欧美三级中文字幕在线观看| 欧美日韩视频在线第一区 | 国产欧美日韩不卡| 国产精品三级视频| 亚洲自拍偷拍av| 久久精品免费观看| 国产成人aaa| 欧洲一区二区三区在线| 欧美成人激情免费网| 欧美国产日本视频| 夜夜夜精品看看| 美女任你摸久久| 91麻豆123| 精品国产乱码久久久久久浪潮 | 视频在线观看一区二区三区| 综合久久国产九一剧情麻豆| 亚洲福利视频一区| 久久99国产精品尤物| 一本一道久久a久久精品综合蜜臀| 欧美主播一区二区三区| 日本一区二区成人| 国产精品99精品久久免费| 日韩天堂在线观看| 亚洲女性喷水在线观看一区| 国产日韩欧美一区二区三区综合| 久久午夜羞羞影院免费观看| 欧美韩国日本不卡| 亚洲精品国产精华液| 韩国v欧美v亚洲v日本v| 免费的成人av| 成人午夜激情影院| 精品国产一区二区三区av性色| 国产精品成人免费精品自在线观看 | 成人91在线观看| 欧美大黄免费观看| 日韩精品一二三四| 欧美日韩精品一区二区| 亚洲一区二区av电影| 99久久精品免费看国产免费软件| 精品国产一区二区在线观看| 五月天中文字幕一区二区| 欧美午夜电影一区| 蜜桃精品在线观看| 久久综合九色综合97_久久久| 亚洲乱码国产乱码精品精的特点| 精品一区二区三区香蕉蜜桃| 久久综合狠狠综合久久综合88| 麻豆精品一区二区av白丝在线| 久久久久久一级片| 99久久精品国产麻豆演员表| 最近中文字幕一区二区三区| 在线免费观看不卡av| 日本中文字幕一区| 国产区在线观看成人精品| 在线视频一区二区三区| 蜜桃视频第一区免费观看| 国产欧美日韩另类视频免费观看| 99久久精品国产毛片| 美洲天堂一区二卡三卡四卡视频 | 国产一区二区三区不卡在线观看| 久久久国产精华| 欧美日韩视频在线第一区| 粉嫩av一区二区三区粉嫩| xnxx国产精品| 欧美四级电影网| 成人午夜视频网站| 精品亚洲国产成人av制服丝袜| 一区二区免费在线| 欧美高清一级片在线观看| 欧美成人女星排行榜| 欧洲中文字幕精品| 91亚洲精品久久久蜜桃网站| 国产精品综合二区| 极品尤物av久久免费看| 日韩成人免费电影| 日韩一区欧美二区| 日日摸夜夜添夜夜添国产精品| 午夜电影一区二区三区|