void Radar::initBackground(char* textureFile)// a width and height need to be loaded before this is called. { backgroundAlpha = true; backgroundTexID = game->loadTexture (textureFile); glBindTexture (GL_TEXTURE_2D, backgroundTexID); glGetTexLevelParameterfv (GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &radarWidth);//we get the dimensions of the image glGetTexLevelParameterfv (GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &radarHeight); float vData[] = {-radarWidth/2, -radarHeight/2, 0, radarWidth/2, -radarHeight/2, 0, radarWidth/2, radarHeight/2, 0, -radarWidth/2, radarHeight/2, 0}; memcpy (backgroundVertices, vData, 12*sizeof(float)); GLfloat textureCoords[] = {0, 0, //basically to bind the texture to the object. No changes necessary. 1, 0, 1, 1, 0, 1}; //bind the texture coords to a vbo glGenBuffersARB (1, &backgroundTextureCoordVBOID); glBindBufferARB (GL_ARRAY_BUFFER_ARB, backgroundTextureCoordVBOID); glBufferDataARB (GL_ARRAY_BUFFER_ARB, sizeof (textureCoords), textureCoords, GL_DYNAMIC_DRAW_ARB); //glBufferSubDataARB (GL_ARRAY_BUFFER_ARB, 0, sizeof(textureCoords), textureCoords); //bind the quad to a vbo glGenBuffersARB (1, &backgroundVBOID); glBindBufferARB(GL_ARRAY_BUFFER_ARB, backgroundVBOID); glBufferDataARB (GL_ARRAY_BUFFER_ARB, sizeof(backgroundVertices), backgroundVertices, GL_DYNAMIC_DRAW_ARB); //glBufferSubDataARB (GL_ARRAY_BUFFER_ARB, 0, sizeof(vertices), vertices); //vertices ended }
void GameRender::drawSpriteTexture(GLuint texture, Vector2f pos, int currentFrame, GLfloat widthSprite, GLfloat heightSprite, int direction, int state) { GLfloat widthTexture, heightTexture; glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindTexture( GL_TEXTURE_2D, texture ); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &widthTexture); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &heightTexture); GLfloat verts[] = { pos.x, pos.y, pos.x + widthSprite, pos.y, pos.x + widthSprite, pos.y + heightSprite, pos.x, pos.y + heightSprite }; if ( direction == SpriteData::LEFT ) { verts[0] = verts[6] = pos.x + widthSprite; verts[2] = verts[4] = pos.x; } const GLfloat textureWidth = widthSprite / widthTexture; const GLfloat textureHeight = heightSprite / heightTexture; const int numFramePerRow = (int) widthTexture / (int) widthSprite; if ( state != GameCoreStates::STILL ) { currentFrame += ( (state - 1) * numFramePerRow); } const GLfloat textureX = ( currentFrame % numFramePerRow ) * textureWidth; const GLfloat textureY = ( currentFrame / numFramePerRow ) * textureHeight; GLfloat texVerts[] = { textureX, textureY, textureX + textureWidth, textureY, textureX + textureWidth, textureY + textureHeight, textureX, textureY + textureHeight }; glVertexPointer(2, GL_FLOAT, 0, verts); glTexCoordPointer(2, GL_FLOAT, 0, texVerts); glDrawArrays(GL_QUADS, 0, 4); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); }
/* ============================== IC_SubImageGetImageSize ============================== */ void IC_SubImageGetImageSize( ic_subimage_t *sub, vec2d_t size ) { if ( sub->xofs == -1 ) { __error( "subimage is not cached\n" ); } // glEnable( GL_TEXTURE_2D ); glBindTexture( GL_TEXTURE_2D, sub->texobj ); glGetTexLevelParameterfv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &size[0] ); glGetTexLevelParameterfv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &size[1] ); // glDisable( GL_TEXTURE_2D ); }
void GameRender::drawSoundBar(GLuint texture, Vector2f pos, Vector2f barDimensions, int currentFrame, int idState) { GLfloat widthTexture, heightTexture; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindTexture( GL_TEXTURE_2D, texture ); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &widthTexture); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &heightTexture); const GLfloat offsetX = (currentFrame*barDimensions.x); const GLfloat offsetY = heightTexture; const GLfloat verts[] = { pos.x, pos.y, pos.x + offsetX, pos.y, pos.x + offsetX, pos.y + offsetY, pos.x, pos.y + offsetY }; const GLfloat textureWidth = (currentFrame)*(barDimensions.x/widthTexture); const GLfloat textureHeight = 1.0f; const GLfloat textureX = ((GLfloat)idState/(GLfloat)2); const GLfloat textureY = 0.0f; GLfloat texVerts[] = { textureX, textureY, textureX + textureWidth, textureY, textureX + textureWidth, textureY + textureHeight, textureX, textureY + textureHeight }; glVertexPointer(2, GL_FLOAT, 0, verts); glTexCoordPointer(2, GL_FLOAT, 0, texVerts); glDrawArrays(GL_QUADS, 0, 4); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); }
void GameRender::drawLayerTexture(GLuint texture, Vector2f offset, GLfloat widthScreen, GLfloat heightScreen) { GLfloat widthTexture, heightTexture; glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindTexture( GL_TEXTURE_2D, texture ); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &widthTexture); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &heightTexture); const GLfloat vertX = 0.0f; const GLfloat vertY = 0.0f; const GLfloat verts[] = { vertX, vertY, vertX + widthScreen, vertY, vertX + widthScreen, vertY + heightScreen, vertX, vertY + heightScreen }; const GLfloat textureX = offset.x/widthTexture; const GLfloat textureY = 0.0f; const GLfloat textureWidth = (widthScreen + offset.x) / widthTexture; const GLfloat textureHeight = (heightScreen + offset.y) / heightTexture; const GLfloat texVerts[] = { textureX, textureY, textureWidth, textureY, textureWidth, textureHeight, textureX, textureHeight }; glVertexPointer(2, GL_FLOAT, 0, verts); glTexCoordPointer(2, GL_FLOAT, 0, texVerts); glDrawArrays(GL_QUADS, 0, 4); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); }
void STexture::setTexture(GLuint tex, int w, int h, bool owner) { if (tex == texture) return; release(); this->owner=owner; texture=tex; if (tex) { context->makeCurrent(); glBindTexture(GL_TEXTURE_2D, tex); if (w>0) width=w; else glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); if (h>0) height=h; else glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); } }
void GameRender::drawButton(GLuint texture, Vector2f pos, Vector2f dimensions, Vector2f offset) { GLfloat widthTexture, heightTexture; glEnableClientState( GL_VERTEX_ARRAY ); glEnableClientState( GL_TEXTURE_COORD_ARRAY ); glBindTexture( GL_TEXTURE_2D, texture ); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &widthTexture); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &heightTexture); GLfloat verts[] = { pos.x, pos.y, pos.x + dimensions.x, pos.y, pos.x + dimensions.x, pos.y + dimensions.y, pos.x, pos.y + dimensions.y }; const GLfloat textureWidth = dimensions.x/widthTexture; const GLfloat textureHeight = dimensions.y/heightTexture; const GLfloat textureX = 0.0f; const GLfloat textureY = offset.y/heightTexture; GLfloat texVerts[] = { textureX, textureY, textureX + textureWidth, textureY, textureX + textureWidth, textureY + textureHeight, textureX, textureY + textureHeight }; glVertexPointer(2, GL_FLOAT, 0, verts); glTexCoordPointer(2, GL_FLOAT, 0, texVerts); glDrawArrays(GL_QUADS, 0, 4); glDisableClientState( GL_VERTEX_ARRAY ); glDisableClientState( GL_TEXTURE_COORD_ARRAY ); }
Sprite::Sprite(SpriteData::IDSprites id, std::string filename, Vector2f pos, int initialFrame, std::vector < int > maxFrame, std::vector < int > returnFrame, GLfloat widthSprite, GLfloat heightSprite, std::vector < int > framerateAnimations, std::vector< Vector2f> delayMovement) { ID = id; texture = GameRender::loadTexture(filename); glGetTexLevelParameterfv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &this->widthTexture); glGetTexLevelParameterfv( GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &this->heightTexture); playerStateManager = new GameCoreStates::PlayerStateManager(); handlerAnimation = new Animation(initialFrame, getCurrentState(), SpriteData::RIGHT, maxFrame, returnFrame, framerateAnimations ); rigidBody = new GamePhysics::RigidBody(GamePhysics::RIGID_BODY); rigidBody->initializeNaturalPhysicsForces(-5.5f, 1.0f); collisionHandler = Collider::getInstance(); delayMovementSprite = delayMovement; width = widthSprite; height = heightSprite; position.x = pos.x; position.y = pos.y; speed = Vector2f(0.0f, 0.0f); countX = 0; countY = 0; characterMovement.playerMoveInXInCurrentFrame = false; characterMovement.playerMoveInYInCurrentFrame = false; characterMovement.playerMoveInX = false; characterMovement.playerMoveInY = false; }
int __glXDisp_GetTexLevelParameterfv(__GLXclientState *cl, GLbyte *pc) { GLenum pname; GLint compsize; __GLXcontext *cx; ClientPtr client = cl->client; int error; GLfloat answerBuffer[200]; char *answer; cx = __glXForceCurrent(cl, __GLX_GET_SINGLE_CONTEXT_TAG(pc), &error); if (!cx) { return error; } pc += __GLX_SINGLE_HDR_SIZE; pname = *(GLenum *)(pc + 8); compsize = __glGetTexLevelParameterfv_size(pname); if (compsize < 0) compsize = 0; __GLX_GET_ANSWER_BUFFER(answer,cl,compsize*4,4); __glXClearErrorOccured(); glGetTexLevelParameterfv( *(GLenum *)(pc + 0), *(GLint *)(pc + 4), *(GLenum *)(pc + 8), (GLfloat *) answer ); if (__glXErrorOccured()) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(0); __GLX_SEND_HEADER(); } else if (compsize == 1) { __GLX_BEGIN_REPLY(0); __GLX_PUT_SIZE(1); __GLX_PUT_FLOAT(); __GLX_SEND_HEADER(); } else { __GLX_BEGIN_REPLY(compsize*4); __GLX_PUT_SIZE(compsize); __GLX_SEND_HEADER(); __GLX_SEND_FLOAT_ARRAY(compsize); } return Success; }
PIGLIT_GL_TEST_CONFIG_END void piglit_init(int argc, char **argv) { bool pass = true; GLfloat data = -1; GLuint tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER, &data); if (!piglit_check_gl_error(GL_INVALID_ENUM)) pass = false; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
/** ** Initialize OpenGL */ static void InitOpenGL(void) { InitOpenGLExtensions(); glViewport(0, 0, (GLsizei)Video.Width, (GLsizei)Video.Height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof(0, Video.Width, Video.Height, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.375, 0.375, 0.); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearDepthf(1.0f); glShadeModel(GL_FLAT); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_LINE_SMOOTH); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &GLMaxTextureSize); if (GLMaxTextureSize == 0) { // FIXME: try to use GL_PROXY_TEXTURE_2D to get a valid size #if 0 glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, size, size, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glGetTexLevelParameterfv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internalFormat); #endif fprintf(stderr, "GL_MAX_TEXTURE_SIZE is 0, using 256 by default\n"); GLMaxTextureSize = 256; } if (GLMaxTextureSize > GLMaxTextureSizeOverride && GLMaxTextureSizeOverride > 0) { GLMaxTextureSize = GLMaxTextureSizeOverride; } }
void glui::Label::_setVBO() { glBindVertexArray(m_VAOID); if(m_Font != nullptr && !m_Text.empty()) { glBindTexture(GL_TEXTURE_2D, m_Texture); int x = 0; int y = 0; Font::Page::Glyph glyph; for(auto character: m_Text) { glyph = m_Font->getGlyph(character, m_FontSize); x += glyph.m_Width+2; //2 is for offset between characters } y = glyph.m_Height; glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, x, y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); x = 0; for(auto character: m_Text) { glyph = m_Font->getGlyph(character, m_FontSize); glTexSubImage2D(GL_TEXTURE_2D, 0, x, 0, glyph.m_Width, glyph.m_Height, GL_RGBA, GL_UNSIGNED_BYTE, glyph.m_Bytes.data()); x += glyph.m_Width+2; } glBindTexture(GL_TEXTURE_2D, 0); } if(m_AutoSize) { GLfloat width, height; glBindTexture(GL_TEXTURE_2D, m_Texture); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); m_Size = Vector2<GLfloat>(width, height); glBindTexture(GL_TEXTURE_2D, 0); } std::array<GLfloat, 8> verticesBackground = { m_Position.X, m_Position.Y, m_Position.X+m_Size.X, m_Position.Y, m_Position.X+m_Size.X, m_Position.Y+m_Size.Y, m_Position.X, m_Position.Y+m_Size.Y }; std::array<GLfloat, 12> colors = { 1.f, 1.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f, 1.f, 0.f, 0.f }; std::array<GLfloat, 8> tex_coords = { 0.f, 0.f, 1.f, 0.f, 1.f, 1.f, 0.f, 1.f }; glBindBuffer(GL_ARRAY_BUFFER, m_Vertices); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*verticesBackground.size(), verticesBackground.data(), GL_STATIC_DRAW); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_Colors); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*colors.size(), colors.data(), GL_STATIC_DRAW); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, m_TextureCoords); glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*tex_coords.size(), tex_coords.data(), GL_STATIC_DRAW); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); }
static void Init( void ) { unsigned i; static const GLenum pnames[] = { GL_TEXTURE_RED_SIZE, GL_TEXTURE_GREEN_SIZE, GL_TEXTURE_BLUE_SIZE, GL_TEXTURE_ALPHA_SIZE, GL_TEXTURE_LUMINANCE_SIZE, GL_TEXTURE_INTENSITY_SIZE, GL_TEXTURE_BORDER, GL_TEXTURE_INTERNAL_FORMAT, GL_TEXTURE_WIDTH, GL_TEXTURE_HEIGHT, GL_TEXTURE_DEPTH, ~0 }; printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); printf("\nThis program should log some data about a texture and exit.\n"); printf("This is a regression test for bug #3050. If the bug still\n"); printf("exists, a GLX protocol error will be generated.\n"); printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n"); if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" ) && ! glutExtensionSupported( "GL_EXT_texture_rectangle" ) && ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) { printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n" "or GL_NV_texture_rectangle be supported\n." ); exit( 1 ); } glBindTexture( GL_TEXTURE_RECTANGLE_NV, 1 ); glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL ); for ( i = 0 ; pnames[i] != ~0 ; i++ ) { GLint param_i; GLfloat param_f; GLenum err; glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_i ); err = glGetError(); if ( err ) { printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n" "error of 0x%04x!", pnames[i], err ); exit( 1 ); } else { printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n", pnames[i], param_i ); } glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_f ); err = glGetError(); if ( err ) { printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n" "error of 0x%04x!\n", pnames[i], err ); exit( 1 ); } else { printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n", pnames[i], param_f, (GLint) param_f ); } } }
void gl4es_glGetTextureLevelParameterfv(GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params) { text(glGetTexLevelParameterfv(target, level, pname, params)); }
void DisplayScene() { // kolor tła - zawartość bufora koloru glClearColor(1.0, 1.0, 1.0, 1.0); // czyszczenie bufora koloru i bufora głębokości glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // wybór macierzy modelowania glMatrixMode(GL_MODELVIEW); // macierz modelowania = macierz jednostkowa glLoadIdentity(); // przesunięcie układu współrzędnych obiektów do środka bryły odcinania glTranslatef(0.0, 0.0, -(near + far) / 2); // obroty obiektu glRotatef(rotatex, 1.0, 0.0, 0.0); glRotatef(rotatez, 0.0, 0.0, 1.0); // skalowanie obiektu - klawisze "+" i "-" glScalef(scale, scale, scale); // włączenie testu bufora głębokości glEnable(GL_DEPTH_TEST); // włączenie teksturowania dwuwymiarowego glEnable(GL_TEXTURE_2D); // filtr powiększający glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // filtr pomniejszający glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter); // dowiązanie wybranej tekstury glBindTexture(GL_TEXTURE_2D, texture); // ustawienie parametów środowiska tekstur glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); // utworzenie kwadryki GLUquadricObj *quadobj = gluNewQuadric(); // styl (wygląd) generowanej kwadryki gluQuadricDrawStyle(quadobj, GLU_FILL); // sposób generacji wektorów normalnych gluQuadricNormals(quadobj, GLU_SMOOTH); // nałożenie tekstury na kwadrykę gluQuadricTexture(quadobj, GL_TRUE); // narysowanie kuli gluSphere(quadobj, 1.0, 30, 30); // usunięcie kwadryki gluDeleteQuadric(quadobj); // wyłączenie teksturowania dwuwymiarowego glDisable(GL_TEXTURE_2D); // informacje o wybranych parametrach bieżącej tekstury char string[200]; GLfloat var; glColor3fv(Black); // wartość priorytetu tekstury glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, &var); sprintf_s(string, "GL_TEXTURE_PRIORITY = %f", var); DrawString(2, 2, string); // czy tekstura jest rezydentna glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_RESIDENT, &var); if (var == GL_FALSE) strcpy_s(string, "GL_TEXTURE_RESIDENT = GL_FALSE"); else strcpy_s(string, "GL_TEXTURE_RESIDENT = GL_TRUE"); DrawString(2, 16, string); // szerokość tekstury (poziom 0) glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &var); sprintf_s(string, "GL_TEXTURE_WIDTH = %f", var); DrawString(2, 30, string); // wysokość tekstury (poziom 0) glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &var); sprintf_s(string, "GL_TEXTURE_HEIGHT = %f", var); DrawString(2, 46, string); // skierowanie poleceñ do wykonania glFlush(); // zamiana buforów koloru glutSwapBuffers(); }
M(void, glGetTexLevelParameterfv, jint target, jint level, jint pname, jobject params) { glGetTexLevelParameterfv(target, level, pname, BUFF(GLfloat, params)); }
Texture::Texture(const std::string filepath, int force_ch, unsigned int reuse, unsigned int flags) { texid = SOIL_load_OGL_texture( filepath.c_str(), force_ch, reuse, flags ); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width); glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height); glBindTexture(GL_TEXTURE_2D, 0); }
void gl4es_glGetMultiTexLevelParameterfv(GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params) { text(glGetTexLevelParameterfv(target, level, pname, params)); }