objective c - Drawing individual pixels with iphone sdk -


I want to know how to play powder toy style on iPhone. My problem is how to draw the pixels on the screen. What I have read, is better for OpenGL games because it is fast / hardware fast, but there is no way to draw pixels directly on the screen. Apparently there is a way to pull pixel in the off-screen frame buffer, but how can I pass it to OpenGL? Do I use texture?

(It's assuming I do not have any previous knowledge of iPhone graphics programming).

Thank you!

Usually in OpenGL, you attract archaic and polygons if you want to draw a bitmap You have to apply texture to your polygon.

See the Cocos 2D-iPhone engine for 2G games based on OpenGL.

If you still need to draw a pixel, this is a method of cocos2d to attract the line:

  zero ccDrawLine (CGPInt origin, CGPoint destination) { CGPoint shorts [2]; Corners [0] = original; Corner [1] = destination; // Default GL states: GL_Vertcher DD, GL_Votex_ARRA, GL_ORARAAA, GL_AQUIRE_COVERORD_ARRA // REQUIRED STATE: GL_VERTEX_ARRA, // UNAUTHORIZED STATE: GL_WARTHIRDDD, GL_VATURE_COVERORD_ARRA, GL_ONRARA Glodiejbal (GL_VirtataDedDDD); GlDisableClientState (GL_TEXTURE_COORD_ARRAY); GlDisableClientState (GL_COLOR_ARRAY); GlVertexPointer (2, GL_FLOAT, 0, meridian); GlDrawArrays (GL_LINES, 0, 2); // Restore the default state glEnableClientState (GL_COLOR_ARRAY); GlEnableClientState (GL_TEXTURE_COORD_ARRAY); GlEnable (GL_TEXTURE_2D); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -