Tag Info

New answers tagged

0

You need to disable textures before drawing the quads. Here's basically what's going on: You enable textures (in setCamera). You draw a button which: Draws a quad (which is textured, not just a solid color, but texcoords aren't set so...weirdness happens, and it might not be entirely predictable) Then you draw text (correctly) by: Enabling textures. ...


0

ideally, you configure group/mask for your lights and objects. Using this, you can tell your point light to ignore those branches. See a great write-up here. alternatively, as a brute force approach, you could render lights before you draw your branch (though you should REALLY use the mask approach above): // draw all objects that should create shadows ...


0

What I have found is that is good to make a handler class that has a list of GameObjects and draws, ticks(update) and can add new objects. ex: import java.awt.Graphics; import java.util.LinkedList; public class Handler { public LinkedList<GameObject> objects = new LinkedList<GameObject>(); private GameObject temp; public void tick(){ ...


0

It is not necessarily a better way to have a separate class to draw your entities. It is just one way how to implement how your entities get drawn. But to answer your question. One way could be that each of your entities give access to the the data which are necessary to draw a entity. As soon as your entity provides such function then your rendering ...


0

To render in a seperate class create a Renderer.java file with a single method named render and create an instance of it in the create() method of your main game class called Renderer renderManager = new Renderer() (filling in any constructors you need). In the render() method of your main game class call renderManager.render(). Now any code that would ...


0

Two things others didn't mention: The ripples in the water surface are made by Bump-mapping, where you use a texture to add fake depth to your objects(a.k.a. Normal mapping). You could even animate this with noise, so you don't need a texture, just GLSL noise generation.(Quite simple and awesome effect) The very subtle "fog" around the planet might be a ...


1

It is absolutly possible. Here's a simple class that, when called, will save a screenshot of the main graphical context: public class ScreenshotFactory { private static int counter = 1; public static void saveScreenshot(){ try{ FileHandle fh; do{ fh = new FileHandle("screenshot" + counter++ + ".png"); ...


2

I don't know which platform you're working on, but on most modern platforms, all culling and clipping happens after vertex transformations, but before fragment shading. You can do some custom pre-culling, and not issue draw commands for objects you know won't be visible, but once you ask some triangles to be drawn, it's not until you apply view and ...


0

You can use SDL_LockTexture and SDL_UnlockTexture for write only access to a texture created with the SDL_TEXTUREACCESS_STREAMING flag. Lock, write, unlock, then use SDL_RenderCopy to blit to the screen. Create the buffer with SDL_CreateTexture (modify to you liking): SDL_Texture* buffer = SDL_CreateTexture(renderer, ...


0

Using SpriteBatch is likely going to be the best option. Passing your batch as an argument to another class' method is generally not going to have any noticeable performance impact. This is also a very easy way of going about the problem because you can just call batch.draw() on your textures inside the desired method.


3

Welcome to the tutorial to discooridnated chromatic effect. The above is an example of screen distortion. It is necessary to understand the first type of screen distortion in order to understand the final effect listed second. It is achieved by having screen coordinate texture then applying the altered screen coordinate when rendering the final scene. ...


0

I'm not sure if this method is completely possible with unity/shaders, but I think this is a method that could work. For each colour channel; define what I would call a "warp field". A "warp field" in this case would be a 2 dimensional array of Vector2s, with each element corresponding to a pixel on screen. (you could have this representation at a lower ...


0

Learning Python is very easy I found a code in the internet and customized it to render from 8 different view port while fixing the lamp and camera location, the code also scales the objects to fit in 1 meter cube so the camera and lamp can be fixed correctly. I succeed to write the following code in one night! Thanks to Python! and Blender API ...


0

Are the sprites drawing over the text? Text isn't a special thing, it's just another sprite you render to the screen (albeit one you generate in a special way). If you render the text and then at the same position render a sprite you won't see the text because there is something in front of it. Render the texts after rendering the sprites.



Top 50 recent answers are included