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); #if 0 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(); #endif } } 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); #if 0 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(); #endif } }
void CSimpleCubePbuffer::AppCycle( TInt aFrame ) { glClear( GL_COLOR_BUFFER_BIT ); // Animate and draw box glLoadIdentity(); glTranslatex( 0 , 0 , -cameraDistance << 16 ); glRotatex( aFrame << 16, 1 << 16, 0 , 0 ); glRotatex( aFrame << 15, 0 , 1 << 16, 0 ); glRotatex( aFrame << 14, 0 , 0 , 1 << 16 ); DrawBox( 15.f, 15.f, 15.f ); }
void ApplyProjection(const WindowProjection &projection, const GeoPoint &reference) { fixed angle = projection.GetScreenAngle().Degrees(); fixed scale = projection.GetScale(); const RasterPoint &screen_origin = projection.GetScreenOrigin(); const GeoPoint &screen_location = projection.GetGeoLocation(); const GeoPoint projection_delta = reference - screen_location; const fixed scale_r = scale * FAISphere::REARTH; const fixed scale_x = scale_r * screen_location.latitude.fastcosine(); const fixed scale_y = -scale_r; #ifdef HAVE_GLES #ifdef FIXED_MATH GLfixed fixed_angle = angle.as_glfixed(); #else GLfixed fixed_angle = angle * (1<<16); #endif glTranslatex((int)screen_origin.x << 16, (int)screen_origin.y << 16, 0); glRotatex(fixed_angle, 0, 0, -(1<<16)); #else glTranslatef(screen_origin.x, screen_origin.y, 0.); glRotatef((GLfloat)angle, 0., 0., -1.); #endif glScalef(GLfloat(scale_x), GLfloat(scale_y), 1.); glTranslatef(GLfloat(projection_delta.longitude.Native()), GLfloat(projection_delta.latitude.Native()), 0.); }
//---------------------------------------------------------------------------- void Render() { static int rotation = 0; /* Vertex 1 Vertex 2 Vertex 3*/ GLshort vertexArray[9] = {-25,-25,0, 25,-25,0, 0,25,0 }; GLubyte colorArray[12] = {255,0,0,0, 0,255,0,0, 0,0,255,0}; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatex(0, 0, FixedFromInt(-10)); glRotatex(FixedFromInt(rotation++), 0, ONE,0); //Enable the vertices array glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_SHORT, 0, vertexArray); //3 = XYZ coordinates, GL_SHORT = data type, 0 = 0 stride bytes //Enable the vertex color array glEnableClientState(GL_COLOR_ARRAY); glColorPointer(4,GL_UNSIGNED_BYTE, 0, colorArray); //4 = RGBA format, GL_UNSIGNED_BYTE = data type,0=0 stide bytes glDrawArrays(GL_TRIANGLES, 0, 3); /*We want draw triangles, 0 = first element(vertice), 3 = number of items (vertices) to draw from the array*/ glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); eglSwapBuffers(glesDisplay, glesSurface); }
// Draws a char on screen using embedded line font, (x, y) are center of char, not upper-left corner // TODO: use SDL 1.3 renderer routines? It will not be pixel-aligned then, if the screen is resized static inline void drawCharWireframe(int idx, Uint16 x, Uint16 y, int rotation, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { glColor4x(r * 0x100, g * 0x100, b * 0x100, a * 0x100); glVertexPointer(2, GL_SHORT, 0, fontGL[idx]); glPopMatrix(); glPushMatrix(); glTranslatex( x * 0x10000, y * 0x10000, 0 ); if(rotation != 0) glRotatex( rotation, 0, 0, 0x10000 ); glDrawArrays(GL_LINES, 0, fontGL[idx][FONT_CHAR_LINES_COUNT]); }
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 */ };
int main(void) { EGLDisplay m_eglDisplay; EGLContext m_eglContext; EGLSurface m_eglSurface; EGLint attributeList[] = { EGL_RED_SIZE, 1, EGL_DEPTH_SIZE, 1, EGL_NONE }; EGLint aEGLAttributes[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_DEPTH_SIZE, 16, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, EGL_NONE }; EGLint aEGLContextAttributes[] = { EGL_CONTEXT_CLIENT_VERSION, 1, EGL_NONE }; EGLConfig m_eglConfig[1]; EGLint nConfigs; unsigned char mIndices[] = { 0, 1, 2 }; signed short mVertices[] = { -50, -29, 0, 50, -29, 0, 0, 58, 0 }; HWND hwnd; HDC hdc; MSG sMessage; int bDone = 0; // Platform init. platform(&hwnd, 640, 480); ShowWindow(hwnd, SW_SHOW); SetForegroundWindow(hwnd); SetFocus(hwnd); // EGL init. hdc = GetDC(hwnd); m_eglDisplay = eglGetDisplay(hdc); eglInitialize(m_eglDisplay, NULL, NULL); eglChooseConfig(m_eglDisplay, aEGLAttributes, m_eglConfig, 1, &nConfigs); printf("EGLConfig = %p\n", m_eglConfig[0]); m_eglSurface = eglCreateWindowSurface(m_eglDisplay, m_eglConfig[0], (NativeWindowType)hwnd, 0); m_eglContext = eglCreateContext(m_eglDisplay, m_eglConfig[0], EGL_NO_CONTEXT, aEGLContextAttributes); printf("EGLContext = %p\n", m_eglContext); eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(3, GL_SHORT, 0, mVertices); /* Set projection matrix so screen extends to (-160, -120) at bottom left * and to (160, 120) at top right, with -128..128 as Z buffer. */ glMatrixMode(GL_PROJECTION); glOrthox(-160<<16, 160<<16, -120<<16, 120<<16, -128<<16, 128<<16); glMatrixMode(GL_MODELVIEW); glClearColorx(0x10000, 0x10000, 0, 0); glColor4x(0x10000, 0, 0, 0); // Main event loop while(!bDone) { // Do Windows stuff: if(PeekMessage(&sMessage, NULL, 0, 0, PM_REMOVE)) { if(sMessage.message == WM_QUIT) { bDone = 1; } else { TranslateMessage(&sMessage); DispatchMessage(&sMessage); } } glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, mIndices); glRotatex(2<<16, 0, 0, 0x10000); eglSwapBuffers(m_eglDisplay, m_eglSurface); Sleep(30); } // Exit. eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroyContext(m_eglDisplay, m_eglContext); eglDestroySurface(m_eglDisplay, m_eglSurface); eglTerminate(m_eglDisplay); ReleaseDC(hwnd, hdc); DestroyWindow(hwnd); return 0; }
void glRotatexLogged(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { printf("glRotatex(%i, %i, %i, %i)\n", angle, x, y, z); glRotatex(angle, 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 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(); } }
/*! * \brief Render the OpenGL ES scene. * \param time Current time in milliseconds * \note Renders the OpenGL ES scene *//*-------------------------------------------------------------------*/ void renderGLESScene(unsigned int time) { int width = 0; int height = 0; #if defined(TEST_LOCKSURFACE) KDuint16 *fb = KD_NULL; int y = 0; EGLint pitch = 0; EGLint origin = 0; EGLint r, g, b; #else /* Time needed for the rotation */ const KDfloat32 effectTime = kdFmodf(time / 4000.0f, 360.0f); #endif /* Query the current window surface size from EGL */ eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_WIDTH, (EGLint *)&width); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_HEIGHT, (EGLint *)&height); #if !defined(TEST_LOCKSURFACE) /* Update the GLES state */ updateOpenGLESState (width, height); glClear (GL_COLOR_BUFFER_BIT); /* Rotate the world matrix and translate it on the z-axis */ glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glTranslatex (F2F(0.f), F2F(0.f), F2F(-30.f)); glRotatex (F2F((float)(effectTime*29.77f)), F2F(1.0f), F2F(2.0f), F2F(0.0f)); glRotatex (F2F((float)(effectTime*22.311f)), F2F(-0.1f), F2F(0.0f), -F2F(5.0f)); glBindTexture(GL_TEXTURE_2D, GLOBALS->tex); /* Set the pointer to the arrays containing the cube vertices, normals and texture coordinates */ glVertexPointer (3, GL_BYTE, 0, s_cubeVertices); glNormalPointer (GL_BYTE, 0, s_cubeNormals); glTexCoordPointer (2, GL_BYTE, 0, s_cubeTexCoords); /* Draw the cube one face at a time in the same order thay have been defined in the s_cubeVertices array */ glDrawArrays (GL_TRIANGLE_STRIP, 0, 4); glDrawArrays (GL_TRIANGLE_STRIP, 4, 4); glDrawArrays (GL_TRIANGLE_STRIP, 8, 4); glDrawArrays (GL_TRIANGLE_STRIP, 12, 4); glDrawArrays (GL_TRIANGLE_STRIP, 16, 4); glDrawArrays (GL_TRIANGLE_STRIP, 20, 4); #else /* Lock the surface and query for the properties */ eglLockSurfaceKHR(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, KD_NULL); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_POINTER_KHR, (EGLint *)&fb); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_PITCH_KHR, &pitch); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_ORIGIN_KHR, &origin); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_PIXEL_RED_OFFSET_KHR, &r); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR, &g); eglQuerySurface(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface, EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR, &b); /* Fill the surface with random noise */ for(y = 0; y < height; y++) { kdCryptoRandom((KDuint8 *)fb, width * 2); fb += pitch / 2; } eglUnlockSurfaceKHR(GLOBALS->eglDisplay, GLOBALS->eglWindowSurface); #endif /* Display the result on the screen */ eglSwapBuffers (GLOBALS->eglDisplay, GLOBALS->eglWindowSurface); }