Permalink
Browse files

Updated GLContext::TexImage2D to WebGL spec

  • Loading branch information...
1 parent 18e5660 commit 099208c9936313eadc43e5dfbafbd043d237d279 @puffnfresh committed Apr 28, 2011
Showing with 11 additions and 14 deletions.
  1. +11 −8 src/glcontext.h
  2. +0 −6 src/image.h
View
@@ -26,6 +26,9 @@ class GLContext : public ObjectWrap {
// 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);
@@ -469,14 +472,14 @@ class GLContext : public ObjectWrap {
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);
View
@@ -68,12 +68,6 @@ class Image : public EventEmitter {
return ilGetInteger(IL_IMAGE_HEIGHT);
}
- int
- GetFormat () {
- ilBindImage(image_id);
- return ilGetInteger(IL_IMAGE_FORMAT);
- }
-
void *
GetData () {
return data;

0 comments on commit 099208c

Please sign in to comment.