textures

C++ SDL2 Error when trying to render SDL_Texture: Invalid texture

佐手、 提交于 2019-12-08 00:23:31
问题 I'm trying to make a simple game and when I try rendering my SDL_Texture , I get an inexplicable error. I've set up everything right, I'm able to successfully clear the screen with SDL_RenderClear , and my texture isn't null, so it should have been created properly. But when I try calling the render() function I get an error, and SDL_GetError() returns "Invalid texture". Edit: I have now created an MCVE as requested, and I tested it to verify that it reproduces the error. It should display

sphere texture mapping error

人盡茶涼 提交于 2019-12-07 23:58:29
问题 i use D3DXCreateSphere method to create sphere mesh. and i want to apply an earth texture on it. i calculate the texture coordinate in pixel shader with following code: sampler ShadeSampler = sampler_state { Texture = (ShadeTex); AddressU = Mirror; AddressV = Mirror; MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; }; PS_OUTPUT PSMain(VS_OUTPUT input){ PS_OUTPUT output = (PS_OUTPUT)0; vector uv; uv.x = 0.5 + atan2(input.normal.z, input.normal.x) / piMul2; uv.y = 0.5f - asin(input

Binding Multiple Textures to One Mesh in OpenGL ES 1.1

元气小坏坏 提交于 2019-12-07 20:40:29
问题 If I have a mesh (such as a cube with 6 faces, each consisting individually of 4 vertices, totaling 24 vertices) and I want to apply a different texture to each face, how would I do this? Currently I draw the entire mesh (all 6 faces of a cube) at once using glDrawElements(), supplying all of the indices into one buffer. I cannot see a way to apply a texture to a subset of the indices when drawing. Would I have to split up the indices, drawing each face one-by-one, rebinding textures between

How to cache complex item into texture and release the memory for the actual complex item?

谁都会走 提交于 2019-12-07 19:38:26
I've got a big number of items that are quite complex (memory-heavy), and in order to fit in limited RAM, I want to cache some of them into textures and not keep the actual complex item in memory. In particular, items for which I want to do that are all those (among my complex items) that do not currently need to animate (and this means most of them). For the purposes of this question I call this kind of items "inactive". My plan was: When an item "foo" becomes inactive: Create dynamically a ShaderEffectSource (with no associated ShaderEffect ) with live: false; source: foo , in the same

OpenGL on Android - Texture Mapping - Only top left pixel visible

流过昼夜 提交于 2019-12-07 19:07:29
问题 I've been playing with OpenGL ES Android and somehow my textures are always filled with the color of the the top left-most pixel. I suppose the flags are wrong, but I've tried a many logical combinations and it does not seem to make any difference. Why would the texture behave like so? What's the bit (flag bit indeed) that am I missing? Thanks public void loadGLTexture(GL10 gl, Context context) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId); gl

2D Texture gets distorted when making a sub-pixel translation

空扰寡人 提交于 2019-12-07 16:23:10
问题 I would like to know a theoretical reasoning why is this even possible: how translation of the geometry is related to the texture mapping. I can only notice this effect when making a sub-pixel translation, texture looks fine if translated by entire pixel(s). I am using orthographic projection, GL_CLAMP_TO_EDGE , GL_NEAREST , fragment shader is highp . Texture coordinates is a subregion of the atlas, but I can see the distortion even if the entire atlas is mapped. Using OpenGL ES (Android and

In game Images disappear on Android device if i run from widget, but not when I install apk first time

时光总嘲笑我的痴心妄想 提交于 2019-12-07 15:17:03
问题 I created a game in with LibGDX, which works fine on my computer. I created a debug .apk in Android Studio via the Gradle View -> Build & then copied my android-debug.apk & android-debug-unaligned.apk to the download folder of my Android Device. Now when on my android device I clicked on one of my files the device ask if I wanna install it and choose yes and subsequently I open my game and it run fine. Now the porblem occurs when i quite the game and try to restart the game from the widget

What are the risks of loading textures from images at runtime in XNA?

眉间皱痕 提交于 2019-12-07 14:41:30
问题 What is there to know about (apart from only being able to do that on PC) loading textures from images at runtime? 回答1: I've been exclusively loading my textures from streams as well, and the only "danger" that I can come up with is Premultiplied Alphas. You'll either need to process each texture as you load it, or render with premultiplied alphas disabled. Shawn Hargreaves wrote a great blog article on this subject. In the comments, he mentions: If you don't go through our Content Pipeline,

iPhone, float textures

柔情痞子 提交于 2019-12-07 13:43:07
问题 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? 回答1: Sadly, OpenGL ES treats the parameters to

draw texture in OpenGL Android from 0,0 coordinates

泪湿孤枕 提交于 2019-12-07 13:35:44
问题 I'm new to opengGL and excuse if the questions are too naive. I'm going through some tuturials for seeking help on learning this. I have a small program written where i'm drawing a texture on a GLSurfaceView. I want to draw a number of textures(bitmap images) in a sequential order starting from 0,0 coordinates. Also I need some gap in images on the screen. Please help. Do I need to change the positioning of vertices buffer. please suggest. Here is my renderer Code. public class GlRenderer