Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
3ad2c1bd
Commit
3ad2c1bd
authored
Jun 28, 2010
by
Paul Hunkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Last test version with GLSurface
parent
904e7b45
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
7 deletions
+41
-7
app-android.c
android/testproject/jni/app-android.c
+32
-5
lesson05.c
android/testproject/jni/lesson05.c
+3
-1
TestActivity.java
android/testproject/src/org/libsdl/android/TestActivity.java
+2
-0
SDL_androidgl.c
src/video/android/SDL_androidgl.c
+4
-1
No files found.
android/testproject/jni/app-android.c
View file @
3ad2c1bd
...
@@ -56,6 +56,7 @@ void* sdlThreadProc(void* args){
...
@@ -56,6 +56,7 @@ void* sdlThreadProc(void* args){
return
NULL
;
return
NULL
;
}
}
return
(
void
*
)
SDL_main
();
return
(
void
*
)
SDL_main
();
}
}
...
@@ -143,14 +144,40 @@ void Java_org_libsdl_android_TestGLSurfaceView_nativePause( JNIEnv* env )
...
@@ -143,14 +144,40 @@ void Java_org_libsdl_android_TestGLSurfaceView_nativePause( JNIEnv* env )
Render the next frame
Render the next frame
*******************************************************************************/
*******************************************************************************/
volatile
int
frames
=
0
;
volatile
int
startSDL
=
0
;
//eglSwapBuffers(mDisplay, mDraw);
void
Java_org_libsdl_android_TestRenderer_nativeRender
(
JNIEnv
*
env
)
void
Java_org_libsdl_android_TestRenderer_nativeRender
(
JNIEnv
*
env
)
{
{
//TODO: Render here
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"JNI: BeginRender"
);
pthread_mutex_lock
(
&
mSDLRenderMutex
);
//Let the SDL thread do an entire run
pthread_cond_signal
(
&
mSDLRenderCondition
);
//wake up the SDL thread
int
lastFrames
=
frames
;
pthread_mutex_unlock
(
&
mSDLRenderMutex
)
;
startSDL
=
1
;
//__android_log_print(ANDROID_LOG_INFO, "SDL", "Unlocked");
//wait for it to finish
while
(
lastFrames
==
frames
){
;
}
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"JNI: EndRender"
);
}
}
void
sdl_render
(){
//When we get here, we've accumulated a full frame
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL: BeginRender"
);
frames
++
;
while
(
startSDL
==
0
){
;
}
startSDL
=
0
;
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL: EndRender"
);
}
android/testproject/jni/lesson05.c
View file @
3ad2c1bd
...
@@ -236,7 +236,7 @@ int drawGLScene( GLvoid )
...
@@ -236,7 +236,7 @@ int drawGLScene( GLvoid )
glViewport
(
0
,
0
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
glViewport
(
0
,
0
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
glClearColorx
(
0
,
0
,
Frames
,
255
);
glClearColorx
(
0
,
0
,
0
,
255
);
glClear
(
GL_DEPTH_BUFFER_BIT
|
GL_COLOR_BUFFER_BIT
);
glClear
(
GL_DEPTH_BUFFER_BIT
|
GL_COLOR_BUFFER_BIT
);
glMatrixMode
(
GL_PROJECTION
);
glMatrixMode
(
GL_PROJECTION
);
...
@@ -335,6 +335,8 @@ int drawGLScene( GLvoid )
...
@@ -335,6 +335,8 @@ int drawGLScene( GLvoid )
}
}
}
}
return
(
TRUE
);
return
(
TRUE
);
}
}
...
...
android/testproject/src/org/libsdl/android/TestActivity.java
View file @
3ad2c1bd
...
@@ -41,6 +41,8 @@ class TestGLSurfaceView extends GLSurfaceView {
...
@@ -41,6 +41,8 @@ class TestGLSurfaceView extends GLSurfaceView {
super
(
context
);
super
(
context
);
mRenderer
=
new
TestRenderer
();
mRenderer
=
new
TestRenderer
();
setRenderer
(
mRenderer
);
setRenderer
(
mRenderer
);
//setRenderMode(RENDERMODE_WHEN_DIRTY);
}
}
public
boolean
onTouchEvent
(
final
MotionEvent
event
)
{
public
boolean
onTouchEvent
(
final
MotionEvent
event
)
{
...
...
src/video/android/SDL_androidgl.c
View file @
3ad2c1bd
...
@@ -43,6 +43,7 @@ These things are in the JNI android support
...
@@ -43,6 +43,7 @@ These things are in the JNI android support
*/
*/
extern
pthread_mutex_t
mSDLRenderMutex
;
extern
pthread_mutex_t
mSDLRenderMutex
;
extern
pthread_cond_t
mSDLRenderCondition
;
extern
pthread_cond_t
mSDLRenderCondition
;
extern
void
sdl_render
();
/* GL functions */
/* GL functions */
int
Android_GL_LoadLibrary
(
_THIS
,
const
char
*
path
){
int
Android_GL_LoadLibrary
(
_THIS
,
const
char
*
path
){
...
@@ -89,12 +90,14 @@ int Android_GL_GetSwapInterval(_THIS){
...
@@ -89,12 +90,14 @@ int Android_GL_GetSwapInterval(_THIS){
void
Android_GL_SwapWindow
(
_THIS
,
SDL_Window
*
window
){
void
Android_GL_SwapWindow
(
_THIS
,
SDL_Window
*
window
){
/*
pthread_mutex_lock(&mSDLRenderMutex);
pthread_mutex_lock(&mSDLRenderMutex);
pthread_cond_wait(&mSDLRenderCondition, &mSDLRenderMutex);
pthread_cond_wait(&mSDLRenderCondition, &mSDLRenderMutex);
pthread_mutex_unlock(&mSDLRenderMutex);
pthread_mutex_unlock(&mSDLRenderMutex);
*/
//__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SwapWindow\n");
//__android_log_print(ANDROID_LOG_INFO, "SDL", "[STUB] GL_SwapWindow\n");
sdl_render
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment