Questions tagged [viewport]

An area (typically rectangular) expressed in rendering-device-specific coordinates, e.g. pixels for screen coordinates, in which the objects of interest are going to be rendered

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

Setting glOrtho and glViewport so top-left of window has coordinates (0,0)

I haven't used OpenGL for a long time and have trouble setting up a 2D screen where the upper left window coordinates are (0,0) and the width and height of the ...
0 votes
1 answer
39 views

Multiple viewport resizing

I wonder how multiple viewports are handled in engines in terms of render targets buffers. Especially in the case of their resizing (for example changing the size of windows/viewports in Editor dock ...
  • 11
1 vote
2 answers
67 views

How to make a collision object within a viewport detect mouse inputs?

I am working on a 2D game with a spatial node (a 3d node) inside a viewport. Nodes within the viewport should be able to detect user input from what I can find online, but for some reason it doesn't ...
  • 11
1 vote
0 answers
65 views

Drawing angle between 2 rays

Currently, we can draw rays in real time, like this: ...
2 votes
1 answer
586 views

Spritesheet with unstable width

I'm working on my 2d game engine using HTML5 and Canvas. I have a sprite sheet, and each frame of this sprite sheet has its own size. Considering that the Viewport is following this sprite sheet (in ...
0 votes
1 answer
130 views

Calculating view matrix from rotation, elevation and location

I have the rotation(A), elevation(B) and location(C) of a camera in a left handed 3d space. +...
  • 101
2 votes
1 answer
425 views

How to access a ViewportTexture's depth data as an image?

I make use of ViewportTextures, kind of like rendering security cameras on screens. Now, I'd need to access the depth textures to do some comparison of images / pixels. How do I access the depth data ...
  • 1,048
0 votes
1 answer
58 views

OpenGL translation based on “scaled” pixels? (Not physical pixels)

My (2D!) game runs in a “scaling mode” so to speak, and I’ve yet to find anyone asking this question anywhere. Basically, I want to achieve a sort of “scaling algorithm” whether graphics are ...
0 votes
1 answer
264 views

How to convert from frag position to UV coordinates when my viewport doesn't cover the screen?

So, I'm implementing SSAO as part of my rendering pipeline using OpenGL/GLSL. It works pretty well when I have a camera that takes up the entire screen. However, when my camera is smaller than the ...
  • 103
0 votes
0 answers
31 views

DIY hologram experiments split screen

I am currently experimenting with the DIY holograms. Does anyone know to split my windows into 4 perpendicular identical displays like this but for Windows? I am using Unreal Engine & I want it to ...
0 votes
1 answer
1k views

Change Unity 3d viewport shortcuts to match Blender?

The shortcuts in Unity are more similar to Maya (Alt+Middle for 3d orientation, LeftClick select, etc). I've looked into Edit -> Shortcuts but couldnt find them. Is there any way to do this?
0 votes
0 answers
30 views

How to check what part of an gameobject is seen by a camera?

Could anyone please give me a hint on how to determine how much of an object is seen by a camera. There have to be a threshold value (e.g. 30% of an object is seen). If value is below the threshold ...
0 votes
1 answer
56 views

Why is there grey haze that appears when game is simulated in viewport, and how do I fix it?

For some reason when the game runs in the regular viewport (not it's own) a grey haze slowly appears. This never used to happen. The level architecture (code) changed recently and then this started ...
0 votes
0 answers
36 views

How can I instantiate enemies in a 2D game at a set Viewport Position before my camera enters the room? (Or alternative solution!)

I'm currently working on a 2D game where I'm trying to pre-populate my level with encounters, I want the enemies already in the room when the player enters. Right now the encounter is triggered upon ...
1 vote
1 answer
920 views

How to do in Godot 2D: game screen in one viewport and minimap in another. Different sprites on each

The second day I google the tutorials, but nothing comes of it. All tutorials link to splitscreen demo, but it is made under the second Godot and does not work in the third. The problem is this: I ...
  • 241
0 votes
0 answers
617 views

OpenGL viewport is stretched

For this project I am using GLFW, glad and glm. My window looks like this: The dimensions of the window are correct, but the viewport is stretched, making my square into a rectangle. How do I use a ...
0 votes
1 answer
61 views

How to draw a rectangle with a border pixel over a camera/viewport?

With this code I intended to visually delimit the complete view of the circuit and the two controlled cars: ...
0 votes
0 answers
41 views

Confused on graphics rendering

Implementing a viewport is just a rectangular space on the back buffer usually a 2d texture set to the size of the client window that we render to. However in direct3d when we describe the viewport ...
0 votes
1 answer
17 views

Problem displaying drawing of a path in camera/viewport

I have an adm object, which draws the path in the room like this (Object ADM - Draw Event): ...
0 votes
1 answer
91 views

Keep player within screen bounds, top down shooter

I am using x and z axis to go left/right ; up/down respectively. The Camera is on the y-axis. I have the following code so far - private float playerWidth; private float playerDepth; ...
2 votes
1 answer
287 views

How do I render a cylindrical world space onto a flat, 2D view port in Unity?

The question is just a logical extension of this question. So, how should I render a cylindrical world space onto a flat, 2D view port in Unity? Thank you.
0 votes
1 answer
952 views

Unity | Camera - Follow target with view port point's offset from center

Some additional remarks before I address the issue: How Viewports work in Unity: Whatever the dimensions of the screen's rect, the viewports coordinates are mapped in normalized coordinates, where 0 ...
0 votes
1 answer
118 views

World position reconstruction from depth fails when viewport size does not match window size

I'm facing very strange issue. My code for world pos reconstruction works correctly when the viewport size is equal to window size (or framebuffer size in other words). Below is the part for ...
  • 690
0 votes
1 answer
682 views

Transforming 2D viewport coordinates after scaling the viewport (zoom in/out)

I've been getting started with personal experimentation and have been working on a project for a few days now using SDL2. It is a 2D game, and at this stage I have it rendering game objects in a fixed-...
  • 1
2 votes
0 answers
817 views

Why doesn't the Camera.pixel(Height/Width) match the Canvas size?

I am making an app that has a custom viewport Rect like so: When I check the sizes of this viewport rectangle in pixels with Camera.pixelHeight; Camera.pixelWidth,...
2 votes
2 answers
249 views

Custom Camera View Fustrum in Unity

Is it possible in Unity to make some sort of bounding box (with a running application) within the current viewpoint of the actual screen? Let me explain: I'm working on a project which uses a ...
0 votes
1 answer
105 views

Setting up a low res viewport to stretch in Unity

I am working on porting a low-res game over to Unity. In my previous engine, I had the option to set a native resolution (say, 160 x 144), and it would automatically stretch when the player entered ...
  • 1,327
1 vote
0 answers
251 views

Performance problems with scrolling html5 canvas for large tile-based game

I try programming a splix.io clone as an electron app and do the visualization via the html5 canvas. The movement across the tiles should look fluent like the original, so I target 60 frames a second. ...
  • 11
0 votes
1 answer
488 views

Javascript/HTML5 canvas: Integrate scrolling tilemap with map server

I am playing around adapting the example code at Mozilla Dev Network: Square tilemaps implementation: Scrolling maps to fit with a server I wrote myself. There's a link to the original source code at ...
0 votes
2 answers
117 views

How to keep an object in a certain part of the camera view?

I have a 3d camera that is viewing a character that is moving. As the character is moving i want the camera to adjust itself so as to keep the character in the left third of the camera view. I ...
  • 101
-3 votes
1 answer
234 views

Making Minecraft in 2D. Blocks move when player moves

I want to make a 2D Minecraft game and I have drawn the grass blocks and you can dig but when the palyer moves the dirt moves too. It draws on every block wich the player touches a dirt block because ...
0 votes
1 answer
505 views

How to load/unload chunks data where view port is currently focused on?

I have a 2D tile based engine with infinite procedural chunk generation. But I can't invent an algorithm, that will fill only chunk tiles on view port (and destroy old). Pls help ViewPort size can ...
1 vote
2 answers
499 views

What is moving the camera useful for, if I have to do culling myself?

I'm new to libgdx and especially to using OrthographicCameras. I'm trying to understand how useful they are. The question is, suppose I have a game map 500 units wide. I have an OrtographicCamera ...
1 vote
1 answer
572 views

3D camera - window resolution relation

I'm having a bit of an issue when it comes to 3D- and 2D camera(s), in relation to a game's window resolution. I want to let the player choose from different window resolutions, either from a menu or ...
0 votes
1 answer
225 views

How do I deal with this tilemap wraparound edge case?

I'm building a 2D game engine that uses tilesets to build levels. I recently added functionality to handle wraparounds (ie. where the right edge of the map connects to the left edge.) The engine ...
0 votes
2 answers
398 views

LibGDX - GameWorld Dimensions vs ViewPort Dimensions vs Camera Dimensions

Before someone mark it duplicate - I am aware that there are few questions already on this topic but the explanations are all theoretical and no graphical elaboration was provided which I think will ...
  • 105
1 vote
0 answers
632 views

get position of GameObject on rendertexture from camera

I'm rendering the camera output to an rendertexture on a plane. This works fine. But I want to put GameObjects on the rendertexture on positions of world objects that are visible on the camera. <...
1 vote
0 answers
69 views

Implementing navigatable achievement menu in javascript

I am in the process of learning javascript for game design, and wanted to make a separate achievement page that the user can navigate to that will allow them to check their achievements on various ...
  • 11
0 votes
2 answers
4k views

How to restrict the players movement win relation to screen bounds in Unity? (Without colliders)

I am really enjoying making the switch to Unity. But here I have found one of those rare moments where it appears to make things more difficult (at least it is for me as I am crap at understanding the ...
2 votes
1 answer
1k views

LibGDX - Camera and viewport initialization in show()?

I'm reading the book LibGDX game development by example and the author tends to follow a pattern like ...
  • 23
-1 votes
1 answer
155 views

How to smooth viewport panning when using minimap (in typical RTS)?

Let's take typical modern RTS game which features a large map (say 256x256 tiles). There's also a minimap in the GUI, typically up to 256x256 pixels in size. (Let's take these numbers for upcoming ...
  • 10.1k
3 votes
4 answers
2k views

How and when do the model to world, world to view, et cetera multiplications happen?

I learn matrix transformations for game design and I struggle with some basic concepts. I see the actual multiplication taking place before rendering in this sequence: MODEL into WORLD: multiply each ...
  • 281
2 votes
2 answers
1k views

How can I add solid collideable borders to the viewport regardless of the resolution?

I'm making a game in Unity. In my game I have a sphere, what I need is for the sphere to rebound against the edges of the viewport. For that I used a few Gameobjects with 2D box colliders. The ...
1 vote
1 answer
2k views

Using Multiple Viewports in LibGDX?? help needed badly

I've asked this question before but i am still unclear of how to do this after hours of frustration I have messed up yet another decent project I've been working on. I had a fully functioning Snake ...
2 votes
1 answer
1k views

Gdx.graphics.getWidth() vs cam.viewport width

I'm facing difficulty understanding the difference between Gdx.graphics.getWidth() vs cam.viewportwidth, What is the difference?
1 vote
0 answers
347 views

Libgdx handle screen resolutions

I know there are some questions to this topic, but i didnt find a satisfying answer for my problem yet. I'm learning to use libgdx right now, and I'm not sure about handling different screen ...
  • 121
1 vote
2 answers
5k views

Drawing only objects that are currently in viewport [Gamemaker]

Following on from my previous question about optimising large object counts in Gamemaker, I am looking for a method for the solution proposed by liggiorgio. My game has large numbers of small, sprite-...
0 votes
1 answer
1k views

How to calculate 2D viewport coordinates in a shader?

In Unity, I use the following shader to calculate 2D viewport coordinates : ...
  • 3,142
1 vote
1 answer
534 views

glViewport and single-pass cubemap rendering

This question is related to another question of mine on StackOverflow. The problem I'm facing is that while I'm rendering to a cubemap in a single pass using a geometry shader (like I show in my ...
  • 253
4 votes
2 answers
8k views

How to use the SDL viewport properly?

I'm very confused about the SDL2 viewport, I did some googling to find out how to implement it but people keep mentioning things like "world coordinates" which I don't have in my game. Question : Do ...
  • 469