久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='5TYF3'></tfoot>

<i id='5TYF3'><tr id='5TYF3'><dt id='5TYF3'><q id='5TYF3'><span id='5TYF3'><b id='5TYF3'><form id='5TYF3'><ins id='5TYF3'></ins><ul id='5TYF3'></ul><sub id='5TYF3'></sub></form><legend id='5TYF3'></legend><bdo id='5TYF3'><pre id='5TYF3'><center id='5TYF3'></center></pre></bdo></b><th id='5TYF3'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5TYF3'><tfoot id='5TYF3'></tfoot><dl id='5TYF3'><fieldset id='5TYF3'></fieldset></dl></div>

    • <bdo id='5TYF3'></bdo><ul id='5TYF3'></ul>
  • <legend id='5TYF3'><style id='5TYF3'><dir id='5TYF3'><q id='5TYF3'></q></dir></style></legend>

      <small id='5TYF3'></small><noframes id='5TYF3'>

      1. glGenVertexArrays(1, &amp;vao) 處的分段錯(cuò)誤;

        Segmentation fault at glGenVertexArrays( 1, amp;vao );(glGenVertexArrays(1, amp;vao) 處的分段錯(cuò)誤;)
        <i id='cHdxI'><tr id='cHdxI'><dt id='cHdxI'><q id='cHdxI'><span id='cHdxI'><b id='cHdxI'><form id='cHdxI'><ins id='cHdxI'></ins><ul id='cHdxI'></ul><sub id='cHdxI'></sub></form><legend id='cHdxI'></legend><bdo id='cHdxI'><pre id='cHdxI'><center id='cHdxI'></center></pre></bdo></b><th id='cHdxI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cHdxI'><tfoot id='cHdxI'></tfoot><dl id='cHdxI'><fieldset id='cHdxI'></fieldset></dl></div>

            <bdo id='cHdxI'></bdo><ul id='cHdxI'></ul>

            <legend id='cHdxI'><style id='cHdxI'><dir id='cHdxI'><q id='cHdxI'></q></dir></style></legend>
            • <tfoot id='cHdxI'></tfoot>
                • <small id='cHdxI'></small><noframes id='cHdxI'>

                    <tbody id='cHdxI'></tbody>
                  本文介紹了glGenVertexArrays(1, &amp;vao) 處的分段錯(cuò)誤;的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時(shí)送ChatGPT賬號(hào)..

                  我的 gdb 回溯給出:

                  My gdb backtrace gives:

                  (gdb) backtrace
                  #0  0x00000000 in ?? ()
                  #1  0x0804a211 in init () at example1.cpp:147
                  #2  0x0804a6bc in main (argc=1, argv=0xbffff3d4) at example1.cpp:283
                  

                  信息量不大.Eclipse 調(diào)試器至少讓我看到它在下面的第 3 行停止:

                  Not very informative. Eclipse debugger at least lets me see that it stops on line 3 below:

                  // Create a vertex array object
                  GLuint vao;
                  glGenVertexArrays( 1, &vao );
                  glBindVertexArray( vao );
                  

                  這是在 gl 編程中很常見的一個(gè)塊,我什至用相同的塊運(yùn)行其他代碼也沒有問題.所以我很困惑.

                  This is a very common block to see in gl programming, and I'm even running other code with the same block with no problem. So I'm baffled.

                  運(yùn)行 make 的構(gòu)建輸出:

                  Build output from running make:

                  g++ -g -DFREEGLUT_STATIC -DGLEW_STATIC -I../../include example1.cpp ../../Commo/InitShader.o  -L/usr/lib/mesa -lGLEW -lglut -lGL -lX11  -lm  -o example1
                  

                  包含問題的程序:

                  // rotating cube with two texture objects
                  // change textures with 1 and 2 keys
                  
                  #include "Angel.h"
                  
                  const int  NumTriangles = 12; // (6 faces)(2 triangles/face)
                  const int  NumVertices  = 3 * NumTriangles;
                  const int  TextureSize  = 64;
                  
                  typedef Angel::vec4 point4;
                  typedef Angel::vec4 color4;
                  
                  // Texture objects and storage for texture image
                  GLuint textures[2];
                  
                  GLubyte image[TextureSize][TextureSize][3];
                  GLubyte image2[TextureSize][TextureSize][3];
                  
                  // Vertex data arrays
                  point4  points[NumVertices];
                  color4  quad_colors[NumVertices];
                  vec2    tex_coords[NumVertices];
                  
                  // Array of rotation angles (in degrees) for each coordinate axis
                  enum { Xaxis = 0, Yaxis = 1, Zaxis = 2, NumAxes = 3 };
                  int      Axis = Xaxis;
                  GLfloat  Theta[NumAxes] = { 0.0, 0.0, 0.0 };
                  GLuint   theta;
                  
                  //----------------------------------------------------------------------------
                  int Index = 0;
                  void quad( int a, int b, int c, int d )
                  {
                      point4 vertices[8] = {
                          point4( -0.5, -0.5,  0.5, 1.0 ),
                          point4( -0.5,  0.5,  0.5, 1.0 ),
                          point4(  0.5,  0.5,  0.5, 1.0 ),
                          point4(  0.5, -0.5,  0.5, 1.0 ),
                          point4( -0.5, -0.5, -0.5, 1.0 ),
                          point4( -0.5,  0.5, -0.5, 1.0 ),
                          point4(  0.5,  0.5, -0.5, 1.0 ),
                          point4(  0.5, -0.5, -0.5, 1.0 )
                      };
                  
                      color4 colors[8] = {
                          color4( 0.0, 0.0, 0.0, 1.0 ),  // black
                          color4( 1.0, 0.0, 0.0, 1.0 ),  // red
                          color4( 1.0, 1.0, 0.0, 1.0 ),  // yellow
                          color4( 0.0, 1.0, 0.0, 1.0 ),  // green
                          color4( 0.0, 0.0, 1.0, 1.0 ),  // blue
                          color4( 1.0, 0.0, 1.0, 1.0 ),  // magenta
                          color4( 0.0, 1.0, 1.0, 1.0 ),  // white
                          color4( 1.0, 1.0, 1.0, 1.0 )   // cyan
                      };
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[a];
                      tex_coords[Index] = vec2( 0.0, 0.0 );
                      Index++;
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[b];
                      tex_coords[Index] = vec2( 0.0, 1.0 );
                      Index++;
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[c];
                      tex_coords[Index] = vec2( 1.0, 1.0 );
                      Index++;
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[a];
                      tex_coords[Index] = vec2( 0.0, 0.0 );
                      Index++;
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[c];
                      tex_coords[Index] = vec2( 1.0, 1.0 );
                      Index++;
                  
                      quad_colors[Index] = colors[a];
                      points[Index] = vertices[d];
                      tex_coords[Index] = vec2( 1.0, 0.0 );
                      Index++;
                  }
                  
                  //----------------------------------------------------------------------------
                  void colorcube()
                  {
                      quad( 1, 0, 3, 2 );
                      quad( 2, 3, 7, 6 );
                      quad( 3, 0, 4, 7 );
                      quad( 6, 5, 1, 2 );
                      quad( 4, 5, 6, 7 );
                      quad( 5, 4, 0, 1 );
                  }
                  
                  //----------------------------------------------------------------------------
                  void init()
                  {
                      colorcube();
                  
                      // Create a checkerboard pattern
                      for ( int i = 0; i < 64; i++ ) {
                          for ( int j = 0; j < 64; j++ ) {
                              GLubyte c = (((i & 0x8) == 0) ^ ((j & 0x8)  == 0)) * 255;
                              image[i][j][0]  = c;
                              image[i][j][1]  = c;
                              image[i][j][2]  = c;
                              image2[i][j][0] = c;
                              image2[i][j][1] = 0;
                              image2[i][j][2] = c;
                          }
                      }
                  
                      // Initialize texture objects
                      glGenTextures( 2, textures );
                  
                      glBindTexture( GL_TEXTURE_2D, textures[0] );
                      glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, TextureSize, TextureSize, 0,
                          GL_RGB, GL_UNSIGNED_BYTE, image );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
                  
                      glBindTexture( GL_TEXTURE_2D, textures[1] );
                      glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, TextureSize, TextureSize, 0,
                          GL_RGB, GL_UNSIGNED_BYTE, image2 );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
                      glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
                  
                      glActiveTexture( GL_TEXTURE0 );
                      glBindTexture( GL_TEXTURE_2D, textures[0] );
                  
                      // Create a vertex array object
                      GLuint vao;
                      glGenVertexArrays( 1, &vao );
                      glBindVertexArray( vao );
                  
                      // Create and initialize a buffer object
                      GLuint buffer;
                      glGenBuffers( 1, &buffer );
                      glBindBuffer( GL_ARRAY_BUFFER, buffer );
                      glBufferData( GL_ARRAY_BUFFER,
                          sizeof(points) + sizeof(quad_colors) + sizeof(tex_coords),
                          NULL, GL_STATIC_DRAW );
                  
                      // Specify an offset to keep track of where we're placing data in our
                      //   vertex array buffer.  We'll use the same technique when we
                      //   associate the offsets with vertex attribute pointers.
                      GLintptr offset = 0;
                      glBufferSubData( GL_ARRAY_BUFFER, offset, sizeof(points), points );
                      offset += sizeof(points);
                  
                      glBufferSubData( GL_ARRAY_BUFFER, offset,
                          sizeof(quad_colors), quad_colors );
                      offset += sizeof(quad_colors);
                  
                      glBufferSubData( GL_ARRAY_BUFFER, offset, sizeof(tex_coords), tex_coords );
                  
                      // Load shaders and use the resulting shader program
                      GLuint program = InitShader( "vshader71.glsl", "fshader71.glsl" );
                      glUseProgram( program );
                  
                      // set up vertex arrays
                      offset = 0;
                      GLuint vPosition = glGetAttribLocation( program, "vPosition" );
                      glEnableVertexAttribArray( vPosition );
                      glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0,
                          BUFFER_OFFSET(offset) );
                      offset += sizeof(points);
                  
                      GLuint vColor = glGetAttribLocation( program, "vColor" ); 
                      glEnableVertexAttribArray( vColor );
                      glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0,
                          BUFFER_OFFSET(offset) );
                      offset += sizeof(quad_colors);
                  
                      GLuint vTexCoord = glGetAttribLocation( program, "vTexCoord" );
                      glEnableVertexAttribArray( vTexCoord );
                      glVertexAttribPointer( vTexCoord, 2, GL_FLOAT, GL_FALSE, 0,
                          BUFFER_OFFSET(offset) );
                  
                      // Set the value of the fragment shader texture sampler variable
                      //   ("texture") to the the appropriate texture unit. In this case,
                      //   zero, for GL_TEXTURE0 which was previously set by calling
                      //   glActiveTexture().
                      glUniform1i( glGetUniformLocation(program, "texture"), 0 );
                  
                      theta = glGetUniformLocation( program, "theta" );
                  
                      glEnable( GL_DEPTH_TEST );
                  
                      glClearColor( 1.0, 1.0, 1.0, 1.0 );
                  }
                  
                  void display( void )
                  {
                      glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
                  
                      glUniform3fv( theta, 1, Theta );
                  
                      glDrawArrays( GL_TRIANGLES, 0, NumVertices );
                  
                      glutSwapBuffers();
                  }
                  
                  //----------------------------------------------------------------------------
                  void mouse( int button, int state, int x, int y )
                  {
                      if ( state == GLUT_DOWN ) {
                          switch( button ) {
                          case GLUT_LEFT_BUTTON:    Axis = Xaxis;  break;
                          case GLUT_MIDDLE_BUTTON:  Axis = Yaxis;  break;
                          case GLUT_RIGHT_BUTTON:   Axis = Zaxis;  break;
                          }
                      }
                  }
                  
                  //----------------------------------------------------------------------------
                  void idle( void )
                  {
                      Theta[Axis] += 0.01;
                  
                      if ( Theta[Axis] > 360.0 ) {
                          Theta[Axis] -= 360.0;
                      }
                  
                      glutPostRedisplay();
                  }
                  
                  //----------------------------------------------------------------------------
                  void keyboard( unsigned char key, int mousex, int mousey )
                  {
                      switch( key ) {
                      case 033: // Escape Key
                      case 'q': case 'Q':
                          exit( EXIT_SUCCESS );
                          break;
                      case '1':
                          glBindTexture( GL_TEXTURE_2D, textures[0] );
                          break;
                  
                      case '2':
                          glBindTexture( GL_TEXTURE_2D, textures[1] );
                          break;
                      }
                  
                      glutPostRedisplay();
                  }
                  
                  //----------------------------------------------------------------------------
                  int main( int argc, char **argv )
                  {
                      glutInit( &argc, argv );
                      glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
                      glutInitWindowSize( 512, 512 );
                      glutInitContextVersion( 3, 2 );
                      glutInitContextProfile( GLUT_CORE_PROFILE );
                      glutCreateWindow( "Color Cube" );
                  
                      glewInit();
                  
                      init();
                  
                      glutDisplayFunc( display );
                      glutKeyboardFunc( keyboard );
                      glutMouseFunc( mouse );
                      glutIdleFunc( idle );
                  
                      glutMainLoop();
                      return 0;
                  }
                  

                  推薦答案

                  glewExperimental = GL_TRUE; 
                  glewInit();
                  

                  應(yīng)該變魔術(shù)

                  實(shí)驗(yàn)驅(qū)動(dòng)

                  GLEW 從圖形中獲取有關(guān)支持的擴(kuò)展的信息司機(jī).但是,實(shí)驗(yàn)性或預(yù)發(fā)布的驅(qū)動(dòng)程序可能不會(huì)報(bào)告通過標(biāo)準(zhǔn)機(jī)制的每個(gè)可用擴(kuò)展,其中case GLEW 將報(bào)告它不受支持.為了規(guī)避這種情況,glewExperimental 全局開關(guān)可以通過將其設(shè)置為GL_TRUE 在調(diào)用 glewInit() 之前,確保所有擴(kuò)展將公開有效的入口點(diǎn).

                  GLEW obtains information on the supported extensions from the graphics driver. Experimental or pre-release drivers, however, might not report every available extension through the standard mechanism, in which case GLEW will report it unsupported. To circumvent this situation, the glewExperimental global switch can be turned on by setting it to GL_TRUE before calling glewInit(), which ensures that all extensions with valid entry points will be exposed.

                  這篇關(guān)于glGenVertexArrays(1, &amp;vao) 處的分段錯(cuò)誤;的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Why do two functions have the same address?(為什么兩個(gè)函數(shù)的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復(fù)制構(gòu)造的?)
                  mixing templates with polymorphism(混合模板與多態(tài)性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時(shí)候應(yīng)該使用關(guān)鍵字“typename?使用模板時(shí))
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標(biāo)準(zhǔn)庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數(shù)模板,而 clang 不能)

                    <small id='GcWd6'></small><noframes id='GcWd6'>

                      <i id='GcWd6'><tr id='GcWd6'><dt id='GcWd6'><q id='GcWd6'><span id='GcWd6'><b id='GcWd6'><form id='GcWd6'><ins id='GcWd6'></ins><ul id='GcWd6'></ul><sub id='GcWd6'></sub></form><legend id='GcWd6'></legend><bdo id='GcWd6'><pre id='GcWd6'><center id='GcWd6'></center></pre></bdo></b><th id='GcWd6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GcWd6'><tfoot id='GcWd6'></tfoot><dl id='GcWd6'><fieldset id='GcWd6'></fieldset></dl></div>
                      <tfoot id='GcWd6'></tfoot>
                        <bdo id='GcWd6'></bdo><ul id='GcWd6'></ul>

                            <tbody id='GcWd6'></tbody>

                            <legend id='GcWd6'><style id='GcWd6'><dir id='GcWd6'><q id='GcWd6'></q></dir></style></legend>
                            主站蜘蛛池模板: 精品久久一区 | 99视频在线| 国产成人在线视频 | 在线观看www高清视频 | 国产激情自拍视频 | 久久精品福利 | 伊久在线| 色资源在线视频 | 日日干日日| 免费成人高清 | 亚洲高清在线观看 | 粉色午夜视频 | 国产精品精品视频一区二区三区 | 一级欧美| a级黄色毛片免费播放视频 国产精品视频在线观看 | 99久久精品一区二区毛片吞精 | av毛片在线播放 | 天天夜碰日日摸日日澡 | 亚洲欧美激情四射 | 日韩在线一区视频 | 亚洲天天干| 黄色毛片在线观看 | 欧美二区三区 | 国产精品久久久久久久久免费高清 | 成人免费大片黄在线播放 | 亚洲一区二区久久 | 精品一级毛片 | 成人亚洲片 | 国产亚洲精品美女久久久久久久久久 | 久久久精彩视频 | 亚洲一区二区三区福利 | 成人免费在线观看视频 | 男女羞羞免费网站 | 日韩一区精品 | 日本精品视频在线观看 | 国产一区二区在线免费观看 | 天天干天天玩天天操 | 国产精品欧美一区二区三区不卡 | 日韩精品一区二区三区视频播放 | 亚洲欧洲中文 | 日韩精品在线视频 |