void LLRender::flush() { if (mCount > 0) { #if 0 if (!glIsEnabled(GL_VERTEX_ARRAY)) { llerrs << "foo 1" << llendl; } if (!glIsEnabled(GL_COLOR_ARRAY)) { llerrs << "foo 2" << llendl; } if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) { llerrs << "foo 3" << llendl; } if (glIsEnabled(GL_NORMAL_ARRAY)) { llerrs << "foo 7" << llendl; } GLvoid* pointer; glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].v)) { llerrs << "foo 4" << llendl; } glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].c)) { llerrs << "foo 5" << llendl; } glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].uv)) { llerrs << "foo 6" << llendl; } #endif mBuffer->setBuffer(immediate_mask); mBuffer->drawArrays(mMode, 0, mCount); mVerticesp[0] = mVerticesp[mCount]; mTexcoordsp[0] = mTexcoordsp[mCount]; mColorsp[0] = mColorsp[mCount]; mCount = 0; } }
void dumpCurrentContext(std::ostream &os) { JSONWriter json(os); #ifndef NDEBUG GLint old_bindings[NUM_BINDINGS]; for (unsigned i = 0; i < NUM_BINDINGS; ++i) { old_bindings[i] = 0; glGetIntegerv(bindings[i], &old_bindings[i]); } #endif Context context; /* Temporarily disable messages, as dumpParameters blindlessly tries to * get state, regardless the respective extension is supported or not. */ GLDEBUGPROC prevDebugCallbackFunction = 0; void *prevDebugCallbackUserParam = 0; if (context.KHR_debug) { glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION, (GLvoid **) &prevDebugCallbackFunction); glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM, &prevDebugCallbackUserParam); glDebugMessageCallback(NULL, NULL); } dumpParameters(json, context); // Use our own debug-message callback. if (context.KHR_debug) { glDebugMessageCallback(debugMessageCallback, NULL); } dumpShadersUniforms(json, context); dumpTextures(json, context); dumpFramebuffer(json, context); #ifndef NDEBUG for (unsigned i = 0; i < NUM_BINDINGS; ++i) { GLint new_binding = 0; glGetIntegerv(bindings[i], &new_binding); if (new_binding != old_bindings[i]) { std::cerr << "warning: " << enumToString(bindings[i]) << " was clobbered\n"; } } #endif // Restore debug message callback if (context.KHR_debug) { glDebugMessageCallback(prevDebugCallbackFunction, prevDebugCallbackUserParam); } }
static void hugsprim_glGetPointerv_4(HugsStackPtr hugs_root) { HsWord32 arg1; HsPtr arg2; arg1 = hugs->getWord32(); arg2 = hugs->getPtr(); glGetPointerv(arg1, arg2); hugs->returnIO(hugs_root,0); }
static void Init( void ) { const char * const ver_string = (const char * const) glGetString( GL_VERSION ); GLuint obj; int pass = 1; void * ptr; printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); printf("GL_VERSION = %s\n\n", ver_string); if ( !glutExtensionSupported("GL_APPLE_vertex_array_object") ) { printf("Sorry, this program requires GL_APPLE_vertex_array_object\n"); exit(2); } bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" ); gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" ); delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" ); is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" ); (*gen_vertex_arrays)( 1, & obj ); (*bind_vertex_array)( obj ); glVertexPointer( 4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xDEADBEEF); glEnableClientState( GL_VERTEX_ARRAY ); glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT ); glVertexPointer( 4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xBADDC0DE); glDisableClientState( GL_VERTEX_ARRAY ); glPopClientAttrib(); if ( ! glIsEnabled( GL_VERTEX_ARRAY ) ) { printf( "Array state is incorrectly disabled.\n" ); pass = 0; } glGetPointerv( GL_VERTEX_ARRAY_POINTER, & ptr ); if ( ptr != (void *) 0xDEADBEEF ) { printf( "Array pointer is incorrectly set to 0x%p.\n", ptr ); pass = 0; } if ( ! pass ) { printf( "FAIL!\n" ); exit(1); } }
int main(int argc, char *argv[]) { // testing GLint tempInt; GLboolean tempBool; void *tempPtr; SDL_Surface *screen; if ( SDL_Init(SDL_INIT_VIDEO) != 0 ) { printf("Unable to initialize SDL: %s\n", SDL_GetError()); return 1; } SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); screen = SDL_SetVideoMode( 640, 480, 24, SDL_OPENGL ); if ( !screen ) { printf("Unable to set video mode: %s\n", SDL_GetError()); return 1; } glClearColor( 0, 0, 0, 0 ); glClear( GL_COLOR_BUFFER_BIT ); // Create a texture GLint boundTex = 123; assert(!glGetError()); glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTex); assert(!glGetError()); assert(boundTex == 0); GLuint texture; glGenTextures( 1, &texture ); glBindTexture( GL_TEXTURE_2D, texture ); assert(!glGetError()); glGetIntegerv(GL_TEXTURE_BINDING_2D, &boundTex); assert(!glGetError()); assert(boundTex == texture); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); GLubyte textureData[16*16*4]; for (int x = 0; x < 16; x++) { for (int y = 0; y < 16; y++) { *((int*)&textureData[(x*16 + y) * 4]) = x*16 + ((y*16) << 8); } } glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData ); // Create a second texture GLuint texture2; glGenTextures( 1, &texture2 ); glBindTexture( GL_TEXTURE_2D, texture2 ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); GLubyte texture2Data[] = { 0xff, 0, 0, 0xff, 0, 0xff, 0, 0xaa, 0, 0, 0xff, 0x55, 0x80, 0x90, 0x70, 0 }; glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture2Data ); // BEGIN #if USE_GLEW glewInit(); #endif glMatrixMode(GL_PROJECTION); glLoadIdentity(); // original: glFrustum(-0.6435469817188064, 0.6435469817188064 ,-0.48266022190470925, 0.48266022190470925 ,0.5400000214576721, 2048); glFrustum(-0.6435469817188064, 0.1435469817188064 ,-0.48266022190470925, 0.88266022190470925 ,0.5400000214576721, 2048); glRotatef(-30, 1, 1, 1); //GLfloat pm[] = { 1.372136116027832, 0, 0, 0, 0, 0.7910231351852417, 0, 0, -0.6352481842041016, 0.29297152161598206, -1.0005275011062622, -1, 0, 0, -1.080284833908081, 0 }; //glLoadMatrixf(pm); glMatrixMode(GL_MODELVIEW); GLfloat matrixData[] = { -1, 0, 0, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0, 0, 0, 1 }; glLoadMatrixf(matrixData); //glTranslated(-512,-512,-527); // XXX this should be uncommented, but if it is then nothing is shown glEnable(GL_CULL_FACE); glEnable(GL_DEPTH_TEST); glClear(GL_DEPTH_BUFFER_BIT); glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glActiveTexture(GL_TEXTURE0); glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(!tempBool); glEnableClientState(GL_VERTEX_ARRAY); glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(tempBool); GLuint arrayBuffer, elementBuffer; glGenBuffers(1, &arrayBuffer); glGenBuffers(1, &elementBuffer); GLubyte arrayData[] = { /* [0, 0, 0, 67] ==> 128 float [0, 0, 128, 67] ==> 256 float [0, 0, 0, 68] ==> 512 float [0, 0, 128, 68] ==> 1024 float [vertex x ] [vertex y ] [vertex z ] [nr] [texture u ] [texture v ] [lm u ] [lm v ] [color r,g,b,a ] */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 0 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 1 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 2 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 3 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 4 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, // 5 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 6 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 7 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 8 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 9 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 10 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 11 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 12 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 0, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 13 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 14 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 128, 67, 0, 0, 0, 0, 128, 128, 128, 128, // 15 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 128, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 0, 0, 128, 68, 0, 0, 128, 68, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128 }; assert(sizeof(arrayData) == 1408); glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); glBufferData(GL_ARRAY_BUFFER, sizeof(arrayData), arrayData, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); GLushort elementData[] = { 1, 2, 0, 2, 3, 0, 5, 6, 4, 6, 7, 4, 9, 10, 8, 10, 11, 8, 13, 14, 12, 14, 15, 12 }; assert(sizeof(elementData) == 48); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elementData), elementData, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBuffer); // sauer vertex data is apparently 0-12: V3F, 12: N1B, 16-24: T2F, 24-28: T2S, 28-32: C4B glVertexPointer(3, GL_FLOAT, 32, (void*)0); // all these apply to the ARRAY_BUFFER that is bound glTexCoordPointer(2, GL_FLOAT, 32, (void*)16); glClientActiveTexture(GL_TEXTURE1); // XXX seems to be ignored in native build glTexCoordPointer(2, GL_SHORT, 32, (void*)24); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_SIZE, &tempInt); assert(tempInt == 2); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_TYPE, &tempInt); assert(tempInt == GL_SHORT); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)24); glClientActiveTexture(GL_TEXTURE0); // likely not needed, it is a cleanup glNormalPointer(GL_BYTE, 32, (void*)12); glColorPointer(4, GL_UNSIGNED_BYTE, 32, (void*)28); glGetPointerv(GL_VERTEX_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)0); glGetPointerv(GL_COLOR_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)28); glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &tempPtr); assert(tempPtr == (void *)16); glGetIntegerv(GL_VERTEX_ARRAY_SIZE, &tempInt); assert(tempInt == 3); glGetIntegerv(GL_VERTEX_ARRAY_TYPE, &tempInt); assert(tempInt == GL_FLOAT); glGetIntegerv(GL_VERTEX_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); glGetIntegerv(GL_COLOR_ARRAY_SIZE, &tempInt); assert(tempInt == 4); glGetIntegerv(GL_COLOR_ARRAY_TYPE, &tempInt); assert(tempInt == GL_UNSIGNED_BYTE); glGetIntegerv(GL_COLOR_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_SIZE, &tempInt); assert(tempInt == 2); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_TYPE, &tempInt); assert(tempInt == GL_FLOAT); glGetIntegerv(GL_TEXTURE_COORD_ARRAY_STRIDE, &tempInt); assert(tempInt == 32); glGetBooleanv(GL_VERTEX_ARRAY, &tempBool); assert(tempBool); glBindTexture(GL_TEXTURE_2D, texture); // diffuse? glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, texture2); // lightmap? glActiveTexture(GL_TEXTURE0); GLint ok; const char *vertexShader = "uniform vec4 texgenscroll;\n" "void main(void)\n" "{\n" " gl_Position = ftransform();\n" " gl_TexCoord[0].xy = gl_MultiTexCoord0.xy/100.0 + texgenscroll.xy;\n" // added /100 here " gl_TexCoord[1].xy = gl_MultiTexCoord1.xy/100.0 * 3.051851e-05;\n" "}\n"; const char *fragmentShader = "uniform vec4 colorparams;\n" "uniform sampler2D diffusemap, lightmap;\n" "void main(void)\n" "{\n" " vec4 diffuse = texture2D(diffusemap, gl_TexCoord[0].xy);\n" " vec4 lm = texture2D(lightmap, gl_TexCoord[1].xy);\n" " diffuse *= colorparams;\n" " gl_FragColor = diffuse * lm;\n" "}\n"; GLuint vs = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vs, 1, &vertexShader, NULL); glCompileShader(vs); glGetShaderiv(vs, GL_COMPILE_STATUS, &ok); assert(ok); GLuint fs = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fs, 1, &fragmentShader, NULL); glCompileShader(fs); glGetShaderiv(fs, GL_COMPILE_STATUS, &ok); assert(ok); GLuint program = glCreateProgram(); glAttachShader(program, vs); glAttachShader(program, fs); glLinkProgram(program); glGetProgramiv(program, GL_LINK_STATUS, &ok); assert(ok); glUseProgram(program); GLint lightmapLocation = glGetUniformLocation(program, "lightmap"); assert(lightmapLocation >= 0); assert(lightmapLocation == glGetUniformLocation(program, "lightmap")); // must get identical ids glLinkProgram(program); glGetProgramiv(program, GL_LINK_STATUS, &ok); assert(ok); assert(lightmapLocation != glGetUniformLocation(program, "lightmap")); // must NOT get identical ids, we re-linked! lightmapLocation = glGetUniformLocation(program, "lightmap"); assert(lightmapLocation == glGetUniformLocation(program, "lightmap")); // must get identical ids glUniform1i(lightmapLocation, 1); // sampler2D? Is it the texture unit? GLint diffusemapLocation = glGetUniformLocation(program, "diffusemap"); assert(diffusemapLocation >= 0); glUniform1i(diffusemapLocation, 0); GLint texgenscrollLocation = glGetUniformLocation(program, "texgenscroll"); assert(texgenscrollLocation >= 0); GLint colorparamsLocation = glGetUniformLocation(program, "colorparams"); assert(colorparamsLocation >= 0); GLfloat texgenscrollData[] = { 0, 0, 0, 0 }; glUniform4fv(texgenscrollLocation, 1, texgenscrollData); GLfloat colorparamsData[] = { 2, 2, 2, 1 }; glUniform4fv(colorparamsLocation, 1, colorparamsData); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)12); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*) 0); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)24); glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, (void*)36); // END SDL_GL_SwapBuffers(); #ifndef __EMSCRIPTEN__ SDL_Delay(1500); #endif SDL_Quit(); return 0; }
void gl_getpointerv( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { glGetPointerv((GLenum)mxGetScalar(prhs[0]), (GLvoid **)mxGetData(prhs[1])); }
void LLRender::flush() { if (mCount > 0) { #if 0 if (!glIsEnabled(GL_VERTEX_ARRAY)) { llerrs << "foo 1" << llendl; } if (!glIsEnabled(GL_COLOR_ARRAY)) { llerrs << "foo 2" << llendl; } if (!glIsEnabled(GL_TEXTURE_COORD_ARRAY)) { llerrs << "foo 3" << llendl; } if (glIsEnabled(GL_NORMAL_ARRAY)) { llerrs << "foo 7" << llendl; } GLvoid* pointer; glGetPointerv(GL_VERTEX_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].v)) { llerrs << "foo 4" << llendl; } glGetPointerv(GL_COLOR_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].c)) { llerrs << "foo 5" << llendl; } glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &pointer); if (pointer != &(mBuffer[0].uv)) { llerrs << "foo 6" << llendl; } #endif if (!mUIOffset.empty()) { sUICalls++; sUIVerts += mCount; } if (gDebugGL) { if (mMode == LLRender::QUADS) { if (mCount%4 != 0) { llerrs << "Incomplete quad rendered." << llendl; } } if (mMode == LLRender::TRIANGLES) { if (mCount%3 != 0) { llerrs << "Incomplete triangle rendered." << llendl; } } if (mMode == LLRender::LINES) { if (mCount%2 != 0) { llerrs << "Incomplete line rendered." << llendl; } } } mBuffer->setBuffer(immediate_mask); mBuffer->drawArrays(mMode, 0, mCount); mVerticesp[0] = mVerticesp[mCount]; mTexcoordsp[0] = mTexcoordsp[mCount]; mColorsp[0] = mColorsp[mCount]; mCount = 0; } }
void glGetPointervEXT( GLenum pname, void **params ) { glGetPointerv( pname, params ); }
void VBDrawable2DDraw(VBDrawable2D* _drawable) { #ifdef _VB_DEBUG_ if(_drawable == VBNull) VBDebugPrintAndPrintLogFileAbort(VBEngineGetDefaultDebuger(), VBTrue, "VBEngine Log: VBDrawable2DDraw() - VBNull??Draw?�소??그릴???�습?�다. VBDrawable2DAlloc?��? ?�았?????�습?�다."); #endif GLboolean _state; _state = glIsEnabled(GL_BLEND); if(!_state) glEnable(GL_BLEND); GLint _bendSRC, _bendDST; glGetIntegerv(GL_BLEND_SRC, &_bendSRC); glGetIntegerv(GL_BLEND_DST, &_bendDST); if(_bendSRC != GL_SRC_ALPHA || _bendDST != GL_ONE_MINUS_SRC_ALPHA) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); _state = glIsEnabled(GL_COLOR_MATERIAL); if(!_state) glEnable(GL_COLOR_MATERIAL); _state = glIsEnabled(GL_TEXTURE_2D); if(!_state) glEnable(GL_TEXTURE_2D); GLint _texID = 0; glGetIntegerv(GL_TEXTURE_BINDING_2D, &_texID); if(_texID != VBTextureGetID(VBDrawable2DGetTexture(_drawable))) { glBindTexture(GL_TEXTURE_2D, VBTextureGetID(VBDrawable2DGetTexture(_drawable))); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } _state = glIsEnabled(GL_COLOR_ARRAY); if(_drawable->color) { if(_state == VBFalse) glEnableClientState(GL_COLOR_ARRAY); } else { if(_state == VBTrue) glDisableClientState(GL_COLOR_ARRAY); } if(_drawable->color) { GLvoid* _glcolor = VBNull; glGetPointerv(GL_COLOR_ARRAY_POINTER, &_glcolor); if(_drawable->color != _glcolor) { glColorPointer(VBColorTypeGetSize(VBColorType_RGBA), GL_UNSIGNED_BYTE, 0, _drawable->color); } } _state = glIsEnabled(GL_VERTEX_ARRAY); if(_drawable->vtx) { if(_state == VBFalse) glEnableClientState(GL_VERTEX_ARRAY); } else { if(_state == VBTrue) glDisableClientState(GL_VERTEX_ARRAY); } if(_drawable->vtx) { GLvoid* _glvtx = VBNull; glGetPointerv(GL_COLOR_ARRAY_POINTER, &_glvtx); if(_drawable->vtx != _glvtx) { glVertexPointer(2, GL_FLOAT, 0, _drawable->vtx); } } _state = glIsEnabled(GL_TEXTURE_COORD_ARRAY); if(_drawable->color) { if(_state == VBFalse) glEnableClientState(GL_TEXTURE_COORD_ARRAY); } else { if(_state == VBTrue) glDisableClientState(GL_TEXTURE_COORD_ARRAY); } if(_drawable->txc) { GLvoid* _gltxc = VBNull; glGetPointerv(GL_TEXTURE_COORD_ARRAY_POINTER, &_gltxc); if(_drawable->txc != _gltxc) { glTexCoordPointer(2, GL_FLOAT, 0, _drawable->txc); } } #ifndef _VB_VISIBLE_VERTEX_LINE_ glDrawElements(GL_TRIANGLES, _drawable->idx_len, GL_UNSIGNED_SHORT, _drawable->idx); #endif #ifdef _VB_VISIBLE_VERTEX_LINE_ glDisable(GL_TEXTURE_2D); glDrawElements(GL_LINE_LOOP, _drawable->idx_len, GL_UNSIGNED_SHORT, _drawable->idx); #endif }
void* get_debug_callback_user_data() { GLvoid* result; glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM, &result); return result; }
void* get_debug_callback_function () { GLvoid* result; glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION, &result); return result; }
void glGetPointervLogged(GLenum pname, void **params) { printf("glGetPointerv(%s, %p)\n", GLEnumName(pname), params); glGetPointerv(pname, params); }
void csGLStateCacheContext::InitCache() { int i; glGetIntegerv (GL_ALPHA_TEST_FUNC, (GLint*)¶meter_alpha_func); glGetFloatv (GL_ALPHA_TEST_REF, ¶meter_alpha_ref); if (extmgr->CS_GL_EXT_blend_func_separate) { glGetIntegerv (GL_BLEND_SRC_RGB_EXT, (GLint*)&blend_sourceRGB); glGetIntegerv (GL_BLEND_SRC_ALPHA_EXT, (GLint*)&blend_sourceA); glGetIntegerv (GL_BLEND_DST_RGB_EXT, (GLint*)&blend_destinationRGB); glGetIntegerv (GL_BLEND_DST_ALPHA_EXT, (GLint*)&blend_destinationA); } else { glGetIntegerv (GL_BLEND_SRC, (GLint*)&blend_sourceRGB); blend_sourceA = blend_sourceRGB; glGetIntegerv (GL_BLEND_DST, (GLint*)&blend_destinationRGB); blend_destinationA = blend_destinationRGB; } glGetIntegerv (GL_CULL_FACE_MODE, (GLint*)¶meter_cull_mode); glGetIntegerv (GL_DEPTH_FUNC, (GLint*)¶meter_depth_func); glGetBooleanv (GL_DEPTH_WRITEMASK, ¶meter_depth_mask); glGetIntegerv (GL_SHADE_MODEL, (GLint*)¶meter_shade_model); glGetIntegerv (GL_STENCIL_BITS, (GLint*)¶meter_maskl); glGetIntegerv (GL_STENCIL_FUNC, (GLint*)¶meter_stencil_func); glGetIntegerv (GL_STENCIL_VALUE_MASK, (GLint*)¶meter_stencil_mask); glGetIntegerv (GL_STENCIL_REF, ¶meter_stencil_ref); glGetIntegerv (GL_STENCIL_FAIL, (GLint*)¶meter_stencil_fail); glGetIntegerv (GL_STENCIL_PASS_DEPTH_FAIL, (GLint*)¶meter_stencil_zfail); glGetIntegerv (GL_STENCIL_PASS_DEPTH_PASS, (GLint*)¶meter_stencil_zpass); glGetIntegerv (GL_MATRIX_MODE, (GLint*)¶meter_matrixMode); GLboolean writemask[4]; glGetBooleanv (GL_COLOR_WRITEMASK, writemask); parameter_wmRed = writemask[0]; parameter_wmGreen = writemask[1]; parameter_wmBlue = writemask[2]; parameter_wmAlpha = writemask[3]; enabled_GL_DEPTH_TEST = (glIsEnabled (GL_DEPTH_TEST) == GL_TRUE); enabled_GL_BLEND = (glIsEnabled (GL_BLEND) == GL_TRUE); enabled_GL_DITHER = (glIsEnabled (GL_DITHER) == GL_TRUE); enabled_GL_STENCIL_TEST = (glIsEnabled (GL_STENCIL_TEST) == GL_TRUE); enabled_GL_CULL_FACE = (glIsEnabled (GL_CULL_FACE) == GL_TRUE); enabled_GL_POLYGON_OFFSET_FILL = (glIsEnabled (GL_POLYGON_OFFSET_FILL) == GL_TRUE); enabled_GL_LIGHTING = (glIsEnabled (GL_LIGHTING) == GL_TRUE); enabled_GL_ALPHA_TEST = (glIsEnabled (GL_ALPHA_TEST) == GL_TRUE); enabled_GL_TEXTURE_GEN_S = (glIsEnabled (GL_TEXTURE_GEN_S) == GL_TRUE); enabled_GL_TEXTURE_GEN_T = (glIsEnabled (GL_TEXTURE_GEN_T) == GL_TRUE); enabled_GL_TEXTURE_GEN_R = (glIsEnabled (GL_TEXTURE_GEN_R) == GL_TRUE); enabled_GL_TEXTURE_GEN_Q = (glIsEnabled (GL_TEXTURE_GEN_Q) == GL_TRUE); enabled_GL_FOG = (glIsEnabled (GL_FOG) == GL_TRUE); memset (boundtexture.p, 0, numImageUnits * sizeof (GLuint)); currentImageUnit = 0; currentTCUnit = 0; memset (activeUnit, 0, sizeof (activeUnit)); if (extmgr->CS_GL_ARB_multitexture) { for (i = numImageUnits; i-- > 0; ) { extmgr->glActiveTextureARB (GL_TEXTURE0_ARB + i); enabled_GL_TEXTURE_1D[i] = (glIsEnabled (GL_TEXTURE_1D) == GL_TRUE); enabled_GL_TEXTURE_2D[i] = (glIsEnabled (GL_TEXTURE_2D) == GL_TRUE); enabled_GL_TEXTURE_3D[i] = (glIsEnabled (GL_TEXTURE_3D) == GL_TRUE); enabled_GL_TEXTURE_CUBE_MAP[i] = (glIsEnabled (GL_TEXTURE_CUBE_MAP) == GL_TRUE); if (extmgr->CS_GL_ARB_texture_rectangle || extmgr->CS_GL_EXT_texture_rectangle || extmgr->CS_GL_NV_texture_rectangle) enabled_GL_TEXTURE_RECTANGLE_ARB[i] = (glIsEnabled (GL_TEXTURE_RECTANGLE_ARB) == GL_TRUE); else enabled_GL_TEXTURE_RECTANGLE_ARB[i] = false; } for (i = numTexCoords; i-- > 0; ) { extmgr->glClientActiveTextureARB (GL_TEXTURE0_ARB + i); enabled_GL_TEXTURE_COORD_ARRAY[i] = (glIsEnabled (GL_TEXTURE_COORD_ARRAY) == GL_TRUE); glGetIntegerv (GL_TEXTURE_COORD_ARRAY_SIZE, (GLint*)¶meter_tsize[i]); glGetIntegerv (GL_TEXTURE_COORD_ARRAY_STRIDE, (GLint*)¶meter_tstride[i]); glGetIntegerv (GL_TEXTURE_COORD_ARRAY_TYPE, (GLint*)¶meter_ttype[i]); glGetPointerv (GL_TEXTURE_COORD_ARRAY_POINTER, ¶meter_tpointer[i]); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_tvbo[i]); } } else { enabled_GL_TEXTURE_1D[0] = (glIsEnabled (GL_TEXTURE_1D) == GL_TRUE); enabled_GL_TEXTURE_2D[0] = (glIsEnabled (GL_TEXTURE_2D) == GL_TRUE); enabled_GL_TEXTURE_3D[0] = (glIsEnabled (GL_TEXTURE_3D) == GL_TRUE); enabled_GL_TEXTURE_CUBE_MAP[0] = (glIsEnabled (GL_TEXTURE_CUBE_MAP) == GL_TRUE); enabled_GL_TEXTURE_COORD_ARRAY[0] = (glIsEnabled (GL_TEXTURE_COORD_ARRAY) == GL_TRUE); if (extmgr->CS_GL_ARB_texture_rectangle || extmgr->CS_GL_EXT_texture_rectangle || extmgr->CS_GL_NV_texture_rectangle) enabled_GL_TEXTURE_RECTANGLE_ARB[0] = (glIsEnabled (GL_TEXTURE_RECTANGLE_ARB) == GL_TRUE); else enabled_GL_TEXTURE_RECTANGLE_ARB[0] = false; glGetIntegerv (GL_TEXTURE_COORD_ARRAY_SIZE, (GLint*)¶meter_tsize[0]); glGetIntegerv (GL_TEXTURE_COORD_ARRAY_STRIDE, (GLint*)¶meter_tstride[0]); glGetIntegerv (GL_TEXTURE_COORD_ARRAY_TYPE, (GLint*)¶meter_ttype[0]); glGetPointerv (GL_TEXTURE_COORD_ARRAY_POINTER, ¶meter_tpointer[0]); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_tvbo[0]); for (i = 1 ; i < numImageUnits; i++) { enabled_GL_TEXTURE_1D[i] = enabled_GL_TEXTURE_1D[0]; enabled_GL_TEXTURE_2D[i] = enabled_GL_TEXTURE_2D[0]; enabled_GL_TEXTURE_3D[i] = enabled_GL_TEXTURE_3D[0]; enabled_GL_TEXTURE_CUBE_MAP[i] = enabled_GL_TEXTURE_CUBE_MAP[0]; enabled_GL_TEXTURE_COORD_ARRAY[i] = enabled_GL_TEXTURE_COORD_ARRAY[0]; enabled_GL_TEXTURE_RECTANGLE_ARB[i] = enabled_GL_TEXTURE_RECTANGLE_ARB[0]; parameter_tsize[i] = parameter_tsize[0]; parameter_tstride[i] = parameter_tstride[0]; parameter_ttype[i] = parameter_ttype[0]; parameter_tpointer[i] = parameter_tpointer[0]; } } enabled_GL_SCISSOR_TEST = (glIsEnabled (GL_SCISSOR_TEST) == GL_TRUE); enabled_GL_VERTEX_ARRAY = (glIsEnabled (GL_VERTEX_ARRAY) == GL_TRUE); enabled_GL_COLOR_ARRAY = (glIsEnabled (GL_COLOR_ARRAY) == GL_TRUE); if (extmgr->CS_GL_EXT_secondary_color) enabled_GL_SECONDARY_COLOR_ARRAY_EXT = (glIsEnabled (GL_SECONDARY_COLOR_ARRAY_EXT) == GL_TRUE); else enabled_GL_SECONDARY_COLOR_ARRAY_EXT = false; enabled_GL_NORMAL_ARRAY = (glIsEnabled (GL_NORMAL_ARRAY) == GL_TRUE); if (extmgr->CS_GL_ARB_vertex_program) enabled_GL_VERTEX_PROGRAM_POINT_SIZE_ARB = (glIsEnabled (GL_VERTEX_PROGRAM_POINT_SIZE_ARB) == GL_TRUE); else enabled_GL_VERTEX_PROGRAM_POINT_SIZE_ARB = false; if (extmgr->CS_GL_ARB_point_sprite) enabled_GL_POINT_SPRITE_ARB = (glIsEnabled (GL_POINT_SPRITE_ARB) == GL_TRUE); else enabled_GL_POINT_SPRITE_ARB = false; memset (currentBufferID, 0, sizeof (currentBufferID)); { enum { extVBO = 1, extPBO = 2 }; static const GLenum requiredExt[boCount] = { extVBO, extVBO, extPBO, extPBO }; int boExt = 0; if (extmgr->CS_GL_ARB_vertex_buffer_object) boExt |= extVBO; if (extmgr->CS_GL_ARB_pixel_buffer_object) boExt |= extPBO; for (int b = 0; b < boCount; b++) { if (requiredExt[b] & boExt) { static const GLenum localIndexToGLBufferBinding[boCount] = { GL_ARRAY_BUFFER_BINDING_ARB, GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, GL_PIXEL_PACK_BUFFER_BINDING_ARB, GL_PIXEL_UNPACK_BUFFER_BINDING_ARB }; glGetIntegerv (localIndexToGLBufferBinding[b], (GLint*)&activeBufferID[b]); } } } memset (currentBufferID, 0, sizeof (currentBufferID)); { static const GLenum localIndexToGLBufferBinding[boCount] = { GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, GL_ARRAY_BUFFER_BINDING_ARB, GL_PIXEL_PACK_BUFFER_BINDING_ARB, GL_PIXEL_UNPACK_BUFFER_BINDING_ARB }; enum { extVBO = 1, extPBO = 2 }; static const GLenum requiredExt[boCount] = { extVBO, extVBO, extPBO, extPBO }; int boExt = 0; if (extmgr->CS_GL_ARB_vertex_buffer_object) boExt |= extVBO; if (extmgr->CS_GL_ARB_pixel_buffer_object) boExt |= extPBO; for (int b = 0; b < boCount; b++) { if (requiredExt[b] & boExt) { glGetIntegerv (localIndexToGLBufferBinding[b], (GLint*)¤tBufferID[b]); } } } glGetIntegerv (GL_VERTEX_ARRAY_SIZE, (GLint*)¶meter_vsize); glGetIntegerv (GL_VERTEX_ARRAY_STRIDE, (GLint*)¶meter_vstride); glGetIntegerv (GL_VERTEX_ARRAY_TYPE, (GLint*)¶meter_vtype); glGetPointerv (GL_VERTEX_ARRAY_POINTER, ¶meter_vpointer); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_vvbo); glGetIntegerv (GL_NORMAL_ARRAY_STRIDE, (GLint*)¶meter_nstride); glGetIntegerv (GL_NORMAL_ARRAY_TYPE, (GLint*)¶meter_ntype); glGetPointerv (GL_NORMAL_ARRAY_POINTER, ¶meter_npointer); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_NORMAL_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_nvbo); glGetIntegerv (GL_COLOR_ARRAY_SIZE, (GLint*)¶meter_csize); glGetIntegerv (GL_COLOR_ARRAY_STRIDE, (GLint*)¶meter_cstride); glGetIntegerv (GL_COLOR_ARRAY_TYPE, (GLint*)¶meter_ctype); glGetPointerv (GL_COLOR_ARRAY_POINTER, ¶meter_cpointer); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_COLOR_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_cvbo); if (extmgr->CS_GL_EXT_secondary_color) { glGetIntegerv (GL_SECONDARY_COLOR_ARRAY_SIZE_EXT, (GLint*)¶meter_scsize); glGetIntegerv (GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT, (GLint*)¶meter_scstride); glGetIntegerv (GL_SECONDARY_COLOR_ARRAY_TYPE_EXT, (GLint*)¶meter_sctype); glGetPointerv (GL_SECONDARY_COLOR_ARRAY_POINTER_EXT, ¶meter_scpointer); if (extmgr->CS_GL_ARB_vertex_buffer_object) glGetIntegerv (GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB, (GLint*)¶meter_scvbo); enabled_GL_COLOR_SUM_EXT = glIsEnabled (GL_COLOR_SUM_EXT) != GL_FALSE; } else { parameter_scsize = 0; parameter_scstride = 0; parameter_sctype = 0; parameter_scpointer = 0; enabled_GL_COLOR_SUM_EXT = false; } glGetIntegerv (GL_UNPACK_ALIGNMENT, &pixelUnpackAlignment); GLint v; glGetIntegerv (GL_UNPACK_SWAP_BYTES, &v); pixelUnpackSwapBytes = v != 0; if (extmgr->CS_GL_ARB_color_buffer_float) { GLint clampState; glGetIntegerv (GL_CLAMP_VERTEX_COLOR_ARB, &clampState); this->clampState[clampVertex] = (GLenum)clampState; glGetIntegerv (GL_CLAMP_FRAGMENT_COLOR_ARB, &clampState); this->clampState[clampFragment] = (GLenum)clampState; glGetIntegerv (GL_CLAMP_READ_COLOR_ARB, &clampState); this->clampState[clampRead] = (GLenum)clampState; } }
JNIEXPORT void JNICALL Java_org_lwjgl_opengles_GLES32_nglGetPointerv(JNIEnv *__env, jclass clazz, jint pname, jlong paramsAddress) { glGetPointervPROC glGetPointerv = (glGetPointervPROC)tlsGetFunction(320); intptr_t params = (intptr_t)paramsAddress; UNUSED_PARAM(clazz) glGetPointerv(pname, params); }
void piglit_init(int argc, char **argv) { GLuint obj; int pass = 1; void * ptr; GLenum err; piglit_require_extension("GL_APPLE_vertex_array_object"); glGenVertexArraysAPPLE(1, & obj); glBindVertexArrayAPPLE(obj); glVertexPointer(4, GL_FLOAT, sizeof(GLfloat) * 4, (void *) 0xDEADBEEF); glEnableClientState(GL_VERTEX_ARRAY); glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); glDeleteVertexArraysAPPLE(1, & obj); err = glGetError(); if (err) { printf("glGetError incorrectly returned 0x%04x.\n", err); pass = 0; } if ((*glIsVertexArrayAPPLE)(obj)) { printf("Array object is incorrectly still valid.\n"); pass = 0; } err = glGetError(); if (err) { printf("glGetError incorrectly returned 0x%04x.\n", err); pass = 0; } glPopClientAttrib(); err = glGetError(); if (err) { printf("glGetError incorrectly returned 0x%04x.\n", err); pass = 0; } if (! glIsVertexArrayAPPLE(obj)) { printf("Array object is incorrectly invalid.\n"); pass = 0; } if (! glIsEnabled(GL_VERTEX_ARRAY)) { printf("Array state is incorrectly disabled.\n"); pass = 0; } glGetPointerv(GL_VERTEX_ARRAY_POINTER, & ptr); if (ptr != (void *) 0xDEADBEEF) { printf("Array pointer is incorrectly set to 0x%p.\n", ptr); pass = 0; } if (! pass) { piglit_report_result(PIGLIT_FAIL); } else { piglit_report_result(PIGLIT_PASS); } }