iPhone screen artifacts when rendering widgets

Duffy

25-05-2010 18:18:55

The title is pretty much correct, after fixing the RenderSystem issue were finally back to a running application.
Unfortunately this http://yfrog.com/6giphoneartifactsp is all we see.
Were not sure were the black stuff comes from, the small green rectangle in the right bottom corner is actually the viewports background color.
The two buttons should be centered mid and top.

For now we use only the QGUI core resource zip.

Ogre log:
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DDS codec registering
FreeImage version: 3.13.1
This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
Supported formats: jpg,jif,jpeg,jpe,png,tga,targa,tif,tiff
PVRTC codec registering
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
*-*-* OGRE Initialising
*-*-* Version 1.7.1 (Cthugha)
Installing plugin: OpenGL ES 1.x RenderSystem
OpenGL ES 1.x Rendering Subsystem created.
Plugin successfully installed
Added resource location '/Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/0FB39644-B22E-463A-97ED-45D215BC3EEF/Spellbound.app/media/materials/scripts' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/0FB39644-B22E-463A-97ED-45D215BC3EEF/Spellbound.app/media/materials/textures' of type 'FileSystem' to resource group 'General'
Added resource location '/Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/0FB39644-B22E-463A-97ED-45D215BC3EEF/Spellbound.app/media/models/' of type 'FileSystem' to resource group 'General'
Creating resource group QuickGUI
Added resource location '/Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/0FB39644-B22E-463A-97ED-45D215BC3EEF/Spellbound.app/media/gui/' of type 'FileSystem' to resource group 'QuickGUI'
Added resource location '/Users/Rob/Library/Application Support/iPhone Simulator/User/Applications/0FB39644-B22E-463A-97ED-45D215BC3EEF/Spellbound.app/media/gui/qgui.core.zip' of type 'Zip' to resource group 'QuickGUI'
CPU Identifier & Features
-------------------------
* CPU ID: GenuineIntel: Intel(R) Core(TM)2 Duo CPU T9400 @ 2.53GHz
* SSE: yes
* SSE2: yes
* SSE3: yes
* MMX: yes
* MMXEXT: yes
* 3DNOW: no
* 3DNOWEXT: no
* CMOV: yes
* TSC: yes
* FPU: yes
* PRO: yes
* HT: no
-------------------------
GLESRenderSystem::_createRenderWindow "OGRE Render Window", 320x480 fullscreen miscParams: FSAA=0 displayFrequency=0 Hz orientation=Landscape Left
GL_VERSION = OpenGL ES-CM 1.1 APPLE
GL_VENDOR = Apple Computer, Inc.
GL_RENDERER = Apple Software Renderer
GL_EXTENSIONS = GL_OES_compressed_paletted_texture GL_OES_draw_texture GL_OES_mapbuffer GL_OES_matrix_palette GL_OES_point_size_array GL_OES_read_format GL_OES_stencil8 GL_OES_texture_mirrored_repeat GL_OES_point_sprite GL_OES_framebuffer_object GL_OES_blend_subtract GL_EXT_texture_lod_bias GL_EXT_texture_filter_anisotropic GL_OES_depth24 GL_OES_rgb8_rgba8 GL_IMG_read_format GL_IMG_texture_compression_pvrtc GL_IMG_texture_format_BGRA8888 GL_APPLE_texture_2D_limited_npot
EXT:GL_OES_compressed_paletted_texture
EXT:GL_OES_draw_texture
EXT:GL_OES_mapbuffer
EXT:GL_OES_matrix_palette
EXT:GL_OES_point_size_array
EXT:GL_OES_read_format
EXT:GL_OES_stencil8
EXT:GL_OES_texture_mirrored_repeat
EXT:GL_OES_point_sprite
EXT:GL_OES_framebuffer_object
EXT:GL_OES_blend_subtract
EXT:GL_EXT_texture_lod_bias
EXT:GL_EXT_texture_filter_anisotropic
EXT:GL_OES_depth24
EXT:GL_OES_rgb8_rgba8
EXT:GL_IMG_read_format
EXT:GL_IMG_texture_compression_pvrtc
EXT:GL_IMG_texture_format_BGRA8888
EXT:GL_APPLE_texture_2D_limited_npot
**************************************
*** OpenGL ES 1.x Renderer Started ***
**************************************
Registering ResourceManager for type GpuProgram
GL ES: Using GL_OES_framebuffer_object for rendering to textures (best)
FBO PF_UNKNOWN depth/stencil support:
FBO PF_R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
FBO PF_B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
FBO PF_A8R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
FBO PF_B8G8R8A8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
FBO PF_X8R8G8B8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
FBO PF_X8B8G8R8 depth/stencil support: D0S0 D0S8 D16S0 D16S8 D24S0 D24S8
[GL] : Valid FBO targets PF_UNKNOWN PF_R8G8B8 PF_B8G8R8 PF_A8R8G8B8 PF_B8G8R8A8 PF_X8R8G8B8 PF_X8B8G8R8
RenderSystem capabilities
-------------------------
RenderSystem Name: OpenGL ES 1.x Rendering Subsystem
GPU Vendor: unknown
Device Name: Apple Software Renderer
Driver Version: 0.0.0.0
* Fixed function pipeline: yes
* Hardware generation of mipmaps: yes
* Texture blending: yes
* Anisotropic texture filtering: yes
* Dot product texture operation: yes
* Cube mapping: no
* Hardware stencil buffer: no
* Hardware vertex / index buffers: yes
* Vertex programs: no
* Number of floating-point constants for vertex programs: 7996
* Number of integer constants for vertex programs: 434
* Number of boolean constants for vertex programs: 8092
* Fragment programs: no
* Number of floating-point constants for fragment programs: 8332
* Number of integer constants for fragment programs: 434
* Number of boolean constants for fragment programs: 8444
* Geometry programs: no
* Number of floating-point constants for geometry programs: 434
* Number of integer constants for geometry programs: 8204
* Number of boolean constants for geometry programs: 434
* Supported Shader Profiles:
* Texture Compression: yes
- DXT: no
- VTC: no
- PVRTC: yes
* Scissor Rectangle: yes
* Hardware Occlusion Query: yes
* User clip planes: yes
* VET_UBYTE4 vertex element type: yes
* Infinite far plane projection: yes
* Hardware render-to-texture: yes
* Floating point textures: no
* Non-power-of-two textures: no
* Volume textures: no
* Multiple Render Targets: 1
- With different bit depths: no
* Point Sprites: yes
* Extended point parameters: yes
* Max Point Size: 511
* Vertex texture fetch: no
* Number of world matrices: 0
* Number of texture units: 8
* Stencil buffer depth: 0
* Number of vertex blend matrices: 0
* Render to Vertex Buffer : no
* GL 1.5 without VBO workaround: no
* Frame Buffer objects: yes
* Frame Buffer objects (ARB extension): no
* Frame Buffer objects (ATI extension): no
* PBuffer support: no
* GL 1.5 without HW-occlusion workaround: no
Registering ResourceManager for type Texture
DefaultWorkQueue('Root') initialising on thread main.
Particle Renderer Type 'billboard' registered
Initialising resource group QuickGUI
Parsing scripts for resource group QuickGUI
Parsing script qgui.skinTypes
Parsing script micross.fontdef
Finished parsing scripts for resource group QuickGUI
[QGUI] Loading SkinClass and SkinType definitions...
[QGUI] Skin definition for class "Button" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.close" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.comboboxdropdown" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.hscrollleft" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.hscrollright" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.hslider" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.treeviewnode.expand" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.treeviewnode.minimize" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.vscrolldown" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.vscrollup" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Button" with ID "default.vslider" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "CheckBox" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "CheckBox" with ID "default.treeviewcheckboxnode" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "ColorPicker" with ID "default" found.
[QGUI] Skin definition for class "ComboBox" with ID "default" found.
[QGUI] Skin definition for class "Console" with ID "default" found.
[QGUI] Skin definition for class "ContextMenu" with ID "default" found.
[QGUI] Skin definition for class "HScrollBar" with ID "default" found.
[QGUI] Skin definition for class "Image" with ID "ColorPallette" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Image" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Label" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "List" with ID "default" found.
[QGUI] Skin definition for class "ListImageItem" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "ListTextItem" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Menu" with ID "default" found.
[QGUI] Skin definition for class "MenuImageItem" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MenuPanel" with ID "default" found.
[QGUI] Skin definition for class "MenuPanel" with ID "default.dropdownlist" found.
[QGUI] Skin definition for class "MenuTextItem" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "ModalWindow" with ID "default" found.
[QGUI] Skin definition for class "MouseCursor" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "diag1resize" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "diag2resize" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "grabable" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "grabbed" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "hresize" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "MouseCursor" with ID "vresize" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Panel" with ID "default" found.
[QGUI] Skin definition for class "Panel" with ID "editor.tabpage.area" found.
[QGUI] Skin definition for class "ProgressBar" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "PropertyGrid" with ID "QuickGUIEditor" found.
[QGUI] Skin definition for class "PropertyGrid" with ID "default" found.
[QGUI] Skin definition for class "PropertyGridBoolProperty" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "PropertyGridComboBoxProperty" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "PropertyGridSection" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "PropertyGridTextProperty" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "RadioButton" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "RadioButton" with ID "default.treeviewradiobuttonnode" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "Sheet" with ID "default" found.
[QGUI] Skin definition for class "Tab" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TabControl" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TabControl" with ID "editor" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TabPage" with ID "default" found.
No definitions for type "SkinElement" found!
[QGUI] Skin definition for class "TabPage" with ID "editor" found.
No definitions for type "SkinElement" found!
[QGUI] Skin definition for class "TextArea" with ID "default" found.
[QGUI] Skin definition for class "TextBox" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TextCursor" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TextCursor" with ID "test1" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TextCursor" with ID "test2" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TitleBar" with ID "default" found.
[QGUI] Skin definition for class "ToolBar" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TreeView" with ID "default" found.
[QGUI] Skin definition for class "TreeViewCheckBoxNode" with ID "default" found.
[QGUI] Skin definition for class "TreeViewNode" with ID "default" found.
No definitions for type "SkinReference" found!
[QGUI] Skin definition for class "TreeViewRadioButtonNode" with ID "default" found.
[QGUI] Skin definition for class "VScrollBar" with ID "default" found.
[QGUI] Skin definition for class "Window" with ID "default" found.
Font micross.10using texture size 256x256
Info: Freetype returned null for character 160 in font micross.10
Texture: micross.10Texture: Loading 1 faces(PF_BYTE_LA,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,256x256x1.
Font micross.12using texture size 256x256
Info: Freetype returned null for character 160 in font micross.12
Texture: micross.12Texture: Loading 1 faces(PF_BYTE_LA,256x256x1) with hardware generated mipmaps from Image. Internal format is PF_BYTE_LA,256x256x1.


The code is pretty strait forward as well.

void LobbyGameState::createPlayButton(void)
{
QuickGUI::Sheet& sheet = getCurrentGUISheet();

QuickGUI::ButtonDesc* descriptor = QuickGUI::DescManager::getSingleton().getDefaultButtonDesc();

descriptor->widget_name = "PlayButton";
descriptor->widget_dimensions.size = QuickGUI::Size(100, 25);

QuickGUI::TextSegment tdesc = QuickGUI::TextSegment("micross.12", QuickGUI::ColourValue::Black, "Play");
descriptor->textDesc.segments.push_back(tdesc);

_playButton = sheet.createButton(descriptor);
_playButton->setHorizontalAnchor(QuickGUI::ANCHOR_HORIZONTAL_CENTER);
_playButton->setVerticalAnchor(QuickGUI::ANCHOR_VERTICAL_CENTER);
_playButton->addWidgetEventHandler(QuickGUI::WIDGET_EVENT_MOUSE_CLICK, &LobbyGameState::onPlayButtonTapped, this);
}

Duffy

25-05-2010 20:55:38

We made progress on the issue.
It seems there are no "real" artifacts, but our scene gets distorted, the small green area at the bottom right is actually our complete viewport.
We noticed as we started rendering our two test penguins into the scene.

You can see the scene here.
http://yfrog.com/1giphonesmallp

The distortion occurs after the following method call ( createGUISheet ).
We're still trying to figure out if we screwed up somewhere, but as mentioned in previous posts the same code with QuickGUI works like a charm on windows.

Any help is greately appreciated.


void Spellbound::GUIGameState::createGUISheet(void)
{
QuickGUI::SheetDesc* sd = QuickGUI::DescManager::getSingleton().getDefaultSheetDesc();
sd->resetToDefault();
sd->widget_dimensions.size = QuickGUI::Size(480, 320);
_sheet = QuickGUI::SheetManager::getSingleton().createSheet(sd);
activateGUI();
}

void GUIGameState::stop(void)
{
deactivateGUI();
}

void GUIGameState::pause(void)
{
GameState::pause();
deactivateGUI();
}

void GUIGameState::resume(void)
{
GameState::resume();
activateGUI();
}

void GUIGameState::activateGUI(void)
{
QuickGUI::GUIManager& guiManager = Singleton<Game>::getInstance().getGUIManager();
guiManager.setSceneManager(_scene);
guiManager.setViewport(_viewport);
guiManager.setActiveSheet(_sheet);
}

kungfoomasta

26-05-2010 00:10:50

Hm, well it seems the (first?) problem lies with the viewport being the wrong dimensions. What code are you writing to set that up? I would try playing around with various values and see if that gives any different results.

Duffy

27-05-2010 17:34:48

hi kungfoo,

after some downtime I screwed around with the viewport and it size remains constant before and after QuickGUI initialization.

First the code for our window viewport and camera.

- Renderwindow

_renderWindow = root.initialise(true);


- Scenemanager & Viewport & Scenemanagement

void GameState::prestart(void)
{
Ogre::Root& root = Ogre::Root::getSingleton();
Ogre::RenderWindow& window = Singleton<Game>::getInstance().getRenderWindow();

_scene = root.createSceneManager(Ogre::ST_GENERIC, _name);
_scene->setAmbientLight(Ogre::ColourValue(1, 1, 1));

_camera = _scene->createCamera("LocalStateCamera");
_viewport = window.addViewport(_camera);

setupCamera(*_camera);
setupViewport(*_viewport);
}
void GameState::setupCamera(Ogre::Camera& camera)
{
camera.setPosition(Ogre::Vector3(100, 100, 100));
camera.lookAt(Ogre::Vector3(0, 0, 0));
camera.setNearClipDistance(1);
camera.setFarClipDistance(1000);

Ogre::Real width = (Ogre::Real) _viewport->getActualWidth();
Ogre::Real height = (Ogre::Real) _viewport->getActualHeight();

camera.setAspectRatio(width / height);
}

void GameState::setupViewport(Ogre::Viewport& viewport)
{
viewport.setBackgroundColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
}


So its not the Viewport that is screwed up :(
I noticed something weird, it seems after QuickGUI gets initialized the actual size of the viewport doesnt change since I can still inject input on the whole screen not just the bottom left corner and the game reacts, any suggestions were to look next ?

*EDIT*
We narrowed the problem down even further, this call blackens the screen completely.
After this call nothing gets rendered anymore.
guiManager.setSceneManager(_scene);

This call lets the distorted viewport appear in the lower right corner.
guiManager.setViewport(_viewport);

kungfoomasta

28-05-2010 18:47:26

So you're saying without QuickGUI, the viewport is the full size of the window?

This is the setViewport function:


void GUIManager::setViewport(Ogre::Viewport* vp)
{
mGUIManagerDesc.viewport = vp;

if(vp == NULL)
{
mViewportWidth = 0;
mViewportHeight = 0;
}
else
{
mViewportWidth = vp->getActualWidth();
mViewportHeight = vp->getActualHeight();
}
}


This function itself doesn't do anything except let QuickGUI know which viewport to render the UI to. However I wonder if the RenderSystem configuration is somehow not compatible with GLES.

Does anything change if you comment out this one line?

void GUIManager::renderQueueEnded(Ogre::uint8 id, const std::string& invocation, bool& repeatThisQueue)
{
// Perform rendering of GUI
if(mGUIManagerDesc.queueID == id)
{
// draw();
}
}


And again, it would be helpful to know how the viewport behaves when no GUIManager is created at all.

Duffy

28-05-2010 21:18:48

Yes, strangely it is.

I tried modifying the viewport size, but the distortion seems unaffected, its always rendered at the bottom only with different aspect ratios depending what size was used.
Ill see what I can do, I'm pretty sure its some weird GL ES behaviour.
Unfortunately I have neither time nor the necessary perspective to be able to debug it on my own :(
Ill try cutting out the draw method and report back.

Theres also another issue that has arisen.
I'm not even sure if I should spit out all these problems into the forum, since our doing can be classified as highly experimental, but I suppose someone will do it eventually.
Theres some weird EXC_BAD_INSTRUCTION / EXC_BAD_ACCESS runtime exception in some hp string class used by the scriptreader when compiled for the arm6/arm7 architecture.
This error does only occur on the iPhone itself not in the simulator, but thats something for another thread.

About the behaviour, well everything works as supposed until the setScene.. setView... methods are getting called.
The creation of the GUIManager alone has no ill effect on the rendering scene.

It's clear that the setViewport method itself is not at fault here, neither is the setScene.. or setActiveSheet method.
I'm pretty sure theres some hickup inside the renderqueue, which perhaps again could be due to a faulty render system implementation or perhaps there are some guidelines that GL ES has, that need enforcing.

P.S. Remember the last post about the setTexture glitch ? I checked the input strings and noticed that it only crashed with invalid resource names, which of course means that theres somewhere an invalid texture pointer inside the QuickGUI startup.

I'll get back 2 u.