3

Im a beginner on iphone OS development.

I followed jeff's tutorial here about hud display in iphone OS http://iphonedevelopment.blogspot.com/2010/02/drawing-hud-display-in-opengl-es.html The sample works on the accompanying project with the isocahedron as the background of the HUD and the is working as expected with colors and the text.

But when I copied the code into my modified project with the textured objects from one of his tutorial series on this one http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-part-6_25.html, I see that the HUD display has no colors no matter how I change the color settings.

I trial and error of disabling and enabling the client states and the GL Modes with no luck. Anyone who had analyzed the situation, has experienced such, has find out what's needed to change in the code, please let me know

ivanceras
  • 1,415
  • 3
  • 17
  • 28
  • Are you enabling lighting, glEnable(GL_LIGHTING)? Try disable during drawing of HUD – epatel Apr 21 '10 at 07:59
  • Hi epatel, yep, GL_LIGHTING is enabled, but when I try to disable it in Ortho, the application just exit without any error, then I do a couple of experiments so it won't just exit, but still the color of the HUD is always black. BTW, I have lights enables "GL_LIGHTING" and "GL_LIGHT0" enabled/disabled both on frustum and ortho respectively. What else do you suggest? BTW, the setup view also uses functions like "glLightfv", do you think it could be a factor as well? – ivanceras Apr 21 '10 at 08:15
  • Exiting?! Sounds strange...but another thing. I think you also should do glDisable(GL_TEXTURE_2D) before drawing the HUD. – epatel Apr 21 '10 at 08:56
  • yeah, exiting, the debugger just stop. Definitely disabling GL_TEXTURE_2D works in drawing the primitive shapes(3 squares in these case) and will have to enable GL_TEXTURE_2D again before writing the text. At first I get the color working, but the side effect is the 3D object is darkened so I can't see anything except the HUD. The solution was to set the lighting ambience, diffusion and the light position etc, on the switching back to the Frustum view. Thanks epatel you have helped me here, and solved the issue. Cheers :) – ivanceras Apr 21 '10 at 10:42

1 Answers1

2

Check that you disable GL_LIGHTING and GL_TEXTURE_2D before you draw the HUD.

epatel
  • 45,805
  • 17
  • 110
  • 144