Drawings don't appear on the screen

Hi,

I try OF for Android on Ubuntu with Eclipse+ADT+SDK+NDK r9b.

I compiled OF. I opened empty example. I wrote the simple below code for 2d graphics into draw() method of the testApp.cpp.

  
  
void testApp::draw(){  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING";  
	ofBackground(255,0,0);  
	ofSetColor(255, 0, 255);  
	ofFill();  
	ofCircle(100, 100, 60);  
	ofSetColor(255, 255, 255);  
	ofDrawBitmapString("Hello World!",20,200);  
}  
  

The program thread is running well. I can see the log “TESTAPP DRAWING” looping continously on the logcat.

But I can draw nothing on the screen. Only ofBackground() commands always work wherever I put them. The drawing commands (ofCircle, ofDrawBitmapString, etc…) output nothing. I get always a blank screen (with the background colored).

What am I missing? Any hint?

I realized that there are some logs starting with “generated scanline_xxxxx” on the logcat. Then I put some extra flags into my primitive code and obtained a logcat with it. Below is my flagged code and my logcat ouput:

The code is here:

  
  
void testApp::draw(){  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 1";  
	ofBackground(255,0,0);  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 2";  
	ofSetColor(255, 0, 255);  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 3";  
	ofFill();  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 4";  
	ofCircle(100, 100, 60);  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 5";  
	ofSetColor(255, 255, 255);  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 6";  
	ofDrawBitmapString("Hello World!",20,200);  
	ofLogNotice("testApp.cpp") << "TESTAPP DRAWING 7";  
}  
  

And the logcat output:
[sup]
11-29 15:19:43.237: I/OF(836): onResume
11-29 15:19:43.237: I/testApp.cpp(836): TESTAPP RESUME
11-29 15:19:43.427: D/libEGL(836): egl.cfg not found, using default config
11-29 15:19:43.427: D/libEGL(836): loaded /system/lib/egl/libGLES_android.so
11-29 15:19:43.658: I/ofAppAndroidWindow(836): setup
11-29 15:19:43.698: I/testApp.cpp(836): TESTAPP SETUP
11-29 15:19:43.708: I/ofAppAndroidWindow(836): resize 320x430
11-29 15:19:43.758: I/testApp.cpp(836): TESTAPP WINDOW RESIZED
11-29 15:19:43.798: I/testApp.cpp(836): TESTAPP DRAWING 1
11-29 15:19:43.828: I/testApp.cpp(836): TESTAPP DRAWING 2
11-29 15:19:43.828: I/testApp.cpp(836): TESTAPP DRAWING 3
11-29 15:19:43.828: I/testApp.cpp(836): TESTAPP DRAWING 4
11-29 15:19:43.878: I/ARMAssembler(836): generated scanline__00000177:03545444_00000000_00000000 [ 61 ipp] (109 ins) at [0x4c4d51e8:0x4c4d539c] in 5829442 ns
11-29 15:19:43.878: I/testApp.cpp(836): TESTAPP DRAWING 5
11-29 15:19:43.878: I/testApp.cpp(836): TESTAPP DRAWING 6
11-29 15:19:43.918: I/testApp.cpp(836): TESTAPP DRAWING 7
11-29 15:19:43.948: I/testApp.cpp(836): TESTAPP DRAWING 1
11-29 15:19:43.948: I/testApp.cpp(836): TESTAPP DRAWING 2
11-29 15:19:43.948: I/testApp.cpp(836): TESTAPP DRAWING 3
11-29 15:19:43.948: I/testApp.cpp(836): TESTAPP DRAWING 4
11-29 15:19:43.948: I/ARMAssembler(836): generated scanline__00000177:03262644_00000000_00000000 [ 58 ipp] (95 ins) at [0x4c4d53a0:0x4c4d551c] in 1015435 ns
11-29 15:19:43.958: I/testApp.cpp(836): TESTAPP DRAWING 5
11-29 15:19:43.958: I/testApp.cpp(836): TESTAPP DRAWING 6
11-29 15:19:43.958: I/ARMAssembler(836): generated scanline__00000177:03545444_00009001_00000000 [159 ipp] (215 ins) at [0x4c4d5520:0x4c4d587c] in 2280963 ns
11-29 15:19:43.968: I/testApp.cpp(836): TESTAPP DRAWING 7
11-29 15:19:43.988: I/testApp.cpp(836): TESTAPP DRAWING 1
11-29 15:19:43.988: I/testApp.cpp(836): TESTAPP DRAWING 2
11-29 15:19:43.998: I/testApp.cpp(836): TESTAPP DRAWING 3
11-29 15:19:43.998: I/testApp.cpp(836): TESTAPP DRAWING 4
11-29 15:19:43.998: I/testApp.cpp(836): TESTAPP DRAWING 5
11-29 15:19:43.998: I/testApp.cpp(836): TESTAPP DRAWING 6
11-29 15:19:43.998: I/testApp.cpp(836): TESTAPP DRAWING 7
11-29 15:19:44.008: I/testApp.cpp(836): TESTAPP DRAWING 1
11-29 15:19:44.018: I/testApp.cpp(836): TESTAPP DRAWING 2
11-29 15:19:44.028: I/testApp.cpp(836): TESTAPP DRAWING 3
11-29 15:19:44.028: I/testApp.cpp(836): TESTAPP DRAWING 4
11-29 15:19:44.028: I/ARMAssembler(836): generated scanline__00000177:03030344_00000000_00000000 [ 35 ipp] (72 ins) at [0x4c4d5880:0x4c4d59a0] in 439088 ns
11-29 15:19:44.038: I/testApp.cpp(836): TESTAPP DRAWING 5
11-29 15:19:44.038: I/testApp.cpp(836): TESTAPP DRAWING 6
11-29 15:19:44.048: I/testApp.cpp(836): TESTAPP DRAWING 7
11-29 15:19:44.058: I/testApp.cpp(836): TESTAPP DRAWING 1
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 2
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 3
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 4
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 5
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 6
11-29 15:19:44.067: I/testApp.cpp(836): TESTAPP DRAWING 7
[/sup]

As these “generated scanline_” logs are after the flags 4 And 6 where the primitive 2d drawings should be done, I think they indicate some error. Any help?

I recompiled OF. There is any error/warning message during the compilation. Everything is ok. The problem is not the compilation. But I can not figure out what it is.

do the examples work for you? also are you using a real device or an emulator?

Hello Arturo,

Some examples work, some examples don’t work, some examples work partially. I use emulator. I tested my simple code on a real device after reading your question. It works on the device. But it doesn’t work on the emulator.

As the development phase job is done mostly on the emulator, it is a necessity for me. Do you have any idea about what i can do?

perhaps try enabling the host gpu in the emulator, i’ve tried recently with the latest version of ADT and a 4.4 emulator and it works without problem with the host gpu enabled

btw, the emulator is usually way slower than a real device

host gpu good idea thanks. I tried it, unfortunately the same errors.

Oh ok emulator 4.4 with host_gpu option works. (Emu2.3.3 the first one Ive tried, doesn’t work.)

Thank you very much.