This commit is contained in:
Caspian Rychlik-Prince 2003-03-28 21:04:43 +00:00
parent 24160ac606
commit 16d8c3c053
5 changed files with 18 additions and 33 deletions

View File

@ -131,13 +131,14 @@ public class BaseGL extends Window {
}
protected void doCreate() throws Exception {
nCreate(x, y, getWidth(), getHeight(), color, alpha, depth, stencil, fullscreen);
nCreate(getTitle(), x, y, getWidth(), getHeight(), color, alpha, depth, stencil, fullscreen);
}
/**
* Native method to create a windowed GL
*/
private native void nCreate(
String title,
int x,
int y,
int width,

View File

@ -1669,8 +1669,10 @@ public class GL extends CoreGL implements GLConstants {
final String exts;
if (WGL_ARB_extensions_string)
exts = wglGetExtensionsStringARB(Display.getHandle());
// Remember - this is an HWND not an HDC, which is what's required
exts = wglGetExtensionsStringARB(getHandle());
// Remember - this is an HWND not an HDC, which is what's required. The native
// code on the other side of wglGetExtensionsStringARB gets the HDC from the HWND
// behind the scenes.
else
exts = wglGetExtensionsStringEXT();

View File

@ -11,10 +11,10 @@ extern "C" {
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nCreate
* Signature: (IIIIIIIIZ)V
* Signature: (Ljava/lang/String;IIIIIIIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
(JNIEnv *, jobject, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
(JNIEnv *, jobject, jstring, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
/*
* Class: org_lwjgl_opengl_BaseGL

View File

@ -49,7 +49,7 @@ HDC hdc = NULL; // Device context
LPDIRECTINPUT lpdi = NULL; // DirectInput
bool isFullScreen = false; // Whether we're fullscreen or not
bool isMinimized = false; // Whether we're minimized or not
JNIEnv * environment; // Cached environment
JNIEnv * environment = NULL; // Cached environment
jobject window; // Cached Java Window instance handle
extern HINSTANCE dll_handle; // Handle to the LWJGL dll
@ -106,7 +106,7 @@ void closeWindow()
}
// Release device context
if (hdc != NULL) {
if (hdc != NULL && hwnd != NULL) {
ReleaseDC(hwnd, hdc);
}
@ -143,6 +143,10 @@ LRESULT CALLBACK lwjglWindowProc(HWND hWnd,
WPARAM wParam,
LPARAM lParam)
{
if (environment == NULL) {
printf("No environment!\n");
return DefWindowProc(hWnd, msg, wParam, lParam);
}
switch (msg) {
// disable screen saver and monitor power down messages which wreak havoc
@ -289,6 +293,10 @@ bool createWindow(const char * title, int x, int y, int width, int height, bool
return false;
}
#ifdef _DEBUG
printf("Created window\n");
#endif
ShowWindow(hwnd, SW_SHOWNORMAL);
UpdateWindow(hwnd);
SetForegroundWindow(hwnd);
@ -298,9 +306,6 @@ bool createWindow(const char * title, int x, int y, int width, int height, bool
// Success! Now you need to initialize a GL object, which creates a GL rendering context;
// and then to issue commands to it, you need to call gl::makeCurrent().
#ifdef _DEBUG
printf("Created window\n");
#endif
// 3. Hide the mouse if necessary
isFullScreen = fullscreen;

View File

@ -1,23 +0,0 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_BaseGL */
#ifndef _Included_org_lwjgl_opengl_BaseGL
#define _Included_org_lwjgl_opengl_BaseGL
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: currentWindow */
/* Inaccessible static: currentContext */
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nCreate
* Signature: (Ljava/lang/String;IIIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
(JNIEnv *, jobject, jstring, jint, jint, jint, jint, jboolean);
#ifdef __cplusplus
}
#endif
#endif