Skip to main content

Posts

Showing posts with the label opengl-es

Learning OpenGL ES 1.x

What is the quickest way to come up to speed on OpenGL ES 1.x? Let's assume I know nothing about OpenGL (which is not entirely true, but it's been a while since I last used OpenGL). I am most interested in learning this for iPhone-related development, but I'm interested in learning how it works on other platforms as well. I've found the book OpenGL ES 2.0 Programming Guide , but I am concerned that it might not be the best approach because it focuses on 2.0 rather than 1.x. My understanding is that 2.0 is not backwards-compatible with 1.x, so I may miss out on some important concepts. Note: For answers about learning general OpenGL, see http://stackoverflow.com/questions/62540/learning-opengl Some resources I've found: http://khronos.org/opengles/1_X/ http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES1xMBX.asp OpenGL Distilled by Paul Martz (a good refresher on OpenGL basics)

Is it possible to switch focus from one GLKview to another without reloading everything?

I am making an opengl 2.0 based game for iPad where I have added support for external displays. I want the game to be able to hot-swap between the local display and the external display. The issue I am experiencing is that as soon as I get a DrawInRect call to a newly created GLKview, belonging to a newly attached display, it seems all the shader programs and textures I set up in the old GLKview are no longer valid for the new GLKview. Will I need to recompile the shaders and reload all textures for new GLKview's? Or is there a better way to do it? I would really like to avoid having the game pause for 5-10 seconds while loading textures to the new display, especially since they are in fact already loaded and should be available somehow? Is there a way to transfer/share these data?

iPhone opengl es: Touch detection

I have been messing around with opengl es on the iphone and right now I have some cubes on the screen. Currently I am trying to detect touches on these cubes. After a lot of searching on google this is what I have so far Use gluUnProject to find the x,y cordinates on the near plane in the world cordinate system Use gluUnProject to find the x,y cordinates on the far plane in the world cordinate system Subtract the vector obtained in 2 from the vector obtained in 1 to obtain the direction vector Normalize the direction vector to obtain the unit vector Iterate through all the trianlges and use the ray-triangle intersection to check if the ray intersects this triangle I think my mistake is in step 5. I have a feeling I am supposed to transform my triangles by the modelview matrix? Is my assumption correct? If yes any clues how to transform a triangle (an array of 3 floats) by the modelview matrix (an array of 16 floats)

Accurately Converting NSString to GLFloat - iPhone

Say I have some vertice values which I am reading into my app as a NSString : -7501.6 -6198.2 834.939 -5547.66 -6348.32 2122.65 The values in the source are always 6 figures in length. I need to pass these exact values to OpenGL. If I try to cast as a float (using NSString floatValue) then, as expected, I get an approximate value for each float due to the inexact nature of a float : -7501.600098, -6198.200195, 834.939026 -5547.660156, -6348.319824, 2122.649902 Can anyone suggest a way that I can get these values into OpenGL and retain their exact initial integrity ? Thank you.

Is there any alternative for GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT)?

I get a fill rate of about 30fps in my application. I know that GLES20.glClear() is used to clear the screen for every draw. If i comment it i get a fps of about 60fps. But the output is not as expected. I have a content to be redrawn for the whole screen in every frame. Is there any alternative where i can redraw the whole screen with out using the GLES20.glClear(). Please let me know if there is any way to play around with GLES20.glClear() to improve the performance?