• R/O
  • HTTP
  • SSH
  • HTTPS

android: Commit

FermiSurfer for android


Commit MetaInfo

Revisionc6ba1e66409d4a1dda06d8f71a456afe47fa6d6c (tree)
Zeit2019-08-30 17:05:32
Autormitsuaki1987 <kawamitsuaki@gmai...>
Commitermitsuaki1987

Log Message

Backup

Ändern Zusammenfassung

Diff

--- a/Android1.NativeActivity/main.cpp
+++ b/Android1.NativeActivity/main.cpp
@@ -102,40 +102,70 @@ static int engine_init_display(struct engine* engine) {
102102 fclose(fp);
103103
104104 // GL の状態を初期化します。
105+ glDisable(GL_DITHER);
105106 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
106- glEnable(GL_CULL_FACE);
107+ glClearColor(1.0f, 0.41f, 0.71f, 1.0f);
108+ //glEnable(GL_CULL_FACE);
107109 glShadeModel(GL_SMOOTH);
108-
109- glClearColor(0.0, 0.0, 0.0, 0.0);
110110 glEnable(GL_DEPTH_TEST);
111+
112+ //glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
113+ //glShadeModel(GL_SMOOTH);
114+
115+ //glClearColor(0.0, 0.0, 0.0, 0.0);
116+ //glEnable(GL_DEPTH_TEST);
111117 //glDisable(GL_DEPTH_TEST);
112118 glEnable(GL_LIGHTING);
113119 glLightModelf(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
114120 glEnable(GL_LIGHT0);
115121 glEnable(GL_LIGHT1);
116122 glEnable(GL_NORMALIZE);
117- glEnableClientState(GL_VERTEX_ARRAY);
118123 glEnable(GL_COLOR_MATERIAL);
119124 glViewport(0, 0, engine->width, engine->height);
125+ GLfloat ratio = (GLfloat)engine->width/ (GLfloat)engine->height;
120126 glMatrixMode(GL_PROJECTION);
121127 glLoadIdentity();
122- glMatrixMode(GL_MODELVIEW);
128+ glFrustumf(-ratio, ratio, -1, 1, 1, 10);
129+ glEnableClientState(GL_VERTEX_ARRAY);
130+
131+ // glMatrixMode(GL_MODELVIEW);
123132 return 0;
124133 }
125134 /**
126135 * ディスプレイ内の現在のフレームのみ。
127136 */
128137 static void engine_draw_frame(struct engine* engine) {
129- int ntri = 1;
130- GLfloat clr[] = { 1.0, 0.0, 0.0, 1.0,
131- 0.0, 1.0, 0.0, 1.0,
132- 0.0, 0.0, 1.0, 1.0};
133- GLfloat kvp[] = {1.0, 0.0, 0.0,
134- 0.0, 1.0, 0.0,
135- 0.0, 0.0, 1.0 };
136- GLfloat nmlp[] = {0.0, 0.0, 1.0,
137- 0.0, 1.0, 1.0,
138- 1.0, 0.0, 1.0};
138+ int ntri = 8;
139+ GLfloat kvp[][3] = {
140+ { 1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0},
141+ { 1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, -1.0},
142+ { 1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0},
143+ { 1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0},
144+ {-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0},
145+ {-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, -1.0},
146+ {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0},
147+ {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0}
148+ };
149+ GLfloat nmlp[][3] = {
150+ { 1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0},
151+ { 1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, -1.0},
152+ { 1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0},
153+ { 1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0},
154+ {-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0},
155+ {-1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, -1.0},
156+ {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, 1.0},
157+ {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0}
158+ };
159+ GLfloat clr[][4] = {
160+ {1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}, {0.0, 0.0, 1.0, 1.0},
161+ {1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 0.0, 1.0},
162+ {1.0, 0.0, 0.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, {0.0, 0.0, 1.0, 1.0},
163+ {1.0, 0.0, 0.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0},
164+ {0.0, 1.0, 1.0, 1.0}, {0.0, 1.0, 0.0, 1.0}, {0.0, 0.0, 1.0, 1.0},
165+ {0.0, 1.0, 1.0, 1.0}, {0.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 0.0, 1.0},
166+ {0.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, {0.0, 0.0, 1.0, 1.0},
167+ {0.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0}
168+ };
139169 GLfloat pos[] = { 1.0f, 1.0f, 1.0f, 0.0f };
140170 GLfloat amb[] = { 0.2f, 0.2f, 0.2f, 0.0f };
141171
@@ -143,7 +173,7 @@ static void engine_draw_frame(struct engine* engine) {
143173 // ディスプレイがありません。
144174 return;
145175 }
146-
176+ glMatrixMode(GL_MODELVIEW);
147177 glLoadIdentity();
148178 glTranslatef(0.0, 0.0, -5.0);
149179 glLightfv(GL_LIGHT0, GL_POSITION, pos);
@@ -152,19 +182,19 @@ static void engine_draw_frame(struct engine* engine) {
152182
153183 // 色で画面を塗りつぶします。
154184 //glClearColor(((float)engine->state.x) / engine->width, 0.5, ((float)engine->state.y) / engine->height, 1);
155- glClearColor(0.5, 0.5, 0.5, 1);
185+ glClearColor(0.7, 0.7, 0.7, 1);
156186 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
157- //glEnableClientState(GL_NORMAL_ARRAY);
158- //glEnableClientState(GL_COLOR_ARRAY);
159- glColor4f(0.0, 0.0, 0.0, 1.0);
160- glNormal3f(0.0f, 0.0f, 1.0f);
187+ glEnableClientState(GL_NORMAL_ARRAY);
188+ glEnableClientState(GL_COLOR_ARRAY);
189+ glLineWidth(5.0);
190+ //glColor4f(0.0, 1.0, 0.0, 1.0);
191+ //glNormal3f(0.0f, 0.0f, 1.0f);
161192 glVertexPointer(3, GL_FLOAT, 0, kvp);
162- //glNormalPointer(GL_FLOAT, 0, nmlp);
163- //glColorPointer(4, GL_FLOAT, 0, clr);
164- //glDrawArrays(GL_TRIANGLES, 0, ntri * 3);
165- glDrawArrays(GL_LINES, 0, ntri * 2);
166- //glDisableClientState(GL_NORMAL_ARRAY);
167- //glDisableClientState(GL_COLOR_ARRAY);
193+ glNormalPointer(GL_FLOAT, 0, nmlp);
194+ glColorPointer(4, GL_FLOAT, 0, clr);
195+ glDrawArrays(GL_TRIANGLES, 0, ntri * 3);
196+ glDisableClientState(GL_NORMAL_ARRAY);
197+ glDisableClientState(GL_COLOR_ARRAY);
168198
169199 eglSwapBuffers(engine->display, engine->surface);
170200 }
--- /dev/null
+++ b/Android1.Packaging/Android1.Packaging.androidproj.user
@@ -0,0 +1,7 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
4+ <DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
5+ <AndroidDeviceID>3bc4ad4c;</AndroidDeviceID>
6+ </PropertyGroup>
7+</Project>
\ No newline at end of file
Show on old repository browser