Browse Source

Old main file readded.

klaute 1 year ago
parent
commit
fb9545ed39
1 changed files with 72 additions and 0 deletions
  1. 72
    0
      main.cpp

+ 72
- 0
main.cpp View File

@@ -0,0 +1,72 @@
1
+/*
2
+I am doing off-screen processing using opengl es2.0 on Android.
3
+
4
+I created a renderbuffer, and attached it to a framebuffer FBO, after rendering to the FBO, I try to get the pixels from that FBO by getReadPixels() method. But I got nothing.
5
+
6
+The code is shown below:
7
+*/
8
+
9
+// compile with LDFLAGS=-lGLEW -lglut
10
+
11
+#include <stdio.h>
12
+#include <stdlib.h>
13
+#include <string.h>
14
+#include <math.h>
15
+#include <time.h>
16
+
17
+#include "ogles_gpgpu/ogles_gpgpu.h"
18
+
19
+int main(void)
20
+{
21
+  /*
22
+
23
+  OGJNIWrapper ogWrapper = new OGJNIWrapper();
24
+
25
+  ogWrapper.init(true, false, true);
26
+
27
+  ogWrapper.setRenderDispShowMode(OGJNIWrapper.RENDER_DISP_MODE_INPUT);
28
+  ogWrapper.setRenderDispShowMode(OGJNIWrapper.RENDER_DISP_MODE_OUTPUT);
29
+  ogWrapper.setRenderDisp(width, height, OGJNIWrapper.ORIENTATION_FLIPPED);
30
+  ogWrapper.prepare(camPreviewFrameSize.width, camPreviewFrameSize.height, false);
31
+
32
+  int camTextureId = createGLTexture();
33
+  SurfaceTexture camTexture = new SurfaceTexture(camTextureId);
34
+
35
+  ogWrapper.setInputTexture(camTextureId);
36
+  ogWrapper.process();
37
+  ogWrapper.renderOutput();
38
+
39
+  imgData = ogWrapper.getOutputPixels();
40
+
41
+  if (ogWrapper != null) {
42
+    ogWrapper.cleanup();
43
+    ogWrapper = null;
44
+
45
+   */
46
+
47
+  GLuint resultFBO; // frame buffer object id
48
+  GLuint rboId;     // render buffer object id
49
+
50
+  GLuint image_width, image_height = 100;
51
+
52
+  Core core = new Core::getInstance();
53
+
54
+  core::init(GL context);
55
+
56
+  core::checkGLExtensions();
57
+
58
+  //core::setInputData(data);
59
+
60
+  // GL_RGBA || GL_NONE
61
+  //uint16_t w, h = 100;
62
+  //core::prepare(w, h, GL_NONE);
63
+
64
+  //core::getOutputData(data);
65
+
66
+  core::cleanup();
67
+  core::destroy();
68
+
69
+  return 0;
70
+
71
+}
72
+