Posts

Showing posts with the label textures

How to scale sprites in libgdx according to screen resolutions?

Image
Clash Royale CLAN TAG #URR8PPP How to scale sprites in libgdx according to screen resolutions? I am trying to scale the texture to fit the screen width. This is what I tried, but it simply repeats the texture. It does not scale it. In the init method: TextureLoader.TextureParameter param = new TextureLoader.TextureParameter(); param.minFilter = Texture.TextureFilter.MipMapLinearLinear; param.genMipMaps = true; param.wrapU = Texture.TextureWrap.ClampToEdge; param.wrapV = Texture.TextureWrap.ClampToEdge; manager.load("textures/texture.png", Texture.class, param); In the render method: Texture tex = manager.get("textures/texture.png", Texture.class); float scale = (float)( (float)Gdx.graphics.getWidth() / (float)(tex.getWidth())); batch.begin(); Sprite s = new Sprite(tex, 0,0,tex.getWidth(),tex.getHeight()); s.setPosition(0, 0); s.setOriginCenter(); //s.setScale(scale); s.setSize(Gdx.graphics.getWidth(), scale * tex.getHeight()); s.setOrigin(0,0); s.draw(batch); batch....

Can i rotate texure in three.js?

Image
Clash Royale CLAN TAG #URR8PPP Can i rotate texure in three.js? have a pb with rotate texture on new Shape. So shape for me its floor in the room and i try add texture there and i did it and it work good when shape is not rotated but when it rotate on 45 deg i have pb because i can't rotate image on 45 deg. Does anyone know how to do that? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Qt5 OpenGL cannot load bmp file as texture to cube

Image
Clash Royale CLAN TAG #URR8PPP Qt5 OpenGL cannot load bmp file as texture to cube I found this sample project based on NEHE Tutorial but doesn't work on my Qt version 5, tried editing some code but this the file cannot be loaded. And warning exists also warning: C4005: 'CALLBACK': macro redefinition The codes: void loadGLTextures() { QImage t; QImage b; //../images/nehe.bmp //original file path if ( !b.load( ":/nehe.png" ) ) { //b = QImage( 16, 16, 32 ); //b.fill( Qt::green.rgb() ); QMessageBox::information(this, "Error", "Could not load file"); QImage b(16, 16, QImage::Format_RGB32); //****** b.fill(Qt::green); //************* } t = QGLWidget::convertToGLFormat( b ); if(t.isNull()) { QMessageBox::information(this, "Error", "IMAGE IS NULL"); } glGenTextures( 1, texture );// Create The Texture glBindTexture( GL_TEXTURE_2D, texture[0] )...