From: Gabriel Z. <gab...@gm...> - 2009-08-13 14:09:21
|
Hi, here is my simplified directfb+mesa example which i tested on arm based board and it worked without any problems. If your directfb/mesa is compiled OK you shouldn't have any problems running it as well. Its simply just a red triangle rotating in front of white background forever.. I compiled it like this: arm-linux-g++ -I/usr/local/arm/include -I/usr/local/arm/include/directfb -L/usr/local/arm/lib -lGL -lGLU -ldirectfb -lfusion -ldirect -o test ./test.cxx the standard directfb output was this: # ./test ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.4.0 |~~~~~~~~~~~~~~~~~~~~~~~~~~ (c) 2001-2009 The world wide DirectFB Open Source Community (c) 2000-2004 Convergence (integrated media) GmbH ---------------------------------------------------------------- (*) DirectFB/Core: Multi Application Core. (2009-07-17_08:03) (*) Direct/Memcpy: Using armasm_memcpy() (*) Fusion/Init: Builtin Implementation is still experimental! Crash/Deadlocks might occur! (*) Fusion/SHM: Using MADV_REMOVE (2.6.29.0 >= 2.6.19.2) (*) Direct/Thread: Started 'Fusion Dispatch' (562) [MESSAGING OTHER/OTHER 0/0] <8388608>... (*) Direct/Thread: Started 'VT Switcher' (565) [CRITICAL OTHER/OTHER 0/0] <8388608>... (*) Direct/Thread: Started 'VT Flusher' (-1) [DEFAULT OTHER/OTHER 0/0] <8388608>... (*) DirectFB/FBDev: Found 's3c2410fb' (ID 0) with frame buffer at 0x33900000, 150k (MMIO 0x00000000, 0k) (*) DirectFB/Graphics: Generic Software Rasterizer 0.6 (directfb.org) (*) DirectFB/Core/WM: Default 0.3 (directfb.org) (*) FBDev/Mode: Setting 240x320 RGB16 (*) FBDev/Mode: Switched to 240x320 (virtual 240x320) at 16 bit (RGB16), pitch 480 (*) FBDev/Surface: Allocated 240x320 16 bit RGB16 buffer (index 0) at offset 0 and pitch 480. (*) FBDev/Mode: Setting 240x320 RGB16 (*) FBDev/Mode: Switched to 240x320 (virtual 240x320) at 16 bit (RGB16), pitch 480 (*) FBDev/Surface: Allocated 240x320 16 bit RGB16 buffer (index 0) at offset 0 and pitch 480. (*) Direct/Interface: Loaded 'Mesa' implementation of 'IDirectFBGL'. and finally the source of the test follows: test.cxx ------------------------------------------------------------------------------------------------------------------------------- /* directfb/mesa test example Written by Gabriel Zabusek <gabriel.zabusek_at_gmail.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <unistd.h> #include <GL/gl.h> #include <GL/glu.h> #include <directfb.h> #include <directfbgl.h> #include <iostream> #include <sstream> #include <string> using namespace std; IDirectFB *dfb; IDirectFBSurface *primary; IDirectFBGL *primary_gl; #define DFBCHECK(x...) \ { \ err = x; \ if (err != DFB_OK) { \ fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ DirectFBErrorFatal( #x, err ); \ } \ } static int screen_width, screen_height; void InitGL(void) { glClearColor(0.f, 0.f, 0.f, 0.f); glClearDepth(1.0); glDepthFunc(GL_LESS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_FLAT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)screen_width/(GLfloat)screen_height,0.1f,100.0f); // Calculate The Aspect Ratio Of The Window glMatrixMode(GL_MODELVIEW); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); } unsigned int angle_troj = 0; unsigned int angle_spce = 0; unsigned int angle_stvo = 0; void DrawGLScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glPushMatrix(); glTranslatef(-1.5f,0.0f,-10.0f); angle_troj+=2; angle_stvo+=4; glPushMatrix(); glRotatef(angle_troj, 0.f,1.f,0.f); // draw a triangle glBegin(GL_POLYGON); glColor3f(1.f,0.f,0.f); glVertex3f( 0.0f, 1.0f, 0.0f); glColor3f(0.f,1.f,0.f); glVertex3f( 1.0f,-1.0f, 0.0f); glColor3f(0.f,0.f,1.f); glVertex3f(-1.0f,-1.0f, 0.0f); glEnd(); glPopMatrix(); glFlush(); glPopMatrix(); } int main( int argc, char *argv[] ) { int quit = 0; DFBResult err; DFBSurfaceDescription dsc; DFBCHECK(DirectFBInit( &argc, &argv )); DFBCHECK(DirectFBCreate( &dfb )); dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN ); dsc.flags = DSDESC_CAPS; dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_DOUBLE); DFBCHECK(dfb->CreateSurface( dfb, &dsc, &primary )); DFBCHECK(primary->GetSize( primary, &screen_width, &screen_height )); DFBCHECK(primary->FillRectangle( primary, 0, 0, screen_width, screen_height )); primary->Flip( primary, NULL, (DFBSurfaceFlipFlags)0 ); DFBCHECK(primary->GetGL( primary, &primary_gl )); DFBCHECK(primary_gl->Lock( primary_gl )); //init GL InitGL(); DFBCHECK(primary_gl->Unlock( primary_gl )); while (1) { DFBCHECK(primary_gl->Lock( primary_gl )); //draw stuff DrawGLScene(); DFBCHECK(primary_gl->Unlock( primary_gl )); primary->Flip( primary, NULL, (DFBSurfaceFlipFlags)0 ); } primary_gl->Release( primary_gl ); primary->Release( primary ); dfb->Release( dfb ); return 0; } Hope this helps you solve your issue! Have a nice day, Gabriel Zabusek On Thu, Aug 13, 2009 at 2:54 PM, Christophe Khamly <wet...@gm...>wrote: > Hi, > > I compiled mesa using directfb under sh4 architechture for my Set-top-box. > The compilation was completed successfuly. But I tried to run a demo like > gears, unfortunately nothing is displaying on the screen. > The directfb layer works fine, I can blit a gif on my TV screen through > HDMI connection. > So maybe someone knows where the problem come from? > Might be caused by swapbuffers? > > Thanks for your answers > > -- > Christophe KHAMLY > > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Mesa3d-users mailing list > Mes...@li... > https://lists.sourceforge.net/lists/listinfo/mesa3d-users > > -- .............................................................................................................................................. "...the finding of new proofs for known truths is often at least as important as the discovery itself..." |