Commits

Brian McKenna committed 099208c

Updated GLContext::TexImage2D to WebGL spec

Comments (0)

Files changed (2)

 	// Constants
 	Handle<ObjectTemplate> proto = t->PrototypeTemplate();
 
+	SetConstant(proto, "RGB", 0x1907);
+	SetConstant(proto, "RGBA", 0x1908);
+	
 	SetConstant(proto, "DEPTH_BUFFER_BIT",   0x00000100);
 	SetConstant(proto, "STENCIL_BUFFER_BIT", 0x00000400);
 	SetConstant(proto, "COLOR_BUFFER_BIT",   0x00004000);
 
 	GLenum target = args[0]->Uint32Value();
 	GLint level = args[1]->IntegerValue();
-	Image *image = Unwrap<Image>(args[2]->ToObject());
-	GLboolean flipY = args[3]->BooleanValue();
-	if(flipY) {
-		image->FlipVertically();
-	}
-	glTexImage2D(target, level, image->GetBPP(), image->GetWidth(),
-		     image->GetHeight(), 0, image->GetFormat(),
-		     GL_UNSIGNED_BYTE, image->GetData());
+	GLenum internalformat = args[2]->IntegerValue();
+	GLenum format = args[3]->IntegerValue();
+	GLenum type = args[4]->IntegerValue();
+	Image *image = Unwrap<Image>(args[5]->ToObject());
+	
+	glTexImage2D(target, level, internalformat, image->GetWidth(),
+		     image->GetHeight(), 0, format,
+		     type, image->GetData());
 
 	// We have to 
 	glGenerateMipmapEXT(GL_TEXTURE_2D);
 	return ilGetInteger(IL_IMAGE_HEIGHT);
     }
 
-    int
-    GetFormat () {
-	ilBindImage(image_id);
-	return ilGetInteger(IL_IMAGE_FORMAT);
-    }
-
     void *
     GetData () {
 	return data;