npotb; canvas3d updates (osx, linux, some crash fixes)

This commit is contained in:
vladimir@pobox.com 2007-11-04 14:12:44 -08:00
parent 0de0974e41
commit aef0fe3308
13 changed files with 208 additions and 68 deletions

View File

@ -78,7 +78,7 @@ REQUIRES = \
$(NULL)
ifdef MOZ_X11
EXTRA_DSO_LIBS += GL
EXTRA_DSO_LIBS += GL GLU X11
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
@ -101,10 +101,14 @@ CPPSRCS = nsCanvas3DModule.cpp \
DEFINES += -DXPCOM_GLUE -DXPCOM_GLUE_USE_NSPR -DGLEW_MX -DGLEW_STATIC
EXTRA_DSO_LIBS += xpcom
ifdef MOZ_ENABLE_LIBXUL
EXTRA_DSO_LIBS += js3250 xpcom xul
ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
EXTRA_DSO_LIBS += xul
endif
else
EXTRA_DSO_LIBS += js3250 xpcom thebes
EXTRA_DSO_LIBS += thebes
endif
# Hack for getting an extension built against static vs. dynamic versions of firefox
@ -114,6 +118,8 @@ endif
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += -I$(srcdir)
CFLAGS += $(RTL_FLAGS)
CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(TK_CFLAGS)
@ -126,7 +132,11 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
EXTRA_DSO_LDOPTS += opengl32.lib glu32.lib usp10.lib
endif
ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
EXTRA_DSO_LDOPTS += -framework AGL -framework OpenGL
ifdef MOZ_ENABLE_LIBXUL
EXTRA_DSO_LDOPTS += $(DIST)/bin/XUL
endif
endif
EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS) $(XPCOM_GLUE_LDOPTS)
EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(EXTRA_DSO_LIBS) $(MOZ_JS_LIBS) $(XPCOM_GLUE_LDOPTS)

View File

