1ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/* 2ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Copyright (C) 2011 The Android Open Source Project 3ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* 4ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Licensed under the Apache License, Version 2.0 (the "License"); 5ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* you may not use this file except in compliance with the License. 6ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* You may obtain a copy of the License at 7ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* 8ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* http://www.apache.org/licenses/LICENSE-2.0 9ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* 10ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* Unless required by applicable law or agreed to in writing, software 11ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* distributed under the License is distributed on an "AS IS" BASIS, 12ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* See the License for the specific language governing permissions and 14ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall* limitations under the License. 15ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall*/ 16ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 17ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#ifdef _WIN32 18ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#undef GL_API 19ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define GL_API __declspec(dllexport) 20ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define GL_APICALL __declspec(dllexport) 21ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#endif 22ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#define GL_GLEXT_PROTOTYPES 23ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include "GLEScmContext.h" 24ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include "GLEScmValidate.h" 25ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include "GLEScmUtils.h" 26ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/TextureUtils.h> 27ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 28ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <stdio.h> 29ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/gldefs.h> 30ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/GLDispatch.h> 31ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/GLconversion_macros.h> 32ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/TranslatorIfaces.h> 33ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/FramebufferData.h> 34ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLES/gl.h> 35ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLES/glext.h> 36ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <cmath> 37ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <map> 38ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 39ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallextern "C" { 40ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 41ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall//decleration 42ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void initContext(GLEScontext* ctx,ShareGroupPtr grp); 43ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void deleteGLESContext(GLEScontext* ctx); 44ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp); 45ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic GLEScontext* createGLESContext(); 46ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName); 47ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 48ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 49ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 50ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/************************************** GLES EXTENSIONS *********************************************************/ 51ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall//extentions descriptor 52ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Halltypedef std::map<std::string, __translatorMustCastToProperFunctionPointerType> ProcTableMap; 53ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallProcTableMap *s_glesExtensions = NULL; 54ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/****************************************************************************************************************/ 55ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 56ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic EGLiface* s_eglIface = NULL; 57ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic GLESiface s_glesIface = { 58ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall createGLESContext:createGLESContext, 59ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall initContext :initContext, 60ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall deleteGLESContext:deleteGLESContext, 61ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall flush :(FUNCPTR)glFlush, 62ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall finish :(FUNCPTR)glFinish, 63ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall setShareGroup :setShareGroup, 64ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall getProcAddress :getProcAddress 65ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall}; 66ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 67ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall#include <GLcommon/GLESmacros.h> 68ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 69ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallextern "C" { 70ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 71ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void initContext(GLEScontext* ctx,ShareGroupPtr grp) { 72ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!ctx->isInitialized()) { 73ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setShareGroup(grp); 74ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->init(); 75ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glBindTexture(GL_TEXTURE_2D,0); 76ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glBindTexture(GL_TEXTURE_CUBE_MAP_OES,0); 77ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 78ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 79ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 80ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic GLEScontext* createGLESContext() { 81ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return new GLEScmContext(); 82ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 83ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 84ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void deleteGLESContext(GLEScontext* ctx) { 85ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx) delete ctx; 86ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 87ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 88ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic void setShareGroup(GLEScontext* ctx,ShareGroupPtr grp) { 89ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx) { 90ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setShareGroup(grp); 91ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 92ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 93ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic __translatorMustCastToProperFunctionPointerType getProcAddress(const char* procName) { 94ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(NULL) 95ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->getGlobalLock(); 96ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall static bool proc_table_initialized = false; 97ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!proc_table_initialized) { 98ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall proc_table_initialized = true; 99ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!s_glesExtensions) 100ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall s_glesExtensions = new ProcTableMap(); 101ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 102ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall s_glesExtensions->clear(); 103ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glEGLImageTargetTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glEGLImageTargetTexture2DOES; 104ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glEGLImageTargetRenderbufferStorageOES"]=(__translatorMustCastToProperFunctionPointerType)glEGLImageTargetRenderbufferStorageOES; 105ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glBlendEquationSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationSeparateOES; 106ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glBlendFuncSeparateOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendFuncSeparateOES; 107ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glBlendEquationOES"] = (__translatorMustCastToProperFunctionPointerType)glBlendEquationOES; 108ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 109ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND) { 110ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glCurrentPaletteMatrixOES"] = (__translatorMustCastToProperFunctionPointerType)glCurrentPaletteMatrixOES; 111ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glLoadPaletteFromModelViewMatrixOES"]=(__translatorMustCastToProperFunctionPointerType)glLoadPaletteFromModelViewMatrixOES; 112ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glMatrixIndexPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glMatrixIndexPointerOES; 113ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glWeightPointerOES"] = (__translatorMustCastToProperFunctionPointerType)glWeightPointerOES; 114ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 115ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDepthRangefOES"] = (__translatorMustCastToProperFunctionPointerType)glDepthRangef; 116ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glFrustumfOES"] = (__translatorMustCastToProperFunctionPointerType)glFrustumf; 117ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glOrthofOES"] = (__translatorMustCastToProperFunctionPointerType)glOrthof; 118ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glClipPlanef; 119ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetClipPlanefOES"] = (__translatorMustCastToProperFunctionPointerType)glGetClipPlanef; 120ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glClearDepthfOES"] = (__translatorMustCastToProperFunctionPointerType)glClearDepthf; 121ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glPointSizePointerOES"] = (__translatorMustCastToProperFunctionPointerType)glPointSizePointerOES; 122ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGenfOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfOES; 123ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenfvOES; 124ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGeniOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGeniOES; 125ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenivOES; 126ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGenxOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxOES; 127ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glTexGenxvOES; 128ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetTexGenfvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenfvOES; 129ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetTexGenivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenivOES; 130ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetTexGenxvOES"] = (__translatorMustCastToProperFunctionPointerType)glGetTexGenxvOES; 131ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT) { 132ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glIsRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsRenderbufferOES; 133ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glBindRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindRenderbufferOES; 134ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDeleteRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteRenderbuffersOES; 135ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGenRenderbuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenRenderbuffersOES; 136ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glRenderbufferStorageOES"] = (__translatorMustCastToProperFunctionPointerType)glRenderbufferStorageOES; 137ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetRenderbufferParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetRenderbufferParameterivOES; 138ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glIsFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glIsFramebufferOES; 139ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glBindFramebufferOES"] = (__translatorMustCastToProperFunctionPointerType)glBindFramebufferOES; 140ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDeleteFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glDeleteFramebuffersOES; 141ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGenFramebuffersOES"] = (__translatorMustCastToProperFunctionPointerType)glGenFramebuffersOES; 142ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glCheckFramebufferStatusOES"] = (__translatorMustCastToProperFunctionPointerType)glCheckFramebufferStatusOES; 143ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glFramebufferTexture2DOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferTexture2DOES; 144ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glFramebufferRenderbufferOES"] = (__translatorMustCastToProperFunctionPointerType)glFramebufferRenderbufferOES; 145ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGetFramebufferAttachmentParameterivOES"] = (__translatorMustCastToProperFunctionPointerType)glGetFramebufferAttachmentParameterivOES; 146ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glGenerateMipmapOES"] = (__translatorMustCastToProperFunctionPointerType)glGenerateMipmapOES; 147ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 148ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexsOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexsOES; 149ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexiOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexiOES; 150ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexfOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexfOES; 151ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexxOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexxOES; 152ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexsvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexsvOES; 153ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexivOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexivOES; 154ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexfvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexfvOES; 155ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*s_glesExtensions)["glDrawTexxvOES"] = (__translatorMustCastToProperFunctionPointerType)glDrawTexxvOES; 156ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 157ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall __translatorMustCastToProperFunctionPointerType ret=NULL; 158ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ProcTableMap::iterator val = s_glesExtensions->find(procName); 159ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (val!=s_glesExtensions->end()) 160ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ret = val->second; 161ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->releaseGlobalLock(); 162ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 163ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ret; 164ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 165ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 166ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLESiface* __translator_getIfaces(EGLiface* eglIface){ 167ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall s_eglIface = eglIface; 168ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return & s_glesIface; 169ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 170ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 171ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 172ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 173ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic ObjectLocalName TextureLocalName(GLenum target, unsigned int tex) { 174ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(0); 175ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return (tex!=0? tex : ctx->getDefaultTextureName(target)); 176ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 177ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 178ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic TextureData* getTextureData(ObjectLocalName tex){ 179ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(NULL); 180ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 181ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(!ctx->shareGroup()->isObject(TEXTURE,tex)) 182ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 183ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return NULL; 184ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 185ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 186ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = NULL; 187ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(TEXTURE,tex); 188ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(!objData.Ptr()){ 189ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData = new TextureData(); 190ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(TEXTURE, tex, ObjectDataPtr(texData)); 191ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else { 192ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData = (TextureData*)objData.Ptr(); 193ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 194ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return texData; 195ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 196ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 197ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic TextureData* getTextureTargetData(GLenum target){ 198ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(NULL); 199ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int tex = ctx->getBindedTexture(target); 200ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return getTextureData(TextureLocalName(target,tex)); 201ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 202ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 203ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) { 204ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(GL_FALSE) 205ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 206ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(buffer && ctx->shareGroup().Ptr()) { 207ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(VERTEXBUFFER,buffer); 208ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return objData.Ptr() ? ((GLESbuffer*)objData.Ptr())->wasBinded():GL_FALSE; 209ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 210ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return GL_FALSE; 211ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 212ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 213ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLboolean GL_APIENTRY glIsEnabled( GLenum cap) { 214ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM_RET(GL_FALSE) 215ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(!GLEScmValidate::capability(cap,ctx->getMaxLights(),ctx->getMaxClipPlanes()),GL_INVALID_ENUM,GL_FALSE); 216ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 217ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (cap == GL_POINT_SIZE_ARRAY_OES) 218ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->isArrEnabled(cap); 219ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else if (cap==GL_TEXTURE_GEN_STR_OES) 220ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return (ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_S) && 221ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_T) && 222ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glIsEnabled(GL_TEXTURE_GEN_R)); 223ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 224ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->dispatcher().glIsEnabled(cap); 225ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 226ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 227ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLboolean GL_APIENTRY glIsTexture( GLuint texture) { 228ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(GL_FALSE) 229ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 230ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(texture == 0) // Special case 231ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return GL_FALSE; 232ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 233ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData* tex = getTextureData(texture); 234ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return tex ? tex->wasBound : GL_FALSE; 235ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 236ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 237ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLenum GL_APIENTRY glGetError(void) { 238ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(GL_NO_ERROR) 239ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLenum err = ctx->getGLerror(); 240ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(err != GL_NO_ERROR) { 241ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setGLerror(GL_NO_ERROR); 242ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return err; 243ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 244ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 245ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->dispatcher().glGetError(); 246ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 247ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 248ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API const GLubyte * GL_APIENTRY glGetString( GLenum name) { 249ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 250ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(NULL) 251ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(name) { 252ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_VENDOR: 25381e372046c2212585a4ff518ccdcff950d476717Jesse Hall return (const GLubyte*)ctx->getVendorString(); 254ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERER: 255ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return (const GLubyte*)ctx->getRendererString(); 256ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_VERSION: 25781e372046c2212585a4ff518ccdcff950d476717Jesse Hall return (const GLubyte*)ctx->getVersionString(); 258ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_EXTENSIONS: 259ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return (const GLubyte*)ctx->getExtensionString(); 260ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 261ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(true,GL_INVALID_ENUM,NULL); 262ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 263ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 264ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 265ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glActiveTexture( GLenum texture) { 266ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 267ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureEnum(texture,ctx->getMaxTexUnits()),GL_INVALID_ENUM); 268ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setActiveTexture(texture); 269ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glActiveTexture(texture); 270ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 271ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 272ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glAlphaFunc( GLenum func, GLclampf ref) { 273ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 274ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::alphaFunc(func),GL_INVALID_ENUM); 275ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glAlphaFunc(func,ref); 276ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 277ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 278ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 279ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glAlphaFuncx( GLenum func, GLclampx ref) { 280ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 281ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::alphaFunc(func),GL_INVALID_ENUM); 282ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glAlphaFunc(func,X2F(ref)); 283ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 284ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 285ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 286ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBindBuffer( GLenum target, GLuint buffer) { 287ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 288ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM); 289ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 290ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //if buffer wasn't generated before,generate one 291ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(buffer && ctx->shareGroup().Ptr() && !ctx->shareGroup()->isObject(VERTEXBUFFER,buffer)){ 292ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(VERTEXBUFFER,buffer); 293ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(VERTEXBUFFER,buffer,ObjectDataPtr(new GLESbuffer())); 294ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 295ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->bindBuffer(target,buffer); 296ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (buffer) { 297ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLESbuffer* vbo = (GLESbuffer*)ctx->shareGroup()->getObjectData(VERTEXBUFFER,buffer).Ptr(); 298ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall vbo->setBinded(); 299ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 300ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 301ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 302ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 303ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBindTexture( GLenum target, GLuint texture) { 304ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 305ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureTarget(target),GL_INVALID_ENUM) 306ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 307ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //for handling default texture (0) 308ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectLocalName localTexName = TextureLocalName(target,texture); 309ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 310ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint globalTextureName = localTexName; 311ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()){ 312ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,localTexName); 313ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //if texture wasn't generated before,generate one 314ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(!globalTextureName){ 315ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(TEXTURE,localTexName); 316ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,localTexName); 317ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 318ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 319ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData* texData = getTextureData(localTexName); 320ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (texData->target==0) 321ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->target = target; 322ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //if texture was already bound to another target 323ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(ctx->GLTextureTargetToLocal(texData->target) != ctx->GLTextureTargetToLocal(target), GL_INVALID_OPERATION); 324ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->wasBound = true; 325ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 326ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 327ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setBindedTexture(target,texture); 328ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindTexture(target,globalTextureName); 329ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 330ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 331ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor) { 332ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 333ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::blendSrc(sfactor) || !GLEScmValidate::blendDst(dfactor),GL_INVALID_ENUM) 334ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBlendFunc(sfactor,dfactor); 335ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 336ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 337ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBufferData( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) { 338ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 339ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM); 340ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION); 341ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setBufferData(target,size,data,usage); 342ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 343ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 344ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBufferSubData( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) { 345ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 346ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION); 347ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::bufferTarget(target),GL_INVALID_ENUM); 348ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->setBufferSubData(target,offset,size,data),GL_INVALID_VALUE); 349ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 350ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 351ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClear( GLbitfield mask) { 352ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 353ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawValidate(); 354ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 355ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClear(mask); 356ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 357ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 358ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { 359ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 360ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClearColor(red,green,blue,alpha); 361ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 362ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 363ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClearColorx( GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { 364ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 365ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClearColor(X2F(red),X2F(green),X2F(blue),X2F(alpha)); 366ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 367ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 368ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 369ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClearDepthf( GLclampf depth) { 370ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 371ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClearDepth(depth); 372ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 373ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 374ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClearDepthx( GLclampx depth) { 375ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 376ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClearDepth(X2F(depth)); 377ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 378ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 379ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClearStencil( GLint s) { 380ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 381ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClearStencil(s); 382ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 383ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 384ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClientActiveTexture( GLenum texture) { 385ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 386ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureEnum(texture,ctx->getMaxTexUnits()),GL_INVALID_ENUM); 387ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setClientActiveTexture(texture); 388ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClientActiveTexture(texture); 389ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 390ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 391ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 392ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClipPlanef( GLenum plane, const GLfloat *equation) { 393ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 394ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLdouble tmpEquation[4]; 395ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 396ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i = 0; i < 4; i++) { 397ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpEquation[i] = static_cast<GLdouble>(equation[i]); 398ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 399ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClipPlane(plane,tmpEquation); 400ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 401ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 402ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glClipPlanex( GLenum plane, const GLfixed *equation) { 403ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 404ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLdouble tmpEquation[4]; 405ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i = 0; i < 4; i++) { 406ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpEquation[i] = X2D(equation[i]); 407ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 408ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClipPlane(plane,tmpEquation); 409ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 410ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 411ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glColor4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { 412ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 413ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glColor4f(red,green,blue,alpha); 414ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 415ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 416ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glColor4ub( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { 417ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 418ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glColor4ub(red,green,blue,alpha); 419ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 420ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 421ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glColor4x( GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { 422ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 423ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glColor4f(X2F(red),X2F(green),X2F(blue),X2F(alpha)); 424ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 425ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 426ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { 427ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 428ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glColorMask(red,green,blue,alpha); 429ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 430ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 431ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { 432ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 433ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::colorPointerParams(size,stride),GL_INVALID_VALUE); 434ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::colorPointerType(type),GL_INVALID_ENUM); 435ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setPointer(GL_COLOR_ARRAY,size,type,stride,pointer); 436ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 437ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 438ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { 439ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 440ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureTargetEx(target),GL_INVALID_ENUM); 441ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 442ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall doCompressedTexImage2D(ctx, target, level, internalformat, 443ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall width, height, border, 444ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall imageSize, data, (void*)glTexImage2D); 445ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 446ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 447ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { 448ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 449ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::texCompImgFrmt(format) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM); 450ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(level < 0 || level > log2(ctx->getMaxTexSize()),GL_INVALID_VALUE) 451ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 452ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLenum uncompressedFrmt; 453ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned char* uncompressed = uncompressTexture(format,uncompressedFrmt,width,height,imageSize,data,level); 454ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,uncompressedFrmt,GL_UNSIGNED_BYTE,uncompressed); 455ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall delete uncompressed; 456ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 457ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 458ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCopyTexImage2D( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { 459ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 460ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,internalformat) && GLEScmValidate::textureTargetEx(target)),GL_INVALID_ENUM); 461ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(border != 0,GL_INVALID_VALUE); 462ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glCopyTexImage2D(target,level,internalformat,x,y,width,height,border); 463ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 464ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 465ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { 466ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 467ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureTargetEx(target),GL_INVALID_ENUM); 468ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height); 469ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 470ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 471ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCullFace( GLenum mode) { 472ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 473ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glCullFace(mode); 474ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 475ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 476ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDeleteBuffers( GLsizei n, const GLuint *buffers) { 477ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 478ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(n<0,GL_INVALID_VALUE); 479ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()) { 480ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i < n; i++){ 481ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->deleteName(VERTEXBUFFER,buffers[i]); 482ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->unbindBuffer(buffers[i]); 483ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 484ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 485ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 486ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 487ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDeleteTextures( GLsizei n, const GLuint *textures) { 488ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 489ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(n<0,GL_INVALID_VALUE); 490ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()) { 491ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i < n; i++){ 492ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(textures[i] != 0) 493ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 494ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData* tData = getTextureData(textures[i]); 495ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // delete the underlying OpenGL texture but only if this 496ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // texture is not a target of EGLImage. 497ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!tData || tData->sourceEGLImage == 0) { 498ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall const GLuint globalTextureName = ctx->shareGroup()->getGlobalName(TEXTURE,textures[i]); 499ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDeleteTextures(1,&globalTextureName); 500ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 501ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->deleteName(TEXTURE,textures[i]); 502ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 503ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->getBindedTexture(GL_TEXTURE_2D) == textures[i]) 504ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setBindedTexture(GL_TEXTURE_2D,0); 505ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->getBindedTexture(GL_TEXTURE_CUBE_MAP) == textures[i]) 506ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setBindedTexture(GL_TEXTURE_CUBE_MAP,0); 507ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 508ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 509ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 510ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 511ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 512ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDepthFunc( GLenum func) { 513ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 514ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDepthFunc(func); 515ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 516ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 517ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDepthMask( GLboolean flag) { 518ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 519ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDepthMask(flag); 520ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 521ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 522ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDepthRangef( GLclampf zNear, GLclampf zFar) { 523ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 524ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDepthRange(zNear,zFar); 525ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 526ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 527ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDepthRangex( GLclampx zNear, GLclampx zFar) { 528ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 529ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDepthRange(X2F(zNear),X2F(zFar)); 530ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 531ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 532ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDisable( GLenum cap) { 533ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 534ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (cap==GL_TEXTURE_GEN_STR_OES) { 535ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDisable(GL_TEXTURE_GEN_S); 536ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDisable(GL_TEXTURE_GEN_T); 537ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDisable(GL_TEXTURE_GEN_R); 538ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 539ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else ctx->dispatcher().glDisable(cap); 540ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (cap==GL_TEXTURE_2D || cap==GL_TEXTURE_CUBE_MAP_OES) 541ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setTextureEnabled(cap,false); 542ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 543ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 544ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDisableClientState( GLenum array) { 545ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 546ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::supportedArrays(array),GL_INVALID_ENUM) 547ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 548ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->enableArr(array,false); 549ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(array != GL_POINT_SIZE_ARRAY_OES) ctx->dispatcher().glDisableClientState(array); 550ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 551ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 552ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 553ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count) { 554ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 555ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(count < 0,GL_INVALID_VALUE) 556ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::drawMode(mode),GL_INVALID_ENUM) 557ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 558ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawValidate(); 559ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 560ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(!ctx->isArrEnabled(GL_VERTEX_ARRAY)) return; 561ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 562ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLESConversionArrays tmpArrs; 563ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setupArraysPointers(tmpArrs,first,count,0,NULL,true); 564ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ 565ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawPointsArrs(tmpArrs,first,count); 566ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 567ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 568ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 569ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDrawArrays(mode,first,count); 570ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 571ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 572ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 573ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *elementsIndices) { 574ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 575ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(count < 0,GL_INVALID_VALUE) 576ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF((!GLEScmValidate::drawMode(mode) || !GLEScmValidate::drawType(type)),GL_INVALID_ENUM) 577ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(!ctx->isArrEnabled(GL_VERTEX_ARRAY)) return; 578ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 579ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawValidate(); 580ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 581ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall const GLvoid* indices = elementsIndices; 582ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLESConversionArrays tmpArrs; 583ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->isBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)) { // if vbo is binded take the indices from the vbo 584ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall const unsigned char* buf = static_cast<unsigned char *>(ctx->getBindedBuffer(GL_ELEMENT_ARRAY_BUFFER)); 585ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall indices = buf+reinterpret_cast<uintptr_t>(elementsIndices); 586ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 587ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 588ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setupArraysPointers(tmpArrs,0,count,type,indices,false); 589ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(mode == GL_POINTS && ctx->isArrEnabled(GL_POINT_SIZE_ARRAY_OES)){ 590ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawPointsElems(tmpArrs,count,type,indices); 591ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 592ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else{ 593ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDrawElements(mode,count,type,indices); 594ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 595ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 596ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 597ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glEnable( GLenum cap) { 598ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 599ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (cap==GL_TEXTURE_GEN_STR_OES) { 600ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnable(GL_TEXTURE_GEN_S); 601ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnable(GL_TEXTURE_GEN_T); 602ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnable(GL_TEXTURE_GEN_R); 603ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 604ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 605ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnable(cap); 606ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (cap==GL_TEXTURE_2D || cap==GL_TEXTURE_CUBE_MAP_OES) 607ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setTextureEnabled(cap,true); 608ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 609ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 610ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glEnableClientState( GLenum array) { 611ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 612ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::supportedArrays(array),GL_INVALID_ENUM) 613ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 614ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->enableArr(array,true); 615ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(array != GL_POINT_SIZE_ARRAY_OES) ctx->dispatcher().glEnableClientState(array); 616ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 617ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 618ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFinish( void) { 619ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 620ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFinish(); 621ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 622ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 623ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFlush( void) { 624ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 625ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFlush(); 626ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 627ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 628ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFogf( GLenum pname, GLfloat param) { 629ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 630ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFogf(pname,param); 631ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 632ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 633ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFogfv( GLenum pname, const GLfloat *params) { 634ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 635ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFogfv(pname,params); 636ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 637ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 638ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFogx( GLenum pname, GLfixed param) { 639ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 640ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFogf(pname,(pname == GL_FOG_MODE)? static_cast<GLfloat>(param):X2F(param)); 641ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 642ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 643ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFogxv( GLenum pname, const GLfixed *params) { 644ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 645ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(pname == GL_FOG_MODE) { 646ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParam = static_cast<GLfloat>(params[0]); 647ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFogfv(pname,&tmpParam); 648ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else { 649ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 650ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i< 4; i++) { 651ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[i] = X2F(params[i]); 652ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 653ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFogfv(pname,tmpParams); 654ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 655ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 656ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 657ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 658ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFrontFace( GLenum mode) { 659ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 660ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFrontFace(mode); 661ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 662ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 663ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFrustumf( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { 664ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 665ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFrustum(left,right,bottom,top,zNear,zFar); 666ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 667ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 668ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glFrustumx( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { 669ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 670ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFrustum(X2F(left),X2F(right),X2F(bottom),X2F(top),X2F(zNear),X2F(zFar)); 671ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 672ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 673ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGenBuffers( GLsizei n, GLuint *buffers) { 674ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 675ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(n<0,GL_INVALID_VALUE); 676ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()) { 677ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i<n ;i++) { 678ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall buffers[i] = ctx->shareGroup()->genName(VERTEXBUFFER, 0, true); 679ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //generating vbo object related to this buffer name 680ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(VERTEXBUFFER,buffers[i],ObjectDataPtr(new GLESbuffer())); 681ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 682ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 683ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 684ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 685ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGenTextures( GLsizei n, GLuint *textures) { 686ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX(); 687ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()) { 688ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i<n ;i++) { 689ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall textures[i] = ctx->shareGroup()->genName(TEXTURE, 0, true); 690ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 691ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 692ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 693ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 694ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetBooleanv( GLenum pname, GLboolean *params) { 695ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 696ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 697ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->glGetBooleanv(pname, params)) 698ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 699ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 700ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 701ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 702ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint i; 703ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 704ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname) 705ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 706ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_FRAMEBUFFER_BINDING_OES: 707ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_BINDING_OES: 708ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 709ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint name; 710ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glGetIntegerv(pname,&name); 711ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = name!=0 ? GL_TRUE: GL_FALSE; 712ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 713ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 714ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_TEXTURE_GEN_STR_OES: 715ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 716ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLboolean state_s = GL_FALSE; 717ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLboolean state_t = GL_FALSE; 718ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLboolean state_r = GL_FALSE; 719ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_S,&state_s); 720ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_T,&state_t); 721ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetBooleanv(GL_TEXTURE_GEN_R,&state_r); 722ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; 723ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 724ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 725ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_NUM_COMPRESSED_TEXTURE_FORMATS: 726ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = (GLboolean)getCompressedFormats(NULL); 727ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 728ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_COMPRESSED_TEXTURE_FORMATS: 729ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 730ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int nparams = getCompressedFormats(NULL); 731ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (nparams>0) { 732ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int * iparams = new int[nparams]; 733ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall getCompressedFormats(iparams); 734ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0; i<nparams; i++) params[i] = (GLboolean)iparams[i]; 735ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall delete [] iparams; 736ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 737ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 738ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 739ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 740ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetBooleanv(pname,params); 741ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 742ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 743ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 744ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetBufferParameteriv( GLenum target, GLenum pname, GLint *params) { 745ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 746ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::bufferTarget(target) && GLEScmValidate::bufferParam(pname)),GL_INVALID_ENUM); 747ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION); 748ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall bool ret = true; 749ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname) { 750ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_BUFFER_SIZE: 751ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->getBufferSize(target,params); 752ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 753ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_BUFFER_USAGE: 754ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->getBufferUsage(target,params); 755ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 756ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 757ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 758ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 759ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 760ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetClipPlanef( GLenum pname, GLfloat eqn[4]) { 761ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 762ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLdouble tmpEqn[4]; 763ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 764ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetClipPlane(pname,tmpEqn); 765ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i =0 ;i < 4; i++){ 766ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall eqn[i] = static_cast<GLfloat>(tmpEqn[i]); 767ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 768ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 769ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 770ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetClipPlanex( GLenum pname, GLfixed eqn[4]) { 771ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 772ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLdouble tmpEqn[4]; 773ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 774ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetClipPlane(pname,tmpEqn); 775ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i =0 ;i < 4; i++){ 776ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall eqn[i] = F2X(tmpEqn[i]); 777ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 778ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 779ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 780ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetFixedv( GLenum pname, GLfixed *params) { 781ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 782ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 783ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->glGetFixedv(pname, params)) 784ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 785ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 786ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 787ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 788ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall size_t nParams = glParamSize(pname); 789ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat fParams[16]; 790ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint i; 791ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 792ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname) 793ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 794ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_FRAMEBUFFER_BINDING_OES: 795ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_BINDING_OES: 796ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_TEXTURE_GEN_STR_OES: 797ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glGetFloatv(pname,&fParams[0]); 798ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 799ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_NUM_COMPRESSED_TEXTURE_FORMATS: 800ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = I2X(getCompressedFormats(NULL)); 801ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 802ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 803ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_COMPRESSED_TEXTURE_FORMATS: 804ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 805ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int nparams = getCompressedFormats(NULL); 806ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (nparams>0) { 807ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int * iparams = new int[nparams]; 808ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall getCompressedFormats(iparams); 809ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0; i<nparams; i++) params[i] = I2X(iparams[i]); 810ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall delete [] iparams; 811ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 812ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 813ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 814ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 815ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 816ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetFloatv(pname,fParams); 817ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 818ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 819ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (nParams) 820ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 821ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(size_t i =0 ; i < nParams;i++) { 822ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[i] = F2X(fParams[i]); 823ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 824ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 825ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 826ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 827ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetFloatv( GLenum pname, GLfloat *params) { 828ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 829ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 830ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->glGetFloatv(pname, params)) 831ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 832ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 833ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 834ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 835ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint i; 836ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 837ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch (pname) { 838ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_FRAMEBUFFER_BINDING_OES: 839ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_BINDING_OES: 840ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_TEXTURE_GEN_STR_OES: 841ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glGetIntegerv(pname,&i); 842ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = (GLfloat)i; 843ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 844ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_NUM_COMPRESSED_TEXTURE_FORMATS: 845ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = (GLfloat)getCompressedFormats(NULL); 846ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 847ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_COMPRESSED_TEXTURE_FORMATS: 848ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 849ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int nparams = getCompressedFormats(NULL); 850ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (nparams>0) { 851ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int * iparams = new int[nparams]; 852ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall getCompressedFormats(iparams); 853ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0; i<nparams; i++) params[i] = (GLfloat)iparams[i]; 854ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall delete [] iparams; 855ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 856ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 857ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 858ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 859ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetFloatv(pname,params); 860ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 861ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 862ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 863ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetIntegerv( GLenum pname, GLint *params) { 864ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 865ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 866ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->glGetIntegerv(pname, params)) 867ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 868ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 869ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 870ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 871ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint i; 872ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat f; 873ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 874ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname) 875ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 876ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_TEXTURE_GEN_STR_OES: 877ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(GL_TEXTURE_GEN_S,¶ms[0]); 878ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 879ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_FRAMEBUFFER_BINDING_OES: 880ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()) { 881ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(pname,&i); 882ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = ctx->shareGroup()->getLocalName(FRAMEBUFFER,i); 883ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 884ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 885ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_BINDING_OES: 886ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()) { 887ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(pname,&i); 888ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = ctx->shareGroup()->getLocalName(RENDERBUFFER,i); 889ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 890ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 891ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_NUM_COMPRESSED_TEXTURE_FORMATS: 892ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = getCompressedFormats(NULL); 893ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 894ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_COMPRESSED_TEXTURE_FORMATS: 895ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall getCompressedFormats(params); 896ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 897ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_MAX_CLIP_PLANES: 898ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(pname,params); 899ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(*params > 6) 900ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 901ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // GLES spec requires only 6, and the ATI driver erronously 902ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // returns 8 (although it supports only 6). This WAR is simple, 903ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // compliant and good enough for developers. 904ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = 6; 905ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 906ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 907ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_ALPHA_TEST_REF: 908ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Both the ATI and nVidia OpenGL drivers return the wrong answer 909ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // here. So return the right one. 910ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetFloatv(pname,&f); 911ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = (int)(f * (float)0x7fffffff); 912ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 913ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: 914ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(pname,params); 915ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(*params > 16) 916ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 917ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // GLES spec requires only 2, and the ATI driver erronously 918ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // returns 32 (although it supports only 16). This WAR is simple, 919ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // compliant and good enough for developers. 920ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = 16; 921ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 922ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 923ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 924ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 925ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(pname,params); 926ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 927ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 928ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 929ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetLightfv( GLenum light, GLenum pname, GLfloat *params) { 930ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 931ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetLightfv(light,pname,params); 932ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 933ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 934ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetLightxv( GLenum light, GLenum pname, GLfixed *params) { 935ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 936ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 937ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 938ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetLightfv(light,pname,tmpParams); 939ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch (pname){ 940ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_AMBIENT: 941ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_DIFFUSE: 942ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPECULAR: 943ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_POSITION: 944ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[3] = F2X(tmpParams[3]); 945ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_DIRECTION: 946ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[2] = F2X(tmpParams[2]); 947ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_EXPONENT: 948ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_CUTOFF: 949ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_CONSTANT_ATTENUATION: 950ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_LINEAR_ATTENUATION: 951ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_QUADRATIC_ATTENUATION: 952ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[1] = F2X(tmpParams[1]); 953ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 954ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default:{ 955ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setGLerror(GL_INVALID_ENUM); 956ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 957ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 958ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 959ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 960ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[0] = F2X(tmpParams[0]); 961ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 962ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 963ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params) { 964ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 965ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetMaterialfv(face,pname,params); 966ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 967ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 968ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetMaterialxv( GLenum face, GLenum pname, GLfixed *params) { 969ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 970ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 971ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetMaterialfv(face,pname,tmpParams); 972ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname){ 973ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_AMBIENT: 974ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_DIFFUSE: 975ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPECULAR: 976ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_EMISSION: 977ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_AMBIENT_AND_DIFFUSE: 978ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[3] = tmpParams[3]; 979ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[2] = tmpParams[2]; 980ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[1] = tmpParams[1]; 981ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SHININESS: 982ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[0] = tmpParams[0]; 983ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 984ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default:{ 985ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setGLerror(GL_INVALID_ENUM); 986ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 987ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 988ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 989ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 990ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 991ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetPointerv( GLenum pname, void **params) { 992ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 993ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall const GLESpointer* p = ctx->getPointer(pname); 994ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(p) { 995ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(p->isVBO()) 996ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 997ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = (void*)(p->getBufferOffset()); 998ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall }else{ 999ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = const_cast<void *>( p->getArrayData()); 1000ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1001ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else { 1002ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setGLerror(GL_INVALID_ENUM); 1003ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1004ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1005ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1006ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1007ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexEnvfv( GLenum env, GLenum pname, GLfloat *params) { 1008ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1009ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexEnvfv(env,pname,params); 1010ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1011ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1012ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexEnviv( GLenum env, GLenum pname, GLint *params) { 1013ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1014ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexEnviv(env,pname,params); 1015ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1016ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1017ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexEnvxv( GLenum env, GLenum pname, GLfixed *params) { 1018ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1019ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 1020ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1021ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexEnvfv(env,pname,tmpParams); 1022ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(pname == GL_TEXTURE_ENV_MODE) { 1023ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[0] = static_cast<GLfixed>(tmpParams[0]); 1024ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else { 1025ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0 ; i < 4 ; i++) 1026ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[i] = F2X(tmpParams[i]); 1027ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1028ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1029ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1030ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params) { 1031ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1032ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1033ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1034ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1035ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1036ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[i] = texData->crop_rect[i]; 1037ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1038ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1039ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexParameterfv(target,pname,params); 1040ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1041ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1042ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1043ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexParameteriv( GLenum target, GLenum pname, GLint *params) { 1044ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1045ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1046ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1047ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1048ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1049ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[i] = texData->crop_rect[i]; 1050ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1051ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1052ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexParameteriv(target,pname,params); 1053ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1054ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1055ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1056ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexParameterxv( GLenum target, GLenum pname, GLfixed *params) { 1057ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1058ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1059ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1060ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1061ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1062ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[i] = F2X(texData->crop_rect[i]); 1063ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1064ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1065ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParam; 1066ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexParameterfv(target,pname,&tmpParam); 1067ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[0] = static_cast<GLfixed>(tmpParam); 1068ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1069ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1070ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1071ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glHint( GLenum target, GLenum mode) { 1072ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1073ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::hintTargetMode(target,mode),GL_INVALID_ENUM); 1074ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glHint(target,mode); 1075ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1076ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1077ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightModelf( GLenum pname, GLfloat param) { 1078ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1079ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightModelf(pname,param); 1080ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1081ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1082ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightModelfv( GLenum pname, const GLfloat *params) { 1083ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1084ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightModelfv(pname,params); 1085ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1086ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1087ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightModelx( GLenum pname, GLfixed param) { 1088ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1089ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParam = static_cast<GLfloat>(param); 1090ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightModelf(pname,tmpParam); 1091ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1092ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1093ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightModelxv( GLenum pname, const GLfixed *params) { 1094ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1095ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 1096ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(pname == GL_LIGHT_MODEL_TWO_SIDE) { 1097ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[0] = X2F(params[0]); 1098ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else if (pname == GL_LIGHT_MODEL_AMBIENT) { 1099ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0;i<4;i++) { 1100ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[i] = X2F(params[i]); 1101ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1102ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1103ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1104ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightModelfv(pname,tmpParams); 1105ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1106ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1107ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightf( GLenum light, GLenum pname, GLfloat param) { 1108ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1109ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightf(light,pname,param); 1110ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1111ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1112ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightfv( GLenum light, GLenum pname, const GLfloat *params) { 1113ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1114ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightfv(light,pname,params); 1115ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1116ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1117ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightx( GLenum light, GLenum pname, GLfixed param) { 1118ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1119ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightf(light,pname,X2F(param)); 1120ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1121ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1122ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLightxv( GLenum light, GLenum pname, const GLfixed *params) { 1123ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1124ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 1125ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1126ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch (pname) { 1127ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_AMBIENT: 1128ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_DIFFUSE: 1129ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPECULAR: 1130ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_EMISSION: 1131ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_POSITION: 1132ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[3] = X2F(params[3]); 1133ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_DIRECTION: 1134ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[2] = X2F(params[2]); 1135ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[1] = X2F(params[1]); 1136ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_EXPONENT: 1137ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_SPOT_CUTOFF: 1138ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_CONSTANT_ATTENUATION: 1139ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_LINEAR_ATTENUATION: 1140ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_QUADRATIC_ATTENUATION: 1141ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[0] = X2F(params[0]); 1142ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1143ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: { 1144ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setGLerror(GL_INVALID_ENUM); 1145ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1146ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1147ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1148ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLightfv(light,pname,tmpParams); 1149ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1150ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1151ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLineWidth( GLfloat width) { 1152ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1153ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLineWidth(width); 1154ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1155ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1156ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLineWidthx( GLfixed width) { 1157ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1158ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLineWidth(X2F(width)); 1159ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1160ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1161ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLoadIdentity( void) { 1162ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1163ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadIdentity(); 1164ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1165ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1166ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLoadMatrixf( const GLfloat *m) { 1167ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1168ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadMatrixf(m); 1169ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1170ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1171ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLoadMatrixx( const GLfixed *m) { 1172ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1173ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat mat[16]; 1174ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i< 16 ; i++) { 1175ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall mat[i] = X2F(m[i]); 1176ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1177ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadMatrixf(mat); 1178ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1179ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1180ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLogicOp( GLenum opcode) { 1181ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1182ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLogicOp(opcode); 1183ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1184ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1185ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param) { 1186ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1187ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMaterialf(face,pname,param); 1188ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1189ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1190ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params) { 1191ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1192ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMaterialfv(face,pname,params); 1193ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1194ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1195ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMaterialx( GLenum face, GLenum pname, GLfixed param) { 1196ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1197ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMaterialf(face,pname,X2F(param)); 1198ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1199ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1200ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMaterialxv( GLenum face, GLenum pname, const GLfixed *params) { 1201ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1202ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 1203ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1204ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i< 4; i++) { 1205ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[i] = X2F(params[i]); 1206ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1207ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMaterialfv(face,pname,tmpParams); 1208ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1209ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1210ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMatrixMode( GLenum mode) { 1211ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1212ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(mode); 1213ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1214ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1215ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMultMatrixf( const GLfloat *m) { 1216ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1217ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMultMatrixf(m); 1218ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1219ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1220ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMultMatrixx( const GLfixed *m) { 1221ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1222ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat mat[16]; 1223ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i< 16 ; i++) { 1224ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall mat[i] = X2F(m[i]); 1225ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1226ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMultMatrixf(mat); 1227ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1228ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1229ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { 1230ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 1231ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureEnum(target,ctx->getMaxTexUnits()),GL_INVALID_ENUM); 1232ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMultiTexCoord4f(target,s,t,r,q); 1233ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1234ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1235ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMultiTexCoord4x( GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { 1236ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_CM() 1237ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureEnum(target,ctx->getMaxTexUnits()),GL_INVALID_ENUM); 1238ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMultiTexCoord4f(target,X2F(s),X2F(t),X2F(r),X2F(q)); 1239ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1240ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1241ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz) { 1242ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1243ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glNormal3f(nx,ny,nz); 1244ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1245ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1246ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glNormal3x( GLfixed nx, GLfixed ny, GLfixed nz) { 1247ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1248ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glNormal3f(X2F(nx),X2F(ny),X2F(nz)); 1249ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1250ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1251ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer) { 1252ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1253ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(stride < 0,GL_INVALID_VALUE); 1254ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::normalPointerType(type),GL_INVALID_ENUM); 1255ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setPointer(GL_NORMAL_ARRAY,3,type,stride,pointer);//3 normal verctor 1256ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1257ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1258ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glOrthof( GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { 1259ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1260ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glOrtho(left,right,bottom,top,zNear,zFar); 1261ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1262ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1263ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glOrthox( GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { 1264ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1265ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glOrtho(X2F(left),X2F(right),X2F(bottom),X2F(top),X2F(zNear),X2F(zFar)); 1266ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1267ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1268ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPixelStorei( GLenum pname, GLint param) { 1269ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1270ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(pname == GL_PACK_ALIGNMENT || pname == GL_UNPACK_ALIGNMENT),GL_INVALID_ENUM); 1271ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!((param==1)||(param==2)||(param==4)||(param==8)), GL_INVALID_VALUE); 1272ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setUnpackAlignment(param); 1273ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPixelStorei(pname,param); 1274ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1275ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1276ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointParameterf( GLenum pname, GLfloat param) { 1277ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1278ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointParameterf(pname,param); 1279ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1280ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1281ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointParameterfv( GLenum pname, const GLfloat *params) { 1282ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1283ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointParameterfv(pname,params); 1284ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1285ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1286ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointParameterx( GLenum pname, GLfixed param) 1287ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall{ 1288ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1289ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointParameterf(pname,X2F(param)); 1290ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1291ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1292ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointParameterxv( GLenum pname, const GLfixed *params) { 1293ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1294ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1295ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParam = X2F(*params) ; 1296ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointParameterfv(pname,&tmpParam); 1297ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1298ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1299ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointSize( GLfloat size) { 1300ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1301ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointSize(size); 1302ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1303ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1304ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointSizePointerOES( GLenum type, GLsizei stride, const GLvoid *pointer) { 1305ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1306ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(stride < 0,GL_INVALID_VALUE); 1307ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::pointPointerType(type),GL_INVALID_ENUM); 1308ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setPointer(GL_POINT_SIZE_ARRAY_OES,1,type,stride,pointer); 1309ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1310ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1311ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPointSizex( GLfixed size) { 1312ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1313ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPointSize(X2F(size)); 1314ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1315ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1316ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPolygonOffset( GLfloat factor, GLfloat units) { 1317ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1318ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPolygonOffset(factor,units); 1319ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1320ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1321ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPolygonOffsetx( GLfixed factor, GLfixed units) { 1322ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1323ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPolygonOffset(X2F(factor),X2F(units)); 1324ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1325ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1326ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPopMatrix(void) { 1327ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1328ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopMatrix(); 1329ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1330ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1331ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glPushMatrix(void) { 1332ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1333ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushMatrix(); 1334ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1335ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1336ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) { 1337ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1338ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::pixelFrmt(ctx,format) && GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM); 1339ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type)),GL_INVALID_OPERATION); 1340ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1341ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glReadPixels(x,y,width,height,format,type,pixels); 1342ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1343ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1344ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { 1345ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1346ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glRotatef(angle,x,y,z); 1347ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1348ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1349ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glRotatex( GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { 1350ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1351ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glRotatef(angle,X2F(x),X2F(y),X2F(z)); 1352ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1353ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1354ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glSampleCoverage( GLclampf value, GLboolean invert) { 1355ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1356ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glSampleCoverage(value,invert); 1357ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1358ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1359ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glSampleCoveragex( GLclampx value, GLboolean invert) { 1360ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1361ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glSampleCoverage(X2F(value),invert); 1362ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1363ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1364ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z) { 1365ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1366ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glScalef(x,y,z); 1367ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1368ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1369ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glScalex( GLfixed x, GLfixed y, GLfixed z) { 1370ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1371ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glScalef(X2F(x),X2F(y),X2F(z)); 1372ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1373ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1374ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height) { 1375ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1376ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glScissor(x,y,width,height); 1377ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1378ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1379ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glShadeModel( GLenum mode) { 1380ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1381ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glShadeModel(mode); 1382ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1383ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1384ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask) { 1385ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1386ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glStencilFunc(func,ref,mask); 1387ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1388ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1389ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glStencilMask( GLuint mask) { 1390ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1391ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glStencilMask(mask); 1392ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1393ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1394ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass) { 1395ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1396ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::stencilOp(fail) && GLEScmValidate::stencilOp(zfail) && GLEScmValidate::stencilOp(zpass)),GL_INVALID_ENUM); 1397ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glStencilOp(fail,zfail,zpass); 1398ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1399ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1400ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { 1401ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1402ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texCoordPointerParams(size,stride),GL_INVALID_VALUE); 1403ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texCoordPointerType(type),GL_INVALID_ENUM); 1404ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setPointer(GL_TEXTURE_COORD_ARRAY,size,type,stride,pointer); 1405ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1406ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1407ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param) { 1408ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1409ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1410ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnvf(target,pname,param); 1411ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1412ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1413ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params) { 1414ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1415ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1416ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnvfv(target,pname,params); 1417ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1418ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1419ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param) { 1420ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1421ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1422ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnvi(target,pname,param); 1423ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1424ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1425ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params) { 1426ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1427ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1428ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnviv(target,pname,params); 1429ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1430ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1431ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnvx( GLenum target, GLenum pname, GLfixed param) { 1432ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1433ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1434ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParam = static_cast<GLfloat>(param); 1435ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnvf(target,pname,tmpParam); 1436ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1437ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1438ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexEnvxv( GLenum target, GLenum pname, const GLfixed *params) { 1439ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1440ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texEnv(target,pname),GL_INVALID_ENUM); 1441ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1442ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[4]; 1443ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(pname == GL_TEXTURE_ENV_COLOR) { 1444ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i =0;i<4;i++) { 1445ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[i] = X2F(params[i]); 1446ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1447ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } else { 1448ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[0] = static_cast<GLfloat>(params[0]); 1449ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1450ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexEnvfv(target,pname,tmpParams); 1451ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1452ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1453ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { 1454ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1455ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1456ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) && 1457ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLEScmValidate::pixelFrmt(ctx,internalformat) && 1458ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLEScmValidate::pixelFrmt(ctx,format) && 1459ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM); 1460ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1461ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::pixelOp(format,type) && internalformat == ((GLint)format)),GL_INVALID_OPERATION); 1462ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1463ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall bool needAutoMipmap = false; 1464ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1465ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()){ 1466ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1467ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1468ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(texData) { 1469ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->width = width; 1470ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->height = height; 1471ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->border = border; 1472ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->internalFormat = internalformat; 1473ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->target = target; 1474ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1475ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (texData->sourceEGLImage != 0) { 1476ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1477ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // This texture was a target of EGLImage, 1478ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // but now it is re-defined so we need to detach 1479ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // from the EGLImage and re-generate global texture name 1480ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // for it. 1481ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1482ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (texData->eglImageDetach) { 1483ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*texData->eglImageDetach)(texData->sourceEGLImage); 1484ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1485ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int tex = ctx->getBindedTexture(target); 1486ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->replaceGlobalName(TEXTURE, 1487ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tex, 1488ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->oldGlobal); 1489ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, texData->oldGlobal); 1490ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->sourceEGLImage = 0; 1491ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->oldGlobal = 0; 1492ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1493ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1494ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall needAutoMipmap = texData->requiresAutoMipmap; 1495ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1496ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1497ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1498ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexImage2D(target,level, 1499ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall internalformat,width,height, 1500ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall border,format,type,pixels); 1501ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1502ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(needAutoMipmap) 1503ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 1504ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGenerateMipmapEXT(target); 1505ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1506ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1507ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1508ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallstatic bool handleMipmapGeneration(GLenum target, GLenum pname, bool param) 1509ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall{ 1510ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(false) 1511ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1512ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(pname == GL_GENERATE_MIPMAP && !ctx->isAutoMipmapSupported()) 1513ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 1514ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1515ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(texData) 1516ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 1517ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->requiresAutoMipmap = param; 1518ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1519ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return true; 1520ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1521ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1522ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return false; 1523ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1524ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1525ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param) { 1526ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1527ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1528ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1529ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)param)) 1530ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1531ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1532ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameterf(target,pname,param); 1533ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1534ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1535ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameterfv( GLenum target, GLenum pname, const GLfloat *params) { 1536ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1537ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1538ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1539ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)(*params))) 1540ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1541ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1542ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1543ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1544ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1545ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1546ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->crop_rect[i] = params[i]; 1547ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1548ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1549ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameterfv(target,pname,params); 1550ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1551ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1552ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1553ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param) { 1554ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1555ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1556ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1557ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)param)) 1558ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1559ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1560ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameteri(target,pname,param); 1561ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1562ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1563ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameteriv( GLenum target, GLenum pname, const GLint *params) { 1564ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1565ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1566ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1567ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)(*params))) 1568ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1569ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1570ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1571ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1572ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1573ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1574ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->crop_rect[i] = params[i]; 1575ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1576ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1577ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameteriv(target,pname,params); 1578ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1579ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1580ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1581ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameterx( GLenum target, GLenum pname, GLfixed param) { 1582ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1583ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1584ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1585ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)param)) 1586ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1587ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1588ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameterf(target,pname,static_cast<GLfloat>(param)); 1589ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1590ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1591ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexParameterxv( GLenum target, GLenum pname, const GLfixed *params) { 1592ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1593ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texParams(target,pname),GL_INVALID_ENUM); 1594ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1595ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(handleMipmapGeneration(target, pname, (bool)(*params))) 1596ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1597ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1598ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname==GL_TEXTURE_CROP_RECT_OES) { 1599ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1600ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1601ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<4;++i) 1602ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->crop_rect[i] = X2F(params[i]); 1603ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1604ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 1605ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat param = static_cast<GLfloat>(params[0]); 1606ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexParameterfv(target,pname,¶m); 1607ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1608ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1609ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1610ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) { 1611ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1612ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::textureTargetEx(target) && 1613ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLEScmValidate::pixelFrmt(ctx,format)&& 1614ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLEScmValidate::pixelType(ctx,type)),GL_INVALID_ENUM); 1615ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::pixelOp(format,type),GL_INVALID_OPERATION); 1616ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1617ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels); 1618ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1619ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()){ 1620ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1621ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1622ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(texData && texData->requiresAutoMipmap) 1623ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 1624ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGenerateMipmapEXT(target); 1625ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1626ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1627ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1628ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1629ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z) { 1630ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1631ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTranslatef(x,y,z); 1632ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1633ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1634ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTranslatex( GLfixed x, GLfixed y, GLfixed z) { 1635ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1636ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTranslatef(X2F(x),X2F(y),X2F(z)); 1637ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1638ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1639ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { 1640ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1641ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::vertexPointerParams(size,stride),GL_INVALID_VALUE); 1642ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::vertexPointerType(type),GL_INVALID_ENUM); 1643ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setPointer(GL_VERTEX_ARRAY,size,type,stride,pointer); 1644ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1645ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1646ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height) { 1647ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1648ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glViewport(x,y,width,height); 1649ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1650ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1651ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) 1652ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall{ 1653ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX(); 1654ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM); 1655ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); 1656ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); 1657ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (img) { 1658ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Create the texture object in the underlying EGL implementation, 1659ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // flag to the OpenGL layer to skip the image creation and map the 1660ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // current binded texture object to the existing global object. 1661ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()) { 1662ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectLocalName tex = TextureLocalName(target,ctx->getBindedTexture(target)); 1663ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int oldGlobal = ctx->shareGroup()->getGlobalName(TEXTURE, tex); 1664ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Delete old texture object but only if it is not a target of a EGLImage 1665ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (oldGlobal) { 1666ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData* oldTexData = getTextureData(tex); 1667ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!oldTexData || oldTexData->sourceEGLImage == 0) { 1668ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDeleteTextures(1, &oldGlobal); 1669ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1670ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1671ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // replace mapping and bind the new global object 1672ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->replaceGlobalName(TEXTURE, tex,img->globalTexName); 1673ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, img->globalTexName); 1674ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData *texData = getTextureTargetData(target); 1675ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(texData==NULL,GL_INVALID_OPERATION); 1676ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->width = img->width; 1677ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->height = img->height; 1678ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->border = img->border; 1679ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->internalFormat = img->internalFormat; 1680ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->sourceEGLImage = imagehndl; 1681ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->eglImageDetach = s_eglIface->eglDetachEGLImage; 1682ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData->oldGlobal = oldGlobal; 1683ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1684ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1685ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1686ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1687ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) 1688ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall{ 1689ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX(); 1690ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(target != GL_RENDERBUFFER_OES,GL_INVALID_ENUM); 1691ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int imagehndl = ToTargetCompatibleHandle((uintptr_t)image); 1692ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall EglImage *img = s_eglIface->eglAttachEGLImage(imagehndl); 1693ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!img,GL_INVALID_VALUE); 1694ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->shareGroup().Ptr(),GL_INVALID_OPERATION); 1695ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1696ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Get current bounded renderbuffer 1697ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // raise INVALID_OPERATIOn if no renderbuffer is bounded 1698ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint rb = ctx->getRenderbufferBinding(); 1699ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION); 1700ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb); 1701ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RenderbufferData *rbData = (RenderbufferData *)objData.Ptr(); 1702ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!rbData,GL_INVALID_OPERATION); 1703ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1704ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1705ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // flag in the renderbufferData that it is an eglImage target 1706ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1707ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->sourceEGLImage = imagehndl; 1708ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->eglImageDetach = s_eglIface->eglDetachEGLImage; 1709ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->eglImageGlobalTexName = img->globalTexName; 1710ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1711ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1712ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // if the renderbuffer is attached to a framebuffer 1713ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // change the framebuffer attachment in the undelying OpenGL 1714ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // to point to the eglImage texture object. 1715ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1716ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rbData->attachedFB) { 1717ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // update the framebuffer attachment point to the 1718ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // underlying texture of the img 1719ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint prevFB = ctx->getFramebufferBinding(); 1720ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (prevFB != rbData->attachedFB) { 1721ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 1722ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->attachedFB); 1723ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1724ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, 1725ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->attachedPoint, 1726ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GL_TEXTURE_2D, 1727ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall img->globalTexName,0); 1728ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (prevFB != rbData->attachedFB) { 1729ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 1730ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall prevFB); 1731ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1732ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1733ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1734ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1735ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/* GL_OES_blend_subtract*/ 1736ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBlendEquationOES(GLenum mode) { 1737ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1738ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(mode)), GL_INVALID_ENUM); 1739ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBlendEquation(mode); 1740ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1741ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1742ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/* GL_OES_blend_equation_separate */ 1743ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha) { 1744ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1745ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(GLEScmValidate::blendEquationMode(modeRGB) && GLEScmValidate::blendEquationMode(modeAlpha)), GL_INVALID_ENUM); 1746ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBlendEquationSeparate(modeRGB,modeAlpha); 1747ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1748ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1749ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/* GL_OES_blend_func_separate */ 1750ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { 1751ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1752ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::blendSrc(srcRGB) || !GLEScmValidate::blendDst(dstRGB) || 1753ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall !GLEScmValidate::blendSrc(srcAlpha) || ! GLEScmValidate::blendDst(dstAlpha) ,GL_INVALID_ENUM); 1754ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha); 1755ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1756ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1757ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall/* GL_OES_framebuffer_object */ 1758ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer) { 1759ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(GL_FALSE) 1760ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE); 1761ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(renderbuffer && ctx->shareGroup().Ptr()){ 1762ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->shareGroup()->isObject(RENDERBUFFER,renderbuffer) ? GL_TRUE :GL_FALSE; 1763ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1764ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->dispatcher().glIsRenderbufferEXT(renderbuffer); 1765ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1766ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1767ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer) { 1768ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1769ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1770ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target),GL_INVALID_ENUM); 1771ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1772ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //if buffer wasn't generated before,generate one 1773ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(renderbuffer && ctx->shareGroup().Ptr() && !ctx->shareGroup()->isObject(RENDERBUFFER,renderbuffer)){ 1774ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(RENDERBUFFER,renderbuffer); 1775ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(RENDERBUFFER, 1776ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall renderbuffer, 1777ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr(new RenderbufferData())); 1778ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1779ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1780ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int globalBufferName = (renderbuffer != 0) ? ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffer) : 0; 1781ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindRenderbufferEXT(target,globalBufferName); 1782ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1783ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // update renderbuffer binding state 1784ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setRenderbufferBinding(renderbuffer); 1785ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1786ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1787ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers) { 1788ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1789ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1790ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<n;++i) { 1791ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint globalBufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffers[i]); 1792ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDeleteRenderbuffersEXT(1,&globalBufferName); 1793ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1794ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1795ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1796ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers) { 1797ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1798ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1799ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(n<0,GL_INVALID_VALUE); 1800ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(ctx->shareGroup().Ptr()) { 1801ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for(int i=0; i<n ;i++) { 1802ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall renderbuffers[i] = ctx->shareGroup()->genName(RENDERBUFFER, 0, true); 1803ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(RENDERBUFFER, 1804ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall renderbuffers[i], 1805ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr(new RenderbufferData())); 1806ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1807ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1808ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1809ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1810ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height){ 1811ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1812ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1813ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferInternalFrmt(ctx,internalformat) ,GL_INVALID_ENUM); 1814ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (internalformat==GL_RGB565_OES) //RGB565 not supported by GL 1815ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall internalformat = GL_RGB8_OES; 1816ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1817ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Get current bounded renderbuffer 1818ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // raise INVALID_OPERATIOn if no renderbuffer is bounded 1819ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint rb = ctx->getRenderbufferBinding(); 1820ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(rb == 0,GL_INVALID_OPERATION); 1821ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb); 1822ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RenderbufferData *rbData = (RenderbufferData *)objData.Ptr(); 1823ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!rbData,GL_INVALID_OPERATION); 1824ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1825ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1826ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // if the renderbuffer was an eglImage target, detach from 1827ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // the eglImage. 1828ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1829ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rbData->sourceEGLImage != 0) { 1830ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rbData->eglImageDetach) { 1831ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall (*rbData->eglImageDetach)(rbData->sourceEGLImage); 1832ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1833ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->sourceEGLImage = 0; 1834ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->eglImageGlobalTexName = 0; 1835ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1836ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1837ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glRenderbufferStorageEXT(target,internalformat,width,height); 1838ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1839ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1840ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) { 1841ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1842ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1843ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::renderbufferTarget(target) || !GLEScmValidate::renderbufferParams(pname) ,GL_INVALID_ENUM); 1844ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1845ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1846ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // If this is a renderbuffer which is eglimage's target, we 1847ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // should query the underlying eglimage's texture object instead. 1848ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 1849ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint rb = ctx->getRenderbufferBinding(); 1850ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rb) { 1851ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(RENDERBUFFER,rb); 1852ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RenderbufferData *rbData = (RenderbufferData *)objData.Ptr(); 1853ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rbData && rbData->sourceEGLImage != 0) { 1854ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLenum texPname; 1855ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall switch(pname) { 1856ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_WIDTH_OES: 1857ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_WIDTH; 1858ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1859ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_HEIGHT_OES: 1860ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_HEIGHT; 1861ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1862ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_INTERNAL_FORMAT_OES: 1863ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_INTERNAL_FORMAT; 1864ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1865ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_RED_SIZE_OES: 1866ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_RED_SIZE; 1867ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1868ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_GREEN_SIZE_OES: 1869ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_GREEN_SIZE; 1870ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1871ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_BLUE_SIZE_OES: 1872ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_BLUE_SIZE; 1873ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1874ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_ALPHA_SIZE_OES: 1875ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_ALPHA_SIZE; 1876ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1877ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_DEPTH_SIZE_OES: 1878ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname = GL_TEXTURE_DEPTH_SIZE; 1879ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1880ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall case GL_RENDERBUFFER_STENCIL_SIZE_OES: 1881ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall default: 1882ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = 0; //XXX 1883ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1884ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall break; 1885ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1886ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1887ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint prevTex; 1888ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(GL_TEXTURE_BINDING_2D, &prevTex); 1889ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, 1890ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->eglImageGlobalTexName); 1891ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, 1892ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texPname, 1893ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params); 1894ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindTexture(GL_TEXTURE_2D, prevTex); 1895ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 1896ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1897ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1898ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1899ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetRenderbufferParameterivEXT(target,pname,params); 1900ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1901ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1902ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLboolean GLAPIENTRY glIsFramebufferOES(GLuint framebuffer) { 1903ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(GL_FALSE) 1904ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,GL_FALSE); 1905ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (framebuffer && ctx->shareGroup().Ptr()) { 1906ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->shareGroup()->isObject(FRAMEBUFFER,framebuffer) ? GL_TRUE : GL_FALSE; 1907ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1908ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->dispatcher().glIsFramebufferEXT(framebuffer); 1909ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1910ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1911ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer) { 1912ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1913ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1914ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM); 1915ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (framebuffer && ctx->shareGroup().Ptr() && !ctx->shareGroup()->isObject(FRAMEBUFFER,framebuffer)) { 1916ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(FRAMEBUFFER,framebuffer); 1917ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(FRAMEBUFFER, framebuffer, 1918ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr(new FramebufferData(framebuffer))); 1919ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1920ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int globalBufferName = (framebuffer!=0) ? ctx->shareGroup()->getGlobalName(FRAMEBUFFER,framebuffer) : 0; 1921ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindFramebufferEXT(target,globalBufferName); 1922ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1923ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // update framebuffer binding state 1924ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->setFramebufferBinding(framebuffer); 1925ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1926ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1927ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers) { 1928ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1929ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1930ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<n;++i) { 1931ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint globalBufferName = ctx->shareGroup()->getGlobalName(FRAMEBUFFER,framebuffers[i]); 1932ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDeleteFramebuffersEXT(1,&globalBufferName); 1933ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1934ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1935ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1936ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glGenFramebuffersOES(GLsizei n, GLuint *framebuffers) { 1937ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1938ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1939ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(n<0,GL_INVALID_VALUE); 1940ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->shareGroup().Ptr()) { 1941ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<n;i++) { 1942ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall framebuffers[i] = ctx->shareGroup()->genName(FRAMEBUFFER, 0, true); 1943ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(FRAMEBUFFER, framebuffers[i], 1944ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr(new FramebufferData(framebuffers[i]))); 1945ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1946ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1947ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1948ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1949ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API GLenum GLAPIENTRY glCheckFramebufferStatusOES(GLenum target) { 1950ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX_RET(0) 1951ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION,0); 1952ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RET_AND_SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) ,GL_INVALID_ENUM,0); 1953ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return ctx->dispatcher().glCheckFramebufferStatusEXT(target); 1954ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1955ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1956ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { 1957ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1958ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1959ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) || 1960ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall !GLEScmValidate::textureTargetEx(textarget),GL_INVALID_ENUM); 1961ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->shareGroup().Ptr(), GL_INVALID_OPERATION); 1962ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1963ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint globalTexName = 0; 1964ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if(texture) { 1965ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!ctx->shareGroup()->isObject(TEXTURE,texture)) { 1966ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(TEXTURE,texture); 1967ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1968ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectLocalName texname = TextureLocalName(textarget,texture); 1969ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall globalTexName = ctx->shareGroup()->getGlobalName(TEXTURE,texname); 1970ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1971ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1972ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFramebufferTexture2DEXT(target,attachment,textarget,globalTexName,level); 1973ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1974ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Update the the current framebuffer object attachment state 1975ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint fbName = ctx->getFramebufferBinding(); 1976ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName); 1977ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (fbObj.Ptr() != NULL) { 1978ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall FramebufferData *fbData = (FramebufferData *)fbObj.Ptr(); 1979ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall fbData->setAttachment(attachment, textarget, 1980ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texture, ObjectDataPtr(NULL)); 1981ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 1982ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 1983ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1984ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glFramebufferRenderbufferOES(GLenum target, GLenum attachment,GLenum renderbuffertarget, GLuint renderbuffer) { 1985ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 1986ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 1987ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || 1988ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall !GLEScmValidate::framebufferAttachment(attachment) || 1989ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall !GLEScmValidate::renderbufferTarget(renderbuffertarget), GL_INVALID_ENUM); 1990ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1991ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->shareGroup().Ptr(), GL_INVALID_OPERATION); 1992ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1993ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint globalBufferName = 0; 1994ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr obj; 1995ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 1996ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // generate the renderbuffer object if not yet exist 1997ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (renderbuffer) { 1998ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (!ctx->shareGroup()->isObject(RENDERBUFFER,renderbuffer)) { 1999ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->genName(RENDERBUFFER,renderbuffer); 2000ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall obj = ObjectDataPtr(new RenderbufferData()); 2001ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->shareGroup()->setObjectData(RENDERBUFFER, 2002ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall renderbuffer, 2003ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr(new RenderbufferData())); 2004ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2005ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else { 2006ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall obj = ctx->shareGroup()->getObjectData(RENDERBUFFER,renderbuffer); 2007ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2008ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall globalBufferName = ctx->shareGroup()->getGlobalName(RENDERBUFFER,renderbuffer); 2009ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2010ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2011ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Update the the current framebuffer object attachment state 2012ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint fbName = ctx->getFramebufferBinding(); 2013ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName); 2014ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (fbObj.Ptr() != NULL) { 2015ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall FramebufferData *fbData = (FramebufferData *)fbObj.Ptr(); 2016ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall fbData->setAttachment(attachment, renderbuffertarget, renderbuffer, obj); 2017ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2018ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2019ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (renderbuffer && obj.Ptr() != NULL) { 2020ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall RenderbufferData *rbData = (RenderbufferData *)obj.Ptr(); 2021ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (rbData->sourceEGLImage != 0) { 2022ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 2023ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // This renderbuffer object is an eglImage target 2024ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // attach the eglimage's texture instead the renderbuffer. 2025ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 2026ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFramebufferTexture2DEXT(target, 2027ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall attachment, 2028ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GL_TEXTURE_2D, 2029ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall rbData->eglImageGlobalTexName,0); 2030ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 2031ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2032ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2033ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2034ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glFramebufferRenderbufferEXT(target,attachment,renderbuffertarget,globalBufferName); 2035ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2036ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2037ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GLAPIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params) { 2038ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2039ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 2040ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::framebufferTarget(target) || !GLEScmValidate::framebufferAttachment(attachment) || 2041ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall !GLEScmValidate::framebufferAttachmentParams(pname), GL_INVALID_ENUM); 2042ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2043ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 2044ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // Take the attachment attribute from our state - if available 2045ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall // 2046ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint fbName = ctx->getFramebufferBinding(); 2047ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (fbName) { 2048ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr fbObj = ctx->shareGroup()->getObjectData(FRAMEBUFFER,fbName); 2049ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (fbObj.Ptr() != NULL) { 2050ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall FramebufferData *fbData = (FramebufferData *)fbObj.Ptr(); 2051ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLenum target; 2052ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLuint name = fbData->getAttachment(attachment, &target, NULL); 2053ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES) { 2054ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = target; 2055ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 2056ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2057ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES) { 2058ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = name; 2059ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall return; 2060ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2061ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2062ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2063ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2064ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetFramebufferAttachmentParameterivEXT(target,attachment,pname,params); 2065ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2066ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2067ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGenerateMipmapOES(GLenum target) { 2068ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2069ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!ctx->getCaps()->GL_EXT_FRAMEBUFFER_OBJECT,GL_INVALID_OPERATION); 2070ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::textureTargetLimited(target),GL_INVALID_ENUM); 2071ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGenerateMipmapEXT(target); 2072ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2073ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2074ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glCurrentPaletteMatrixOES(GLuint index) { 2075ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2076ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION); 2077ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glCurrentPaletteMatrixARB(index); 2078ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2079ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2080ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES() { 2081ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2082ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION); 2083ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint matrix[16]; 2084ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(GL_MODELVIEW_MATRIX,matrix); 2085ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixIndexuivARB(1,(GLuint*)matrix); 2086ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2087ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2088ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2089ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { 2090ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2091ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION); 2092ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixIndexPointerARB(size,type,stride,pointer); 2093ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2094ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2095ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { 2096ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2097ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!(ctx->getCaps()->GL_ARB_MATRIX_PALETTE && ctx->getCaps()->GL_ARB_VERTEX_BLEND),GL_INVALID_OPERATION); 2098ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glWeightPointerARB(size,type,stride,pointer); 2099ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2100ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2101ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2102ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param) { 2103ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2104ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2105ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2106ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_S,pname,param); 2107ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_T,pname,param); 2108ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_R,pname,param); 2109ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2110ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2111ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(coord,pname,param); 2112ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2113ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2114ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params) { 2115ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2116ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2117ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2118ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_S,pname,params); 2119ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_T,pname,params); 2120ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_R,pname,params); 2121ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2122ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2123ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(coord,pname,params); 2124ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2125ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param) { 2126ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2127ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2128ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2129ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeni(GL_S,pname,param); 2130ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeni(GL_T,pname,param); 2131ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeni(GL_R,pname,param); 2132ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2133ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2134ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeni(coord,pname,param); 2135ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2136ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params) { 2137ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2138ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2139ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2140ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeniv(GL_S,pname,params); 2141ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeniv(GL_T,pname,params); 2142ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeniv(GL_R,pname,params); 2143ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2144ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2145ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGeniv(coord,pname,params); 2146ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2147ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param) { 2148ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2149ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2150ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2151ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_S,pname,X2F(param)); 2152ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_T,pname,X2F(param)); 2153ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(GL_R,pname,X2F(param)); 2154ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2155ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2156ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenf(coord,pname,X2F(param)); 2157ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2158ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params) { 2159ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[1]; 2160ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2161ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF(!GLEScmValidate::texGen(coord,pname),GL_INVALID_ENUM); 2162ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[0] = X2F(params[0]); 2163ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) { 2164ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_S,pname,tmpParams); 2165ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_T,pname,tmpParams); 2166ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(GL_R,pname,tmpParams); 2167ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2168ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2169ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexGenfv(coord,pname,tmpParams); 2170ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2171ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2172ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params) { 2173ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2174ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) 2175ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 2176ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_s = GL_FALSE; 2177ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_t = GL_FALSE; 2178ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_r = GL_FALSE; 2179ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_S,pname,&state_s); 2180ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_T,pname,&state_t); 2181ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_R,pname,&state_r); 2182ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; 2183ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2184ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2185ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(coord,pname,params); 2186ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2187ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2188ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params) { 2189ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2190ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) 2191ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 2192ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint state_s = GL_FALSE; 2193ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint state_t = GL_FALSE; 2194ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint state_r = GL_FALSE; 2195ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGeniv(GL_S,pname,&state_s); 2196ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGeniv(GL_T,pname,&state_t); 2197ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGeniv(GL_R,pname,&state_r); 2198ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall *params = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; 2199ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2200ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2201ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGeniv(coord,pname,params); 2202ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2203ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2204ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params) { 2205ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2206ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat tmpParams[1]; 2207ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2208ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (coord == GL_TEXTURE_GEN_STR_OES) 2209ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall { 2210ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_s = GL_FALSE; 2211ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_t = GL_FALSE; 2212ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat state_r = GL_FALSE; 2213ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_S,pname,&state_s); 2214ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_T,pname,&state_t); 2215ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(GL_TEXTURE_GEN_R,pname,&state_r); 2216ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall tmpParams[0] = state_s && state_t && state_r ? GL_TRUE: GL_FALSE; 2217ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2218ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall else 2219ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetTexGenfv(coord,pname,tmpParams); 2220ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2221ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall params[0] = F2X(tmpParams[1]); 2222ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2223ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2224ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Halltemplate <class T, GLenum TypeName> 2225ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hallvoid glDrawTexOES (T x, T y, T z, T width, T height) { 2226ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GET_CTX() 2227ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2228ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall SET_ERROR_IF((width<=0 || height<=0),GL_INVALID_VALUE); 2229ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2230ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->drawValidate(); 2231ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2232ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int numClipPlanes; 2233ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2234ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLint viewport[4]; 2235ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall z = (z>1 ? 1 : (z<0 ? 0 : z)); 2236ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2237ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall T vertices[4*3] = {x , y, z, 2238ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall x , y+height, z, 2239ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall x+width, y+height, z, 2240ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall x+width, y, z}; 2241ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall GLfloat texels[ctx->getMaxTexUnits()][4*2]; 2242ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall memset((void*)texels, 0, ctx->getMaxTexUnits()*4*2*sizeof(GLfloat)); 2243ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2244ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); 2245ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushAttrib(GL_TRANSFORM_BIT); 2246ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2247ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //setup projection matrix to draw in viewport aligned coordinates 2248ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_PROJECTION); 2249ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushMatrix(); 2250ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadIdentity(); 2251ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(GL_VIEWPORT,viewport); 2252ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glOrtho(viewport[0],viewport[0] + viewport[2],viewport[1],viewport[1]+viewport[3],0,-1); 2253ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //setup texture matrix 2254ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_TEXTURE); 2255ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushMatrix(); 2256ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadIdentity(); 2257ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //setup modelview matrix 2258ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_MODELVIEW); 2259ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPushMatrix(); 2260ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glLoadIdentity(); 2261ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //backup vbo's 2262ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int array_buffer,element_array_buffer; 2263ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glGetIntegerv(GL_ARRAY_BUFFER_BINDING,&array_buffer); 2264ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING,&element_array_buffer); 2265ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,0); 2266ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); 2267ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2268ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //disable clip planes 2269ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glGetIntegerv(GL_MAX_CLIP_PLANES,&numClipPlanes); 2270ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<numClipPlanes;++i) 2271ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDisable(GL_CLIP_PLANE0+i); 2272ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2273ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall int nTexPtrs = 0; 2274ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall for (int i=0;i<ctx->getMaxTexUnits();++i) { 2275ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (ctx->isTextureUnitEnabled(GL_TEXTURE0+i)) { 2276ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall TextureData * texData = NULL; 2277ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall unsigned int texname = ctx->getBindedTexture(GL_TEXTURE0+i,GL_TEXTURE_2D); 2278ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectLocalName tex = TextureLocalName(GL_TEXTURE_2D,texname); 2279ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glClientActiveTexture(GL_TEXTURE0+i); 2280ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ObjectDataPtr objData = ctx->shareGroup()->getObjectData(TEXTURE,tex); 2281ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (objData.Ptr()) { 2282ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texData = (TextureData*)objData.Ptr(); 2283ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //calculate texels 2284ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][0] = (float)(texData->crop_rect[0])/(float)(texData->width); 2285ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][1] = (float)(texData->crop_rect[1])/(float)(texData->height); 2286ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2287ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][2] = (float)(texData->crop_rect[0])/(float)(texData->width); 2288ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][3] = (float)(texData->crop_rect[3]+texData->crop_rect[1])/(float)(texData->height); 2289ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2290ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][4] = (float)(texData->crop_rect[2]+texData->crop_rect[0])/(float)(texData->width); 2291ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][5] = (float)(texData->crop_rect[3]+texData->crop_rect[1])/(float)(texData->height); 2292ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2293ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][6] = (float)(texData->crop_rect[2]+texData->crop_rect[0])/(float)(texData->width); 2294ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall texels[i][7] = (float)(texData->crop_rect[1])/(float)(texData->height); 2295ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2296ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glTexCoordPointer(2,GL_FLOAT,0,texels[i]); 2297ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall nTexPtrs++; 2298ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2299ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2300ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2301ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2302ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall if (nTexPtrs>0) { 2303ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //draw rectangle - only if we have some textures enabled & ready 2304ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnableClientState(GL_VERTEX_ARRAY); 2305ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glVertexPointer(3,TypeName,0,vertices); 2306ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glEnableClientState(GL_TEXTURE_COORD_ARRAY); 2307ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glDrawArrays(GL_TRIANGLE_FAN,0,4); 2308ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall } 2309ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2310ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //restore vbo's 2311ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindBuffer(GL_ARRAY_BUFFER,array_buffer); 2312ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,element_array_buffer); 2313ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2314ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall //restore matrix state 2315ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2316ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_MODELVIEW); 2317ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopMatrix(); 2318ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_TEXTURE); 2319ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopMatrix(); 2320ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glMatrixMode(GL_PROJECTION); 2321ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopMatrix(); 2322ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2323ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopAttrib(); 2324ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall ctx->dispatcher().glPopClientAttrib(); 2325ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2326ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2327ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) { 2328ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLshort,GL_SHORT>(x,y,z,width,height); 2329ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2330ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2331ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height) { 2332ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLint,GL_INT>(x,y,z,width,height); 2333ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2334ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2335ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) { 2336ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLfloat,GL_FLOAT>(x,y,z,width,height); 2337ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2338ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2339ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) { 2340ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLfloat,GL_FLOAT>(X2F(x),X2F(y),X2F(z),X2F(width),X2F(height)); 2341ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2342ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2343ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexsvOES (const GLshort * coords) { 2344ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLshort,GL_SHORT>(coords[0],coords[1],coords[2],coords[3],coords[4]); 2345ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2346ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2347ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexivOES (const GLint * coords) { 2348ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLint,GL_INT>(coords[0],coords[1],coords[2],coords[3],coords[4]); 2349ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2350ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2351ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat * coords) { 2352ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLfloat,GL_FLOAT>(coords[0],coords[1],coords[2],coords[3],coords[4]); 2353ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2354ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall 2355ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse HallGL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed * coords) { 2356ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall glDrawTexOES<GLfloat,GL_FLOAT>(X2F(coords[0]),X2F(coords[1]),X2F(coords[2]),X2F(coords[3]),X2F(coords[4])); 2357ce6c3389061fb9fcdefc94fab2044a8e11600b52Jesse Hall} 2358