static void drawModels(float zScale) { const int translationScale = 9; int x, y; seedRandom(9); glScalex(1 << 16, 1 << 16, (GLfixed)(zScale * 65536)); for (y = -5; y <= 5; ++y) { for (x = -5; x <= 5; ++x) { float buildingScale; GLfixed fixedScale; int curShape = randomUInt() % SUPERSHAPE_COUNT; buildingScale = sSuperShapeParams[curShape][SUPERSHAPE_PARAMS - 1]; fixedScale = (GLfixed)(buildingScale * 65536); glPushMatrix(); glTranslatex((x * translationScale) * 65536, (y * translationScale) * 65536, 0); glRotatex((GLfixed)((randomUInt() % 360) << 16), 0, 0, 1 << 16); glScalex(fixedScale, fixedScale, fixedScale); drawGLObject(sSuperShapeObjects[curShape]); glPopMatrix(); } } for (x = -2; x <= 2; ++x) { const int shipScale100 = translationScale * 500; const int offs100 = x * shipScale100 + (sTick % shipScale100); float offs = offs100 * 0.01f; GLfixed fixedOffs = (GLfixed)(offs * 65536); glPushMatrix(); glTranslatex(fixedOffs, -4 * 65536, 2 << 16); drawGLObject(sSuperShapeObjects[SUPERSHAPE_COUNT - 1]); glPopMatrix(); glPushMatrix(); glTranslatex(-4 * 65536, fixedOffs, 4 << 16); glRotatex(90 << 16, 0, 0, 1 << 16); drawGLObject(sSuperShapeObjects[SUPERSHAPE_COUNT - 1]); glPopMatrix(); } }
void CGlazeMesh::renderMesh() { glTranslatef(iPosx, iPosy, iPosz); glScalex(50 << 16, 50 << 16, 50 << 16); glBindTexture(GL_TEXTURE_2D, iIcon.iID); // target tex glTexCoordPointer(2, GL_BYTE, 0, camTex); glVertexPointer(3, GL_FLOAT, 0, targetVert); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, camFace); }
static void drawImage(GLshort* textureCoords, GLshort* vertexCoords, Texture* texture) { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture->glTexture); glMatrixMode(GL_TEXTURE); glPushMatrix(); //glLoadIdentity(); // maybe save this matrix for each texture... glScalex(texture->textureWidthInv, texture->textureHeightInv, 0x10000); glMatrixMode(GL_MODELVIEW); drawTriangleFan(textureCoords, vertexCoords); glMatrixMode(GL_TEXTURE); glPopMatrix(); glMatrixMode(GL_MODELVIEW); }
CanvasRotateShift(const RasterPoint pos, Angle angle, const int scale = 100) { #ifdef USE_GLSL glm::mat4 matrix = glm::rotate(glm::translate(glm::mat4(), glm::vec3(pos.x, pos.y, 0)), GLfloat(angle.Degrees()), glm::vec3(0, 0, 1)); float gl_scale = scale / 100.f; if (Layout::ScaleSupported()) gl_scale *= Layout::scale_1024 / 1024.f; matrix = glm::scale(matrix, glm::vec3(gl_scale)); glUniformMatrix4fv(OpenGL::solid_modelview, 1, GL_FALSE, glm::value_ptr(matrix)); #else glPushMatrix(); #ifdef HAVE_GLES glTranslatex((GLfixed)pos.x << 16, (GLfixed)pos.y << 16, 0); GLfixed fixed_angle = angle.Degrees() * (1<<16); glRotatex(fixed_angle, 0, 0, 1<<16); #else glTranslatef(pos.x, pos.y, 0.); glRotatef((GLfloat)angle.Degrees(), 0., 0., 1.); #endif #ifdef HAVE_GLES GLfixed gl_scale = ((GLfixed) scale << 16) / 100; if (Layout::ScaleSupported()) gl_scale = (gl_scale * Layout::scale_1024) >> 10; glScalex(gl_scale, gl_scale, (GLfixed)1 << 16); #else float gl_scale = scale / 100.f; if (Layout::ScaleSupported()) gl_scale *= Layout::scale_1024 / 1024.f; glScalef(gl_scale, gl_scale, 1.); #endif #endif /* USE_GLSL */ };
static void ogl_scale(MAFixed x, MAFixed y) { glScalex(x, y, 0x10000); }
void OSystem_Android::updateScreen() { //ENTER(); GLTHREADCHECK; if (!JNI::haveSurface()) return; if (_game_pbuf) { int pitch = _game_texture->width() * _game_texture->getPixelFormat().bytesPerPixel; _game_texture->updateBuffer(0, 0, _game_texture->width(), _game_texture->height(), _game_pbuf.getRawBuffer(), pitch); } if (!_force_redraw && !_game_texture->dirty() && !_overlay_texture->dirty() && !_mouse_texture->dirty()) return; _force_redraw = false; if (_frame_buffer) { _frame_buffer->detach(); glViewport(0,0, _egl_surface_width, _egl_surface_height); } // clear pointer leftovers in dead areas clearScreen(kClear); // TODO this doesnt work on those sucky drivers, do it differently // if (_show_overlay) // GLCALL(glColor4ub(0x9f, 0x9f, 0x9f, 0x9f)); if (true || _focus_rect.isEmpty()) { _game_texture->drawTextureRect(); drawVirtControls(); } else { // TODO what is this and do we have engines using it? #if 0 GLCALL(glPushMatrix()); GLCALL(glScalex(xdiv(_egl_surface_width, _focus_rect.width()), xdiv(_egl_surface_height, _focus_rect.height()), 1 << 16)); GLCALL(glTranslatex(-_focus_rect.left << 16, -_focus_rect.top << 16, 0)); GLCALL(glScalex(xdiv(_game_texture->width(), _egl_surface_width), xdiv(_game_texture->height(), _egl_surface_height), 1 << 16)); _game_texture->drawTextureRect(); GLCALL(glPopMatrix()); #endif } int cs = _mouse_targetscale; if (_show_overlay) { // TODO see above // GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff)); // ugly, but the modern theme sets a wacko factor, only god knows why cs = 1; GLCALL(_overlay_texture->drawTextureRect()); } if (_show_mouse && !_mouse_texture->isEmpty()) { const Common::Point &mouse = getEventManager()->getMousePos(); if (_show_overlay) { _mouse_texture->drawTexture(mouse.x * cs, mouse.y * cs, _mouse_texture->width(), _mouse_texture->height()); } // TODO: Port the non-overlay code as well? #if 0 if (_show_overlay) { } else { const Common::Rect &r = _game_texture->getDrawRect(); GLCALL(glTranslatex(r.left << 16, r.top << 16, 0)); GLCALL(glScalex(xdiv(r.width(), _game_texture->width()), xdiv(r.height(), _game_texture->height()), 1 << 16)); } GLCALL(glTranslatex((-_mouse_hotspot.x * cs) << 16, (-_mouse_hotspot.y * cs) << 16, 0)); #endif } if (!JNI::swapBuffers()) LOGW("swapBuffers failed: 0x%x", glGetError()); if (_frame_buffer) _frame_buffer->attach(); }
void OSystem_Android::updateScreen() { //ENTER(); GLTHREADCHECK; if (!JNI::haveSurface()) return; if (!_force_redraw && !_game_texture->dirty() && !_overlay_texture->dirty() && !_mouse_texture->dirty()) return; _force_redraw = false; // clear pointer leftovers in dead areas // also, HTC's GLES drivers are made of fail and don't preserve the buffer // ( http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html ) if ((_show_overlay || _htc_fail) && !_fullscreen) clearScreen(kClear); GLCALL(glPushMatrix()); if (_shake_offset != 0 || (!_focus_rect.isEmpty() && !Common::Rect(_game_texture->width(), _game_texture->height()).contains(_focus_rect))) { // These are the only cases where _game_texture doesn't // cover the entire screen. clearScreen(kClear); // Move everything up by _shake_offset (game) pixels GLCALL(glTranslatex(0, -_shake_offset << 16, 0)); } // TODO this doesn't work on those sucky drivers, do it differently // if (_show_overlay) // GLCALL(glColor4ub(0x9f, 0x9f, 0x9f, 0x9f)); if (_focus_rect.isEmpty()) { _game_texture->drawTextureRect(); } else { GLCALL(glPushMatrix()); GLCALL(glScalex(xdiv(_egl_surface_width, _focus_rect.width()), xdiv(_egl_surface_height, _focus_rect.height()), 1 << 16)); GLCALL(glTranslatex(-_focus_rect.left << 16, -_focus_rect.top << 16, 0)); GLCALL(glScalex(xdiv(_game_texture->width(), _egl_surface_width), xdiv(_game_texture->height(), _egl_surface_height), 1 << 16)); _game_texture->drawTextureRect(); GLCALL(glPopMatrix()); } int cs = _mouse_targetscale; if (_show_overlay) { // TODO see above // GLCALL(glColor4ub(0xff, 0xff, 0xff, 0xff)); // ugly, but the modern theme sets a wacko factor, only god knows why cs = 1; GLCALL(_overlay_texture->drawTextureRect()); } if (_show_mouse && !_mouse_texture->isEmpty()) { GLCALL(glPushMatrix()); const Common::Point &mouse = getEventManager()->getMousePos(); // Scale up ScummVM -> OpenGL (pixel) coordinates if (_show_overlay) { GLCALL(glScalex(xdiv(_egl_surface_width, _overlay_texture->width()), xdiv(_egl_surface_height, _overlay_texture->height()), 1 << 16)); } else { const Common::Rect &r = _game_texture->getDrawRect(); GLCALL(glTranslatex(r.left << 16, r.top << 16, 0)); GLCALL(glScalex(xdiv(r.width(), _game_texture->width()), xdiv(r.height(), _game_texture->height()), 1 << 16)); } GLCALL(glTranslatex((-_mouse_hotspot.x * cs) << 16, (-_mouse_hotspot.y * cs) << 16, 0)); // Note the extra half texel to position the mouse in // the middle of the x,y square: GLCALL(glTranslatex((mouse.x << 16) | 1 << 15, (mouse.y << 16) | 1 << 15, 0)); GLCALL(glScalex(cs << 16, cs << 16, 1 << 16)); _mouse_texture->drawTextureOrigin(); GLCALL(glPopMatrix()); } GLCALL(glPopMatrix()); if (!JNI::swapBuffers()) LOGW("swapBuffers failed: 0x%x", glGetError()); }
void Canvas::DrawCircle(int x, int y, unsigned radius) { #ifdef USE_GLSL OpenGL::solid_shader->Use(); #endif if (IsPenOverBrush() && pen.GetWidth() > 2) { ScopeVertexPointer vp; GLDonutVertices vertices(x, y, radius - pen.GetWidth() / 2, radius + pen.GetWidth() / 2); if (!brush.IsHollow()) { vertices.BindInnerCircle(vp); brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.CIRCLE_SIZE); } vertices.Bind(vp); pen.Bind(); glDrawArrays(GL_TRIANGLE_STRIP, 0, vertices.SIZE); pen.Unbind(); } else { GLFallbackArrayBuffer &buffer = radius < 16 ? *OpenGL::small_circle_buffer : *OpenGL::circle_buffer; const unsigned n = radius < 16 ? OpenGL::SMALL_CIRCLE_SIZE : OpenGL::CIRCLE_SIZE; const FloatPoint *const points = (const FloatPoint *)buffer.BeginRead(); const ScopeVertexPointer vp(points); #ifdef USE_GLSL glm::mat4 matrix2 = glm::scale(glm::translate(glm::mat4(), glm::vec3(x, y, 0)), glm::vec3(GLfloat(radius), GLfloat(radius), 1.)); glUniformMatrix4fv(OpenGL::solid_modelview, 1, GL_FALSE, glm::value_ptr(matrix2)); #else glPushMatrix(); #ifdef HAVE_GLES glTranslatex((GLfixed)x << 16, (GLfixed)y << 16, 0); glScalex((GLfixed)radius << 16, (GLfixed)radius << 16, (GLfixed)1 << 16); #else glTranslatef(x, y, 0.); glScalef(radius, radius, 1.); #endif #endif if (!brush.IsHollow()) { brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, n); } if (IsPenOverBrush()) { pen.Bind(); glDrawArrays(GL_LINE_LOOP, 0, n); pen.Unbind(); } #ifdef USE_GLSL glUniformMatrix4fv(OpenGL::solid_modelview, 1, GL_FALSE, glm::value_ptr(glm::mat4())); #else glPopMatrix(); #endif buffer.EndRead(); } }
void glScalexLogged(GLfixed x, GLfixed y, GLfixed z) { printf("glScalex(%i, %i, %i)\n", x, y, z); glScalex(x, y, z); }
void TopographyFileRenderer::Paint(Canvas &canvas, const WindowProjection &projection) { if (file.IsEmpty()) return; fixed map_scale = projection.GetMapScale(); if (!file.IsVisible(map_scale)) return; UpdateVisibleShapes(projection); if (visible_shapes.empty()) return; // TODO code: only draw inside screen! // this will save time with rendering pixmaps especially // we already do an outer visibility test, but may need a test // in screen coords #ifdef ENABLE_OPENGL pen.Set(); brush.Set(); #else shape_renderer.Configure(&pen, &brush); #endif // get drawing info #ifdef ENABLE_OPENGL const unsigned level = file.GetThinningLevel(map_scale); const unsigned min_distance = file.GetMinimumPointDistance(level) / Layout::Scale(1); #ifndef HAVE_GLES float opengl_matrix[16]; glGetFloatv(GL_MODELVIEW_MATRIX, opengl_matrix); #endif glPushMatrix(); fixed angle = projection.GetScreenAngle().Degrees(); fixed scale = projection.GetScale(); const RasterPoint &screen_origin = projection.GetScreenOrigin(); #ifdef HAVE_GLES #ifdef FIXED_MATH GLfixed fixed_angle = angle.as_glfixed(); GLfixed fixed_scale = scale.as_glfixed_scale(); #else GLfixed fixed_angle = angle * (1<<16); GLfixed fixed_scale = scale * (1LL<<32); #endif glTranslatex((int)screen_origin.x << 16, (int)screen_origin.y << 16, 0); glRotatex(fixed_angle, 0, 0, -(1<<16)); glScalex(fixed_scale, fixed_scale, 1<<16); #else glTranslatef(screen_origin.x, screen_origin.y, 0.); glRotatef((GLfloat)angle, 0., 0., -1.); glScalef((GLfloat)scale, (GLfloat)scale, 1.); #endif #else // !ENABLE_OPENGL const GeoClip clip(projection.GetScreenBounds().Scale(fixed(1.1))); AllocatedArray<GeoPoint> geo_points; int iskip = file.GetSkipSteps(map_scale); #endif for (auto it = visible_shapes.begin(), end = visible_shapes.end(); it != end; ++it) { const XShape &shape = **it; if (!projection.GetScreenBounds().Overlaps(shape.get_bounds())) continue; #ifdef ENABLE_OPENGL const ShapePoint *points = shape.get_points(); const ShapePoint translation = shape.shape_translation(projection.GetGeoLocation()); glPushMatrix(); #ifdef HAVE_GLES glTranslatex(translation.x, translation.y, 0); #else glTranslatef(translation.x, translation.y, 0.); #endif #else // !ENABLE_OPENGL const unsigned short *lines = shape.get_lines(); const unsigned short *end_lines = lines + shape.get_number_of_lines(); const GeoPoint *points = shape.get_points(); #endif switch (shape.get_type()) { case MS_SHAPE_NULL: break; case MS_SHAPE_POINT: #ifdef ENABLE_OPENGL #ifdef HAVE_GLES PaintPoint(canvas, projection, shape, NULL); #else PaintPoint(canvas, projection, shape, opengl_matrix); #endif #else // !ENABLE_OPENGL PaintPoint(canvas, projection, lines, end_lines, points); #endif break; case MS_SHAPE_LINE: { #ifdef ENABLE_OPENGL #ifdef HAVE_GLES glVertexPointer(2, GL_FIXED, 0, &points[0].x); #else glVertexPointer(2, GL_INT, 0, &points[0].x); #endif const GLushort *indices, *count; if (level == 0 || (indices = shape.get_indices(level, min_distance, count)) == NULL) { count = shape.get_lines(); const GLushort *end_count = count + shape.get_number_of_lines(); for (int offset = 0; count < end_count; offset += *count++) glDrawArrays(GL_LINE_STRIP, offset, *count); } else { const GLushort *end_count = count + shape.get_number_of_lines(); for (; count < end_count; indices += *count++) glDrawElements(GL_LINE_STRIP, *count, GL_UNSIGNED_SHORT, indices); } #else // !ENABLE_OPENGL for (; lines < end_lines; ++lines) { unsigned msize = *lines; shape_renderer.Begin(msize); const GeoPoint *end = points + msize - 1; for (; points < end; ++points) shape_renderer.AddPointIfDistant(projection.GeoToScreen(*points)); // make sure we always draw the last point shape_renderer.AddPoint(projection.GeoToScreen(*points)); shape_renderer.FinishPolyline(canvas); } #endif } break; case MS_SHAPE_POLYGON: #ifdef ENABLE_OPENGL { const GLushort *index_count; const GLushort *triangles = shape.get_indices(level, min_distance, index_count); #ifdef HAVE_GLES glVertexPointer(2, GL_FIXED, 0, &points[0].x); #else glVertexPointer(2, GL_INT, 0, &points[0].x); #endif glDrawElements(GL_TRIANGLE_STRIP, *index_count, GL_UNSIGNED_SHORT, triangles); } #else // !ENABLE_OPENGL for (; lines < end_lines; ++lines) { unsigned msize = *lines / iskip; /* copy all polygon points into the geo_points array and clip them, to avoid integer overflows (as RasterPoint may store only 16 bit integers on some platforms) */ geo_points.GrowDiscard(msize * 3); for (unsigned i = 0; i < msize; ++i) geo_points[i] = points[i * iskip]; msize = clip.ClipPolygon(geo_points.begin(), geo_points.begin(), msize); if (msize < 3) continue; shape_renderer.Begin(msize); for (unsigned i = 0; i < msize; ++i) { GeoPoint g = geo_points[i]; shape_renderer.AddPointIfDistant(projection.GeoToScreen(g)); } shape_renderer.FinishPolygon(canvas); } #endif break; } #ifdef ENABLE_OPENGL glPopMatrix(); #endif } #ifdef ENABLE_OPENGL glPopMatrix(); #else shape_renderer.Commit(); #endif }
void Canvas::DrawCircle(PixelScalar x, PixelScalar y, UPixelScalar radius) { if (pen_over_brush() && pen.GetWidth() > 2) { GLDonutVertices vertices(x, y, radius - pen.GetWidth() / 2, radius + pen.GetWidth() / 2); if (!brush.IsHollow()) { vertices.bind_inner_circle(); brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.CIRCLE_SIZE); } vertices.bind(); pen.Set(); glDrawArrays(GL_TRIANGLE_STRIP, 0, vertices.SIZE); } else if (OpenGL::vertex_buffer_object && radius < 16) { /* draw a "small" circle with VBO */ OpenGL::small_circle_buffer->Bind(); glVertexPointer(2, GL_SHORT, 0, NULL); glPushMatrix(); #ifdef HAVE_GLES glTranslatex((GLfixed)x << 16, (GLfixed)y << 16, 0); glScalex((GLfixed)radius << 8, (GLfixed)radius << 8, (GLfixed)1 << 16); #else glTranslatef(x, y, 0.); glScalef(radius / 256., radius / 256., 1.); #endif if (!brush.IsHollow()) { brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, OpenGL::SMALL_CIRCLE_SIZE); } if (pen_over_brush()) { pen.Bind(); glDrawArrays(GL_LINE_LOOP, 0, OpenGL::SMALL_CIRCLE_SIZE); pen.Unbind(); } glPopMatrix(); OpenGL::small_circle_buffer->Unbind(); } else if (OpenGL::vertex_buffer_object) { /* draw a "big" circle with VBO */ OpenGL::circle_buffer->Bind(); glVertexPointer(2, GL_SHORT, 0, NULL); glPushMatrix(); #ifdef HAVE_GLES glTranslatex((GLfixed)x << 16, (GLfixed)y << 16, 0); glScalex((GLfixed)radius << 6, (GLfixed)radius << 6, (GLfixed)1 << 16); #else glTranslatef(x, y, 0.); glScalef(radius / 1024., radius / 1024., 1.); #endif if (!brush.IsHollow()) { brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, OpenGL::CIRCLE_SIZE); } if (pen_over_brush()) { pen.Bind(); glDrawArrays(GL_LINE_LOOP, 0, OpenGL::CIRCLE_SIZE); pen.Unbind(); } glPopMatrix(); OpenGL::circle_buffer->Unbind(); } else { GLCircleVertices vertices(x, y, radius); vertices.bind(); if (!brush.IsHollow()) { brush.Set(); glDrawArrays(GL_TRIANGLE_FAN, 0, vertices.SIZE); } if (pen_over_brush()) { pen.Bind(); glDrawArrays(GL_LINE_LOOP, 0, vertices.SIZE); pen.Unbind(); } } }
void CLT3DEngine::DrawTangram() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); GLint width,height; width = iScreenWidth >> 1; height = iScreenHeight >> 1; glOrthof((float)-width, (float) width, (float)-height, (float) height, -1, 1); // set the same size as viewport glMatrixMode(GL_TEXTURE); glLoadIdentity(); glScalef(1.0f / 255.0f, 1.0f / 255.0f, 1.0f); glTranslatef(128.0f, 128.0f, 0.0f); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glVertexPointer(2, GL_BYTE, 0, verticesTangram); glTexCoordPointer(2, GL_BYTE, 0, nokTexCoordsTangram); /* Animate and draw box */ glColor4f(1.0f,1.0f,1.0f,1.0f); if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glRotatex(iRotate[0] << 16, 0, 0, 1 << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[0][0] << 16, 0, 0); glTranslatex(0, iTranslate[0][1] << 16, 0); // glTranslatex(0, 2<<16, 0); // glRotatex(iRotate[0] << 16, 0, 0, 1 << 16); // glTranslatex(0, -2<<16, 0); // glRotatex(0,iRotate<<16,0,0); // glRotatex(0,0,iRotate<<16,0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 1 * 3, GL_UNSIGNED_BYTE, STTtriangleBig1); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[1][0] << 16, 0, 0); glTranslatex(0, iTranslate[1][1] << 16, 0); glTranslatex(-2<<16, 0, 0); glRotatex(iRotate[1] << 16, 0, 0, 1 << 16); glTranslatex(2<<16, 0, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 1 * 3, GL_UNSIGNED_BYTE, STTtriangleBig2); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[2][0] << 16, 0, 0); glTranslatex(0, iTranslate[2][1] << 16, 0); glTranslatex(1<<16, 0, 0); glRotatex(iRotate[2] << 16, 0, 0, 1 << 16); glTranslatex(-1<<16, 0, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 1 * 3, GL_UNSIGNED_BYTE, STTtriangleSmall1); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[3][0] << 16, 0, 0); glTranslatex(0, iTranslate[3][1] << 16, 0); glTranslatex(-2<<16, -3<<16, 0); glRotatex(iRotate[3] << 16, 0, 0, 1 << 16); glTranslatex(2<<16, 3<<16, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 1 * 3, GL_UNSIGNED_BYTE, STTtriangleSmall2); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[4][0] << 16, 0, 0); glTranslatex(0, iTranslate[4][1] << 16, 0); glTranslatex(3<<16, -3<<16, 0); glRotatex(iRotate[4] << 16, 0, 0, 1 << 16); glTranslatex(-3<<16, 3<<16, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 1 * 3, GL_UNSIGNED_BYTE, STTtriangleMid); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[5][0] << 16, 0, 0); glTranslatex(0, iTranslate[5][1] << 16, 0); glTranslatex(0, -2<<16, 0); glRotatex(iRotate[5] << 16, 0, 0, 1 << 16); glTranslatex(0, 2<<16, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 2 * 3, GL_UNSIGNED_BYTE, STSquare); glPopMatrix(); } if (ETrue) { glPushMatrix(); // glTranslatex(0, 0, iCameraDistance << 16); glScalex(25 << 16, 25<<16 ,1 << 16); glTranslatex(iTranslate[6][0] << 16, 0, 0); glTranslatex(0, iTranslate[6][1] << 16, 0); glTranslatex(3<<16, 1<<16, 0); glRotatex(iRotate[6] << 16, 0, 0, 1 << 16); glTranslatex(-3<<16, -1<<16, 0); glBindTexture( GL_TEXTURE_2D, iOpenGLES.iID ); glDrawElements(GL_TRIANGLES, 2 * 3, GL_UNSIGNED_BYTE, STRect); glPopMatrix(); } }