@ -62,7 +62,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmd.h>
#include <GL/glew.h>
#include <glew.h>
#ifdef __cplusplus
extern "C" {

View File

@ -471,9 +471,7 @@ nsCanvasRenderingContextGLPrivate::MakeContextCurrent()
void
nsCanvasRenderingContextGLPrivate::LostCurrentContext(void *closure)
{
nsCanvasRenderingContextGLPrivate* self = (nsCanvasRenderingContextGLPrivate*) closure;
//fprintf (stderr, "[this:%p] Lost context\n", closure);
fflush (stderr);
//nsCanvasRenderingContextGLPrivate* self = (nsCanvasRenderingContextGLPrivate*) closure;
}
//

View File

@ -108,7 +108,7 @@ public:
virtual PRBool ValidateGL() { return PR_TRUE; }
inline void MakeContextCurrent();
void MakeContextCurrent();
static void LostCurrentContext(void *closure);
inline GLEWContext *glewGetContext() {
@ -333,7 +333,7 @@ public:
}
void SetRetVal (PRInt32 *vp, PRUint32 len) {
nsAutoArrayPtr<jsval> jsvector = new jsval[len];
nsAutoArrayPtr<jsval> jsvector(new jsval[len]);
for (PRUint32 i = 0; i < len; i++)
jsvector[i] = INT_TO_JSVAL(vp[i]);
JSObject *jsarr = JS_NewArrayObject(ctx, len, jsvector.get());
@ -341,7 +341,7 @@ public:
}
void SetRetVal (float *fp, PRUint32 len) {
nsAutoArrayPtr<jsval> jsvector = new jsval[len];
nsAutoArrayPtr<jsval> jsvector(new jsval[len]);
if (!JS_EnterLocalRootScope(ctx))
return; // XXX ???

View File

@ -161,7 +161,6 @@ NS_NewCanvasRenderingContextGLES11(nsICanvasRenderingContextGLES11** aResult)
if (!ctx)
return NS_ERROR_OUT_OF_MEMORY;
fprintf (stderr, "VVVVV NS_New called\n"); fflush(stderr);
NS_ADDREF(*aResult = ctx);
return NS_OK;
}
@ -193,9 +192,6 @@ nsCanvasRenderingContextGLES11::~nsCanvasRenderingContextGLES11()
mColorBuffer = nsnull;
for (int i = 0; i < MAX_TEXTURE_UNITS; i++)
mTexCoordBuffer[i] = nsnull;
fprintf (stderr, "VVVVV ~nsCanvasRenderingContextGLES11\n");
fflush (stderr);
}
//
@ -465,11 +461,6 @@ nsCanvasRenderingContextGLES11::VertexPointer()
newBuffer->GetSimpleBuffer().data);
}
(mVertexBuffer.get())->AddRef();
nsrefcnt kk = (mVertexBuffer.get())->Release();
fprintf (stderr, "VVVVV After VertexPointer: mVertexBuffer: %p refcount: %d\n", mVertexBuffer, kk);
fflush(stderr);
return NS_OK;
}
@ -710,7 +701,7 @@ nsCanvasRenderingContextGLES11::DrawElements()
// verify that the indices are valid; we should skip this step
// if the caller is trusted
PRUint32 vLen, nLen, cLen;
PRUint32 vLen = 0, nLen = 0, cLen = 0;
if (mVertexBuffer)
vLen = mVertexBuffer->mLength / mVertexBuffer->mSize;
@ -1147,7 +1138,7 @@ nsCanvasRenderingContextGLES11::TexImage2DHTML(PRUint32 target, nsIDOMHTMLElemen
}
if (!image_data) {
nsRefPtr<gfxImageSurface> tmpImageSurface =
tmpImageSurface =
CanvasGLThebes::CreateImageSurface(gfxIntSize(width, height),
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> cx =
@ -1345,7 +1336,7 @@ nsCanvasRenderingContextGLES11::GenTextures(PRUint32 n)
MakeContextCurrent();
nsAutoArrayPtr<PRUint32> textures(new PRUint32[n]);
nsAutoArrayPtr<GLuint> textures(new GLuint[n]);
glGenTextures(n, textures.get());
nsAutoArrayPtr<jsval> jsvector(new jsval[n]);
@ -1810,7 +1801,7 @@ nsCanvasRenderingContextGLES11::GenBuffers(PRUint32 n)
MakeContextCurrent();
nsAutoArrayPtr<PRUint32> buffers(new PRUint32[n]);
nsAutoArrayPtr<GLuint> buffers(new GLuint[n]);
glGenBuffers(n, buffers.get());
nsAutoArrayPtr<jsval> jsvector(new jsval[n]);
@ -1836,8 +1827,8 @@ nsCanvasRenderingContextGLES11::DeleteBuffers()
if (js.argc != 1)
return NS_ERROR_DOM_SYNTAX_ERR;
JSObject *arrayObj;
jsuint arrayLen;
JSObject *arrayObj = nsnull;
jsuint arrayLen = 0;
if (JSValToJSArrayAndLength(js.ctx, js.argv[0], &arrayObj, &arrayLen)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}

View File

@ -271,15 +271,15 @@ nsCanvasRenderingContextGLWeb20::BufferSubData()
return NS_OK;
}
GL_SAME_METHOD_1(Clear, Clear, PRUint32);
GL_SAME_METHOD_1(Clear, Clear, PRUint32)
GL_SAME_METHOD_4(ClearColor, ClearColor, float, float, float, float);
GL_SAME_METHOD_4(ClearColor, ClearColor, float, float, float, float)
GL_SAME_METHOD_1(ClearDepth, ClearDepth, float);
GL_SAME_METHOD_1(ClearDepth, ClearDepth, float)
GL_SAME_METHOD_1(ClearStencil, ClearStencil, PRInt32);
GL_SAME_METHOD_1(ClearStencil, ClearStencil, PRInt32)
GL_SAME_METHOD_4(ColorMask, ColorMask, PRBool, PRBool, PRBool, PRBool);
GL_SAME_METHOD_4(ColorMask, ColorMask, PRBool, PRBool, PRBool, PRBool)
NS_IMETHODIMP
nsCanvasRenderingContextGLWeb20::CreateProgram(PRUint32 *retval)
@ -297,7 +297,7 @@ nsCanvasRenderingContextGLWeb20::CreateShader(PRUint32 type, PRUint32 *retval)
return NS_OK;
}
GL_SAME_METHOD_1(CullFace, CullFace, PRUint32);
GL_SAME_METHOD_1(CullFace, CullFace, PRUint32)
NS_IMETHODIMP
nsCanvasRenderingContextGLWeb20::DeleteBuffers()
@ -425,16 +425,16 @@ nsCanvasRenderingContextGLWeb20::GetActiveAttrib(PRUint32 program, PRUint32 inde
MakeContextCurrent();
int len;
GLint len;
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
if (len == 0)
return NS_ERROR_FAILURE;
nsAutoArrayPtr<char> name = new char[len+1];
nsAutoArrayPtr<char> name(new char[len+1]);
PRInt32 attrsize;
PRUint32 attrtype;
glGetActiveAttrib(program, index, len+1, &len, &attrsize, &attrtype, name);
glGetActiveAttrib(program, index, len+1, &len, (GLint*) &attrsize, (GLuint*) &attrtype, name);
JSObjectHelper retobj(&js);
retobj.DefineProperty("size", attrsize);
@ -455,16 +455,16 @@ nsCanvasRenderingContextGLWeb20::GetActiveUniform(PRUint32 program, PRUint32 ind
MakeContextCurrent();
int len;
GLint len;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
if (len == 0)
return NS_ERROR_FAILURE;
nsAutoArrayPtr<char> name = new char[len+1];
nsAutoArrayPtr<char> name(new char[len+1]);
PRInt32 attrsize;
PRUint32 attrtype;
glGetActiveUniform(program, index, len+1, &len, &attrsize, &attrtype, name);
glGetActiveUniform(program, index, len+1, &len, (GLint*) &attrsize, (GLenum*) &attrtype, name);
JSObjectHelper retobj(&js);
retobj.DefineProperty("size", attrsize);
@ -485,12 +485,12 @@ nsCanvasRenderingContextGLWeb20::GetAttachedShaders(PRUint32 program)
MakeContextCurrent();
int count;
GLint count;
glGetProgramiv(program, GL_ATTACHED_SHADERS, &count);
nsAutoArrayPtr<PRUint32> shaders = new PRUint32[count];
nsAutoArrayPtr<PRUint32> shaders(new PRUint32[count]);
glGetAttachedShaders(program, count, NULL, shaders);
glGetAttachedShaders(program, count, NULL, (GLuint*) shaders.get());
JSObject *obj = ArrayToJSArray(js.ctx, shaders, count);
@ -604,7 +604,7 @@ nsCanvasRenderingContextGLWeb20::GetParameter(PRUint32 pname)
////case GL_FRAMEBUFFER_BINDING:
{
PRInt32 iv;
glGetIntegerv(pname, &iv);
glGetIntegerv(pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
@ -657,7 +657,7 @@ nsCanvasRenderingContextGLWeb20::GetParameter(PRUint32 pname)
case GL_MAX_VIEWPORT_DIMS: // 2 ints
{
PRInt32 iv[2];
glGetIntegerv(pname, &iv[0]);
glGetIntegerv(pname, (GLint*) &iv[0]);
js.SetRetVal(iv, 2);
}
break;
@ -666,7 +666,7 @@ nsCanvasRenderingContextGLWeb20::GetParameter(PRUint32 pname)
case GL_VIEWPORT: // 4 ints
{
PRInt32 iv[4];
glGetIntegerv(pname, &iv[0]);
glGetIntegerv(pname, (GLint*) &iv[0]);
js.SetRetVal(iv, 4);
}
break;
@ -694,7 +694,7 @@ nsCanvasRenderingContextGLWeb20::GetBufferParameter(PRUint32 target, PRUint32 pn
case GL_BUFFER_MAPPED:
{
PRInt32 iv;
glGetBufferParameteriv(target, pname, &iv);
glGetBufferParameteriv(target, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
@ -719,7 +719,7 @@ nsCanvasRenderingContextGLWeb20::GenBuffers(PRUint32 n)
MakeContextCurrent();
nsAutoArrayPtr<PRUint32> buffers(new PRUint32[n]);
glGenBuffers(n, buffers.get());
glGenBuffers(n, (GLuint*) buffers.get());
nsAutoArrayPtr<jsval> jsvector(new jsval[n]);
for (PRUint32 i = 0; i < n; i++)
@ -747,7 +747,7 @@ nsCanvasRenderingContextGLWeb20::GenTextures(PRUint32 n)
MakeContextCurrent();
nsAutoArrayPtr<PRUint32> textures(new PRUint32[n]);
glGenTextures(n, textures.get());
glGenTextures(n, (GLuint*) textures.get());
nsAutoArrayPtr<jsval> jsvector(new jsval[n]);
for (PRUint32 i = 0; i < n; i++)
@ -792,7 +792,7 @@ nsCanvasRenderingContextGLWeb20::GetProgramParameter(PRUint32 program, PRUint32
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
{
PRInt32 iv;
glGetProgramiv(program, pname, &iv);
glGetProgramiv(program, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
@ -811,7 +811,7 @@ nsCanvasRenderingContextGLWeb20::GetProgramInfoLog(PRUint32 program, char **retv
MakeContextCurrent();
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &k);
glGetProgramiv(program, GL_INFO_LOG_LENGTH, (GLint*) &k);
if (k == 0) {
*retval = nsnull;
return NS_OK;
@ -819,7 +819,7 @@ nsCanvasRenderingContextGLWeb20::GetProgramInfoLog(PRUint32 program, char **retv
char *s = (char *) PR_Malloc(k);
glGetProgramInfoLog(program, k, &k, s);
glGetProgramInfoLog(program, k, (GLint*) &k, s);
*retval = s;
return NS_OK;
@ -930,7 +930,7 @@ nsCanvasRenderingContextGLWeb20::GetTexParameter(PRUint32 target, PRUint32 pname
case GL_TEXTURE_WRAP_T:
{
PRInt32 iv;
glGetTexParameteriv(target, pname, &iv);
glGetTexParameteriv(target, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
@ -1061,7 +1061,7 @@ nsCanvasRenderingContextGLWeb20::TexImage2DHTML(PRUint32 target, nsIDOMHTMLEleme
}
if (!image_data) {
nsRefPtr<gfxImageSurface> tmpImageSurface =
tmpImageSurface =
CanvasGLThebes::CreateImageSurface(gfxIntSize(width, height),
gfxASurface::ImageFormatARGB32);
nsRefPtr<gfxContext> cx =
@ -1325,7 +1325,7 @@ nsCanvasRenderingContextGLWeb20::GetShaderParameter(PRUint32 shader, PRUint32 pn
case GL_SHADER_SOURCE_LENGTH:
{
PRInt32 iv;
glGetShaderiv(shader, pname, &iv);
glGetShaderiv(shader, pname, (GLint*) &iv);
js.SetRetVal(iv);
}
break;
@ -1344,11 +1344,11 @@ nsCanvasRenderingContextGLWeb20::GetShaderInfoLog(PRUint32 shader, char **retval
MakeContextCurrent();
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &k);
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, (GLint*) &k);
char *s = (char *) PR_Malloc(k);
glGetShaderInfoLog(shader, k, &k, s);
glGetShaderInfoLog(shader, k, (GLint*) &k, s);
*retval = s;
return NS_OK;
@ -1461,11 +1461,8 @@ nsCanvasRenderingContextGLWeb20::ValidateGL()
GLint val;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &val);
fprintf (stderr, "-- %d vertex buffers\n", val);
mAttribBuffers.SetLength(val);
MakeContextCurrent();
if (mPrefWireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
return PR_TRUE;
}

View File

@ -49,10 +49,14 @@ void *nsGLPbuffer::sCurrentContextToken = nsnull;
static PRUint32 gActiveBuffers = 0;
nsGLPbuffer::nsGLPbuffer()
: mWidth(0), mHeight(0),
: mWidth(0), mHeight(0)
#ifdef XP_WIN
mGlewWindow(nsnull), mGlewDC(nsnull), mGlewWglContext(nsnull),
, mGlewWindow(nsnull), mGlewDC(nsnull), mGlewWglContext(nsnull),
mPbuffer(nsnull), mPbufferDC(nsnull), mPbufferContext(nsnull)
#elif defined(XP_UNIX) && defined(MOZ_X11)
, mDisplay(nsnull), mFBConfig(0), mPbuffer(0), mPbufferContext(0)
#elif defined(XP_MACOSX)
, mContext(nsnull), mPbuffer(nsnull)
#endif
{
gActiveBuffers++;
@ -130,6 +134,71 @@ nsGLPbuffer::Init(nsCanvasRenderingContextGLPrivate *priv)
PRInt64 t2 = PR_Now();
fprintf (stderr, "nsGLPbuffer::Init!\n");
#elif defined(XP_UNIX) && defined(MOZ_X11)
mDisplay = XOpenDisplay(NULL);
if (!mDisplay) {
mPriv->LogMessage(NS_LITERAL_CSTRING("Canvas 3D: XOpenDisplay failed"));
return PR_FALSE;
}
int attrib[] = { GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
None };
int num;
GLXFBConfig *configs = glXChooseFBConfig(mDisplay, DefaultScreen(mDisplay),
attrib, &num);
fprintf(stderr, "CANVAS3D FBCONFIG: %d %p\n", num, configs);
if (!configs) {
mPriv->LogMessage(NS_LITERAL_CSTRING("Canvas 3D: No GLXFBConfig found"));
return PR_FALSE;
}
// choose first matching config;
mFBConfig = *configs;
XFree(configs);
// create dummy pbuffer so glewInit will be happy
mPbufferContext = glXCreateNewContext(mDisplay, mFBConfig, GLX_RGBA_TYPE,
nsnull, True);
PRInt64 t1 = PR_Now();
Resize(2, 2);
MakeContextCurrent();
PRInt64 t2 = PR_Now();
fprintf (stderr, "nsGLPbuffer::Init!\n");
#elif defined(XP_MACOSX)
PRInt64 t1 = PR_Now();
PRInt64 t2 = t1;
GLint attrib[] = {
AGL_RGBA,
AGL_PBUFFER,
AGL_RED_SIZE, 8,
AGL_GREEN_SIZE, 8,
AGL_BLUE_SIZE, 8,
AGL_ALPHA_SIZE, 8,
AGL_DEPTH_SIZE, 1,
0
};
mPixelFormat = aglChoosePixelFormat(NULL, 0, &attrib[0]);
if (!mPixelFormat)
return PR_FALSE;
// we need a context for glewInit
Resize(2, 2);
MakeContextCurrent();
#else
return PR_FALSE;
#endif
@ -282,11 +351,34 @@ nsGLPbuffer::Resize(PRInt32 width, PRInt32 height)
mPbufferDC = wglGetPbufferDCARB(mPbuffer);
mPbufferContext = wglCreateContext(mPbufferDC);
#elif defined(XP_UNIX) && defined(MOZ_X11)
int attrib[] = { GLX_PBUFFER_WIDTH, width,
GLX_PBUFFER_HEIGHT, height,
None };
mPbuffer = glXCreatePbuffer(mDisplay, mFBConfig, attrib);
#elif defined(XP_MACOSX)
mContext = aglCreateContext(mPixelFormat, NULL);
if (!mContext)
return PR_FALSE;
GLint screen = aglGetVirtualScreen(mContext);
if (screen == -1
|| !aglCreatePBuffer(width, height, GL_TEXTURE_RECTANGLE_EXT,
GL_RGBA, 0, &mPbuffer)
|| !aglSetPBuffer (mContext, mPbuffer, 0, 0, screen))
{
return PR_FALSE;
}
MakeContextCurrent();
#endif
mWidth = width;
mHeight = height;
fprintf (stderr, "Resize: %d %d\n", width, height);
return PR_TRUE;
}
@ -302,17 +394,45 @@ nsGLPbuffer::Destroy()
wglDestroyPbufferARB(mPbuffer);
mPbuffer = nsnull;
}
#endif
#elif defined(XP_UNIX) && defined(MOZ_X11)
if (mPbuffer) {
glXDestroyPbuffer(mDisplay, mPbuffer);
mPbuffer = nsnull;
}
#else defined(XP_MACOSX)
if (mContext) {
aglDestroyContext(mContext);
mContext = nsnull;
}
if (mPbuffer) {
aglDestroyPBuffer(mPbuffer);
mPbuffer = nsnull;
}
#endif
}
nsGLPbuffer::~nsGLPbuffer()
{
Destroy();
#ifdef XP_WIN
if (mGlewWindow) {
wglDeleteContext(mGlewWglContext);
DestroyWindow(mGlewWindow);
mGlewWindow = nsnull;
}
#elif defined(XP_UNIX) && defined(MOZ_X11)
if (mPbuffer)
glXDestroyPbuffer(mDisplay, mPbuffer);
if (mPbufferContext)
glXDestroyContext(mDisplay, mPbufferContext);
if (mDisplay)
XCloseDisplay(mDisplay);
#else defined(XP_MACOSX)
if (mPbuffer)
aglDestroyPBuffer(mPbuffer);
if (mContext)
aglDestroyContext(mContext);
#endif
gActiveBuffers--;
@ -329,6 +449,10 @@ nsGLPbuffer::MakeContextCurrent()
wglMakeCurrent (mPbufferDC, mPbufferContext);
sCurrentContextToken = mPbufferContext;
#elif defined(XP_UNIX) && defined(MOZ_X11)
glXMakeContextCurrent(mDisplay, mPbuffer, mPbuffer, mPbufferContext);
#elif defined(XP_MACOSX)
aglSetCurrentContext(mContext);
#endif
}

View File

@ -49,6 +49,14 @@
#include "wglew.h"
#endif
#if defined(XP_UNIX) && defined(MOZ_X11)
#include "GL/glx.h"
#endif
#ifdef XP_MACOSX
#include <AGL/agl.h>
#endif
class nsCanvasRenderingContextGLPrivate;
class nsGLPbuffer {
@ -104,6 +112,18 @@ protected:
WGLEWContext mWGlewContext;
#endif
#if defined(XP_UNIX) && defined(MOZ_X11)
Display *mDisplay;
GLXFBConfig mFBConfig;
GLXPbuffer mPbuffer;
GLXContext mPbufferContext;
#endif
#ifdef XP_MACOSX
AGLPixelFormat mPixelFormat;
AGLContext mContext;
AGLPbuffer mPbuffer;
#endif
};
#endif /* NSGLPBUFFER_H_ */

View File

@ -4,7 +4,7 @@
<script type="application/x-javascript">
function doload() {
var cvs = document.getElementById('canvas');
var ctx = cvs.getContext('gles11');
var ctx = cvs.getContext('moz-gles11');
ctx.clearColor(.2,.2,.2,1);
ctx.clear(ctx.COLOR_BUFFER_BIT);

View File

@ -22,7 +22,7 @@ function makeImageCanvas() {
function doload() {
var cvs = document.getElementById('canvas');
var gl = cvs.getContext('gles11');
var gl = cvs.getContext('moz-gles11');
gl.clearColor(.2,.2,.4,1);
gl.clear(gl.COLOR_BUFFER_BIT);

View File

@ -59,7 +59,7 @@ function startTextureLoad() {
function doload() {
var cvs = document.getElementById('canvas');
gl = cvs.getContext('gles11');
gl = cvs.getContext('moz-gles11');
gl.clearColor(.2,.2,.4,1);
gl.clear(gl.COLOR_BUFFER_BIT);

View File

@ -79,7 +79,7 @@ function startTextureLoad() {
function doload() {
var cvs = document.getElementById('canvas');
gl = cvs.getContext('gles11');
gl = cvs.getContext('moz-gles11');
gl.clearColor(.2,.2,.4,1);
gl.clear(gl.COLOR_BUFFER_BIT);

View File

@ -105,7 +105,7 @@ function animStep() {
function doload() {
var cvs = document.getElementById('canvas');
gl = cvs.getContext('gles11');
gl = cvs.getContext('moz-gles11');
// (optionally) set up lighting
if (0) {