Results 1 to 2 of 2

Thread: How to edit a GLKTexture or another OpenGL ES texture pixel-by-pixel

  1. #1
    Join Date
    Mar 2014

    How to edit a GLKTexture or another OpenGL ES texture pixel-by-pixel

    I am trying to implement my own methods for 3D to 2D projection, and I would like to draw on a pixel-by-pixel basis using OpenGL ES. I have started this by creating a simple ViewController that loads a texture and displays it to the screen, just to see if it would work:

    And I noticed that I could change the `textureInfo` property at any point and the view would respond accordingly. This is nice, but I don't want to display an image, I want to do some behind-the-scenes math, and be able to just change the texture pixel-by-pixel. I was thinking something like this should be possible:

    Code :
        for (int i = 0; i < textureInfo.width; i++)
        	for (int j = 0; j < textureInfo.height; j++)
        		textureInfo.pixels[i][j] = GLKVector3Make(drand48(),

    But I don't see any such property of the `textureInfo`.

    My question is how do I draw pixel by pixel to a texture in OpenGL ES? Or is there a better way to do this?

  2. #2
    Senior Member
    Join Date
    May 2008
    Both GLES2/3 have a programmable graphics pipeline which include fragment shaders. Fragment shaders allow you to run a kernel that can include a large range of mathematical operations on a per-pixel bases that run on the GPU.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts