diff options
-rw-r--r-- | ClientHamr/extantz/crappisspuke.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/ClientHamr/extantz/crappisspuke.cpp b/ClientHamr/extantz/crappisspuke.cpp index 15cb523..576dd2b 100644 --- a/ClientHamr/extantz/crappisspuke.cpp +++ b/ClientHamr/extantz/crappisspuke.cpp | |||
@@ -33,14 +33,67 @@ EAPI int startIrr(GLData *gld) | |||
33 | void *display = NULL; | 33 | void *display = NULL; |
34 | unsigned long sfc = 0; | 34 | unsigned long sfc = 0; |
35 | void *ctx = NULL; | 35 | void *ctx = NULL; |
36 | Evas_GL_API *gl = gld->glApi; | ||
36 | 37 | ||
37 | #if USE_DEMO | 38 | #if USE_DEMO |
38 | myDemo = new CDemo(gld, additive); | 39 | myDemo = new CDemo(gld, additive); |
39 | #endif | 40 | #endif |
40 | 41 | ||
41 | display = glXGetCurrentDisplay(); | 42 | /* Raster says - |
43 | 4. evas exposes an opengl-es2 api. any existing engine needs to be adapted to | ||
44 | use this. that's pretty much the end of that. if the engine doesn't have a | ||
45 | gles2 port.. it will need one. once it has one, then it is a simple matter of | ||
46 | replacing all the gl calls as follows: | ||
47 | |||
48 | glDrawArrays() -> api->glDrawArrays() | ||
49 | glBindBuffer() -> api->glBindBuffer() | ||
50 | |||
51 | you could make the port switchable with a macro: | ||
52 | |||
53 | #ifdef EVASGL | ||
54 | #define EG() my_evas_gl_api-> | ||
55 | #else | ||
56 | #define EG() | ||
57 | #endif | ||
58 | |||
59 | then fix up all the gl calls to be | ||
60 | |||
61 | EG()glDrawArrays() | ||
62 | EG()glBindBuffer() | ||
63 | |||
64 | etc. | ||
65 | |||
66 | doing the above allows evas to decide how to share context. it may allocate a | ||
67 | separate context or share its own. either way as far as the evasgl api user is | ||
68 | concerned.. they get their own private context to play with. if it does NOT do | ||
69 | the above (use the api exposed by evas gl) then wrapping can't context switches | ||
70 | can't work. all gl calls HAVE to go through the wrapped api to work right. this | ||
71 | is because we can't REPLACE the internals of the gl driver which otherwise | ||
72 | would be managing context and state all internally and we have zero access to | ||
73 | that - especially with closed drivers. we'd end up writing a proxy gl library | ||
74 | which conflicts with real gl symbol-wise (thus taking over and replacing | ||
75 | normal gl calls) and i know i have no interest in maintaining a separate | ||
76 | libGLwhatever.so that is an exact copy of gl and it's api's just to wrap it | ||
77 | when we expose that wrapper without symbol complications via evas gl. | ||
78 | |||
79 | 5. the engine will need to be adapted so the draw function is callable - eg by | ||
80 | elm_glview. then it's easy to switch where rendering happens. evas offers a fast | ||
81 | path to avoid buffer copies and make the gl view draw part of the evas | ||
82 | rendering path directly. this would offer almost zero overhead vs doing it | ||
83 | directly with egl/gles etc. to your backbuffer yourself, BUT gets you the bonus | ||
84 | of having your 3d view as part of a larger scenegraph. combine 2 or 3 of them | ||
85 | in a single window. overlay with evas objects or elm widgets for hud etc. all | ||
86 | for free. this also implies the engine has to integrate to the efl mainloop | ||
87 | etc. of course. | ||
88 | */ | ||
89 | |||
90 | |||
42 | sfc = ecore_evas_window_get(gld->ee); | 91 | sfc = ecore_evas_window_get(gld->ee); |
92 | // This is the way Raster wants me to do things, but these functions are not actually available. Pffft | ||
93 | // ctx = gl->glGetCurrentContext(); | ||
94 | // display = gl->glGetCurrentDisplay(); | ||
43 | ctx = glXGetCurrentContext(); | 95 | ctx = glXGetCurrentContext(); |
96 | display = glXGetCurrentDisplay(); | ||
44 | /* For using a pre existing X11 window (with optional OpenGL). */ | 97 | /* For using a pre existing X11 window (with optional OpenGL). */ |
45 | videoData = SExposedVideoData(); | 98 | videoData = SExposedVideoData(); |
46 | videoData.OpenGLLinux.X11Display = display; // void * - Connection to the X server. | 99 | videoData.OpenGLLinux.X11Display = display; // void * - Connection to the X server. |