57 // releaseGraphicsTarget). |
57 // releaseGraphicsTarget). |
58 const GLubyte *info; |
58 const GLubyte *info; |
59 info = glGetString(GL_RENDERER); // get the renderer string |
59 info = glGetString(GL_RENDERER); // get the renderer string |
60 |
60 |
61 // check if "MBX" substring is found |
61 // check if "MBX" substring is found |
62 if (strstr((const char *)info, "MBX")) |
62 if ( !info || strstr((const char *)info, "MBX")) |
63 { |
63 { |
64 // HW renderer detected. |
64 // HW renderer detected. |
65 // If "MBX" HW is detected we must reset alpha for mutable off-screen |
65 // If "MBX" HW is detected we must reset alpha for mutable off-screen |
66 // images by hand (see releaseGraphicsTarget). |
66 // images by hand (see releaseGraphicsTarget). |
67 isProperRenderer = false; |
67 isProperRenderer = false; |
91 { |
91 { |
92 M3GRenderContext ctx = (M3GRenderContext)aCtx; |
92 M3GRenderContext ctx = (M3GRenderContext)aCtx; |
93 |
93 |
94 // Fetch the native peer of our target object |
94 // Fetch the native peer of our target object |
95 Java::GFX::WindowSurface* wsurf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle); |
95 Java::GFX::WindowSurface* wsurf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle); |
96 |
96 |
97 int caps = Java::GFX::SwImage | Java::GFX::PBuffer; |
97 wsurf->bind(Java::GFX::WsTypeQtImage | Java::GFX::WsTypeEglSurface); |
98 QPaintDevice* surface = wsurf->bind(caps); |
|
99 |
|
100 jboolean isImageTarget = false; /*cmidGraphics->IsImageTarget();*/ |
98 jboolean isImageTarget = false; /*cmidGraphics->IsImageTarget();*/ |
101 |
99 |
102 M3G_DO_LOCK |
100 M3G_DO_LOCK |
103 |
101 |
104 /* |
102 /* |
118 M3G_COLOR_BUFFER_BIT) && m3gSetRenderHints((M3GRenderContext)aCtx, aHintBits)) |
116 M3G_COLOR_BUFFER_BIT) && m3gSetRenderHints((M3GRenderContext)aCtx, aHintBits)) |
119 { |
117 { |
120 |
118 |
121 switch (wsurf->getType()) |
119 switch (wsurf->getType()) |
122 { |
120 { |
123 case Java::GFX::SwImage: |
121 case Java::GFX::WsTypeQtImage: |
124 { |
122 { |
125 QImage* bitmap = static_cast<QImage*>(surface); |
123 QImage* bitmap = wsurf->getQtImage(); |
126 M3GPixelFormat format = mapQtPixelformat(bitmap->format()); |
124 M3GPixelFormat format = mapQtPixelformat(bitmap->format()); |
127 m3gBindMemoryTarget((M3GRenderContext)aCtx, bitmap->bits(), (M3Guint)bitmap->width(), (M3Guint)bitmap->height(), format, (M3Guint)(bitmap->width() * 4), NULL); |
125 m3gBindMemoryTarget((M3GRenderContext)aCtx, bitmap->bits(), (M3Guint)bitmap->width(), (M3Guint)bitmap->height(), format, (M3Guint)(bitmap->width() * 4), NULL); |
|
126 break; |
|
127 } |
|
128 case Java::GFX::WsTypeEglSurface: |
|
129 { |
|
130 if( eglQueryAPI() != EGL_OPENGL_ES_API ) |
|
131 { |
|
132 eglMakeCurrent( EGL_DEFAULT_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); |
|
133 eglBindAPI( EGL_OPENGL_ES_API ); |
|
134 } |
|
135 m3gBindEGLSurfaceTarget((M3GRenderContext)aCtx, wsurf->getEglSurface() ); |
128 break; |
136 break; |
129 } |
137 } |
130 default: |
138 default: |
131 M3G_RAISE_EXCEPTION(aEnv, "java/lang/IllegalArgumentException"); |
139 M3G_RAISE_EXCEPTION(aEnv, "java/lang/IllegalArgumentException"); |
132 break; |
140 break; |
210 } |
218 } |
211 } |
219 } |
212 */ |
220 */ |
213 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Graphics3D__1releaseGraphics |
221 JNIEXPORT void JNICALL Java_javax_microedition_m3g_Graphics3D__1releaseGraphics |
214 (JNIEnv* aEnv, jclass, jint aHandle, |
222 (JNIEnv* aEnv, jclass, jint aHandle, |
215 jint aSurfaceHandle, jboolean aIsImageTarget, jboolean aIsProperRenderer) |
223 jint aSurfaceHandle, jboolean /*aIsImageTarget*/, jboolean /*aIsProperRenderer*/) |
216 { |
224 { |
217 M3G_DO_LOCK |
225 M3G_DO_LOCK |
218 |
226 |
219 releaseTarget((M3GRenderContext)aHandle); |
227 releaseTarget((M3GRenderContext)aHandle); |
220 |
228 |
221 // Release used target surface |
229 // Release used target surface |
222 Java::GFX::WindowSurface* surf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle); |
230 Java::GFX::WindowSurface* surf = reinterpret_cast<Java::GFX::WindowSurface*>(aSurfaceHandle); |
223 surf->release(); |
231 surf->release(); |
224 |
232 |
225 /* |
233 /* |
226 CMIDGraphics *cmidGraphics = MIDUnhandObject<CMIDGraphics>(aGraphicsHandle); |
234 CMIDGraphics *cmidGraphics = MIDUnhandObject<CMIDGraphics>(aGraphicsHandle); |
227 |
235 |
228 CJavaM3GEventSource* eventSource = |
236 CJavaM3GEventSource* eventSource = |
229 JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle); |
237 JavaUnhand<CJavaM3GEventSource>(aEventSourceHandle); |
713 |
721 |
714 return (jint)viewport[3]; |
722 return (jint)viewport[3]; |
715 } |
723 } |
716 |
724 |
717 JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Graphics3D__1isAASupported |
725 JNIEXPORT jboolean JNICALL Java_javax_microedition_m3g_Graphics3D__1isAASupported |
718 (JNIEnv* aEnv, jclass, jint aM3g) |
726 (JNIEnv* /*aEnv*/, jclass, jint aM3g) |
719 { |
727 { |
720 M3Gbool aaSupport = M3G_FALSE; |
728 M3Gbool aaSupport = M3G_FALSE; |
721 |
729 |
722 aaSupport = m3gIsAntialiasingSupported((M3GInterface)aM3g); |
730 aaSupport = m3gIsAntialiasingSupported((M3GInterface)aM3g); |
723 |
731 |