1

So I made an app using lwjgl for the computer and was trying to make it for android however I can't find replacement for the command glVertex3f() which I use for drawing a single pixel which my app needs to do to set the color per pixel. Is there a way to do per pixel coloring in openGL ES for android, or an alternative?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Moocow9m T
  • 45
  • 7

1 Answers1

1

You could use GL_POINTS for the mode parameter of the glDraw* function. This way you could render one pixel at a time.

Reaper
  • 747
  • 1
  • 5
  • 15
  • How do you mean? How would I do color for that? – Moocow9m T Jun 11 '17 at 15:58
  • Look at the [Khronos registry](https://www.khronos.org/registry/OpenGL-Refpages/es2.0/). That is the function used for drawing in OpenGL ES. The first parameter is `mode`. – Reaper Jun 11 '17 at 16:02
  • I more mean the coloring. The project requires a slightly different color on a pixel basis. I need to go afk but I'll be back later. – Moocow9m T Jun 11 '17 at 16:05
  • Could you elaborate more on this? Do you want to have each pixel colored differently? Should it be based on the position of the pixel on the screen or on the mesh/model? – Reaper Jun 11 '17 at 16:14
  • yes. It is necessary for the correct display. A formula calculates the pixels color based on a number of things. – Moocow9m T Jun 11 '17 at 16:16
  • If you're using ES 2.x or higher than you would need to pass all the necessary data to shaders and any calculations in them. – Reaper Jun 11 '17 at 16:18
  • The calculations are changed based on a variety of things... the shaders won't be able to access them. what about OpenGL 1.0? – Moocow9m T Jun 11 '17 at 16:27
  • OpenGL ES 1 has a fixed function pipeline, not sure if you could do the per-pixel calculations there using GLES. So either pass the data to the shaders somehow or calculate the values on CPU. – Reaper Jun 11 '17 at 16:32
  • Yes the calculations are on the CPU for my other app as well. GPU processing is a future improvement if possible. So for OpenGL ES 1 what would the replacement command be? – Moocow9m T Jun 11 '17 at 16:42
  • Drawing every pixel with its own color – Moocow9m T Jun 11 '17 at 16:58
  • I think you would need to do the calculations on CPU and put them in a bitmap, then upload it as a texture and draw. – Reaper Jun 11 '17 at 17:41