textures

OpenGL - Texture mapping in vertex or fragment shader?

时间秒杀一切 提交于 2019-12-05 21:40:56
Is there texture of an object/triangles mapped in the fragment shader or the vertex shader? Whether if it is on the vertex or fragment shader, if you are programming shaders it's something that you have to code yourself right? Without shader you just assinged the tex coords and opengl mapps it without you knowing, but with shaders you have to do it yourself, right? fen Usually the texturing happens in the fragment shader. This is the place where triangle's fragments gain a color. Usually in the vertex shader you calculate texture coords (or simply pass them through from vertex attribs without

Libgdx change color of Texture at runtime

我怕爱的太早我们不能终老 提交于 2019-12-05 21:24:34
问题 In a game made with libgdx I have a TextureAtlas in which I have stored all the TextureRegion s for my Animation s of the Player . The Player by default has a blue T-Shirt (for example). Now I would like to be able to have more then one Player and each should have another T-Shirt color. So basically, I want to replace the blue with red for the second Player and with green for the 3rd Player and so on. I am sure I can do this with PixMap but wouldn't. Because then I lose the advantage of the

DDS texture loading

老子叫甜甜 提交于 2019-12-05 18:57:23
How would I load a dds texture file into an OpenGL 2dtexture or cube map texture? I believe you use the glCompressedTexImage2DARB method and its friends. This PDF seems to contain some promising info that may be helpful to you. Depending on your needs, the DevIL library can take care of feeding OpenGL with a DDS file content. If the DDS contains a compressed texture then use glCompressedTexImage2DARB(), if it contains uncompressed data the usual glTexImage2D procedure applies. Once for each mipmap level if the DDS file contains mipmaps, and once for each cubemap face if its a cubemap. For how

iPhone, float textures

做~自己de王妃 提交于 2019-12-05 18:32:02
I need to have GL_ RGBA32F as internal format, but i do not get this in OpenGL ES implementation. Instead of this i get only GL_FLOAT as a texture data type. The OES_texture_float spec has nothing to say what's inside. So i do not know, whether my texture data will be normalized to [0, 1] or not. Basically i need to store in texture unclamped texture data regardless it's float or integer value. How i can get not normalized data inside my texture? Sadly, OpenGL ES treats the parameters to glTex(Sub)Image* differently from desktop OpenGL. In desktop OpenGL, what defines the actual format of the

Libgdx 3D Texture Transparency

蓝咒 提交于 2019-12-05 16:57:26
I'm having a problem with a texture on a cylinder. Basically it is a coin with a texture on it, I have done this before as demo but lost the code. Now the problem I'm facing is that I cant get the edge of the coin to be transparent anymore. The transparent parts of the png appear white on the cylinder, or even the box I tried. I enabled G20.GL_Blend, have the blending function with alpha_src and one_minus_alpha_src, enabled something like texture_2d. (Srry for the wrong variable names, only on my phone atm, will change @home) I have tried everything I can find online, but it just doesnt change

In openGL. How do you copy part of a texture to another texture

て烟熏妆下的殇ゞ 提交于 2019-12-05 15:53:41
I am trying to create a blank (white with no alpha) texture where I can load other textures and write part of them. I tried just having to get a portion of the texture, and using glTexSubImage2D to put it there it doesn't seem to work right. Anyone have any idea how to do this? What am i doing wrong? int sourceTextWidth; int sourceTextHeight; int sourceFormat; int formatOffset = 0; //bind the texture glBindTexture( GL_TEXTURE_2D, textureID ); //get its params glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPONENTS, &sourceFormat); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE

What is the correct behavior when both a 1D and a 2D texture are bound in OpenGL?

此生再无相见时 提交于 2019-12-05 15:21:41
问题 Say you have something like this: glBindTexture(GL_TEXTURE_2D, my2dTex); glBindTexture(GL_TEXTURE_1D, my1dTex); glBegin... What is the correct OpenGL behavior? To draw the 1d texture, the 2d or both? For each active texture are there actually multiple textures that can be bound to it at the same time (i.e. a 1d, 2d, 3d cube map, etc.)? 回答1: The GL state for the bindings is one texture name per target (i.e. 1D/2D/3D/cube). So when calling glBindTexture(GL_TEXTURE_2D, my2dTex) glBindTexture(GL

Reasonable texture sizes in android

随声附和 提交于 2019-12-05 14:47:25
I'm trying to develop an app that uses opengl on android, and ideally make it run on any phone as old as the original droid (or at least any phone that has OpenGL ES 2.0 support). Currently, I'm using a 2048x2048 ETC1 texture compression. It works fine on the Droid X I'm testing it on, but I currently don't have an original droid to test it on, and I can't find much data on this topic either. I know the G1 didn't do well with textures bigger than 512x512, and the droid seems to do fine with images as large as 1024x1024, but what about 2048x2048? (Again, etc1 compression, so it's about 2 MB

Can an OpenGLES 2.0 framebuffer be bound to a texture and a renderbuffer at the same time?

两盒软妹~` 提交于 2019-12-05 14:27:11
Brad Larson provides some great code here and here for 'rendering your scene into a texture-backed framebuffer', but it's not clear whether this is the same framebuffer that I use for the rest of the drawing. If you attach a renderbuffer to a framebuffer, can the framebuffer also render into a texture with the same call? Arttu Peltonen Sounds like you might be a bit confused with FBO usage. If you need it, this should get you started: Apple Developer - Drawing offscreen . This could help too. Renderbuffer is something you can bind to an FBO (framebuffer object). FBO is something you create

How to write to the OpenGL Depth Buffer

馋奶兔 提交于 2019-12-05 12:22:10
I'm trying to implement an old-school technique where a rendered background image AND preset depth information is used to occlude other objects in the scene. So for instance if you have a picture of a room with some wires hanging from the ceiling in the foreground, these are given a shallow depth value in the depthmap, and when rendered correctly, allows the character to walk "behind" the wires but in front of other objects in the room. So far I've tried creating a depth texture using: glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, Image.GetWidth(), Image.GetHeight(), 0, GL_DEPTH_COMPONENT