xcode - Opengl Triangle instead of square -
im trying create spinning square inside of xcode using opengl instead reason have spinning triangle?
i'm doing inside of sio2 dont think problem.
here triangle: http://img220.imageshack.us/img220/7051/snapzproxscreensnapz001.png
here code:
void templaterender( void ) { const glfloat squarevertices[] ={ 100.0f, -100.0f, 100.0f, -100.0f, -100.0f, 100.0f, 100.0f, 100.0f, }; const unsigned char squarecolors[] = { 255, 255, 0, 255, 0, 255, 255, 255, 0, 0, 0, 0, 255, 0, 255, 255, }; glmatrixmode( gl_modelview ); glloadidentity(); glclear( gl_depth_buffer_bit | gl_color_buffer_bit ); // rendering code here... sio2windowenter2d( sio2->_sio2window, 0.0f, 1.0f ); { glvertexpointer( 2, gl_float, 0, squarevertices ); glenableclientstate(gl_vertex_array); //set color array glcolorpointer( 4, gl_unsigned_byte, 0, squarecolors ); glenableclientstate( gl_color_array ); gltranslatef( sio2->_sio2window->scl->x * 0.5f, sio2->_sio2window->scl->y * 0.5f, 0.0f ); static float rotz = 0.0f; glrotatef( rotz, 0.0f, 0.0f, 1.0f ); rotz += 90.0f * sio2->_sio2window->d_time; gldrawarrays(gl_triangle_strip, 0, 4); } sio2windowleave2d(); }
two of points same. therefore have provided 3 unique points have triangle.
the point missing -100.0f, -100.0f,
Comments
Post a Comment