Comments (5)
Sure! Just use a RenderTexture2D target
to do the render at 240x160 and then render that target.texture
to window size. You can find an example here.
from raylib-go.
I think I nearly have it. My only problem right now would be "RenderTexture2d rendered upside down" issue, which was addressed in the forums.
Because of how DrawTextureRec works differently as I expected, I opted to use DrawTextureEx instead and it works perfectly for my intended use. But the problem is that I can't adjust the rendering height.
I could solve it by rendering it twice on two different textures, but perhaps there is another (and better) method.
from raylib-go.
But the problem is that I can't adjust the rendering height.
I don't understand exactly what you mean, could you post some example of what are you trying to accomplish?
from raylib-go.
In your example, you flipped the texture by its y-axis like so.
// NOTE: Render texture must be y-flipped due to default OpenGL coordinates (left-bottom)
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
I'm using this function to scale my output
raylib.DrawTextureEx(target.Texture, raylib.NewVector2(0, 0), 0, float32(scale), raylib.White)
My texture can be scaled accordingly by using this function, but the texture itself is upside down.
So in order to fix this I've done the following.
raylib.BeginTextureMode(target)
{
//Draw stuff onto the texure
}
raylib.EndTextureMode()
raylib.BeginTextureMode(targetflipped)
{
raylib.DrawTextureRec(target.Texture, raylib.NewRectangle(0, 0, target.Texture.Width, target.Texture.Height), raylib.NewVector2(0, 0), raylib.White)
}
raylib.EndTextureMode()
raylib.DrawTextureEx(targetflipped.Texture, raylib.NewVector2(0, 0), 0, float32(scale), raylib.White)
It feels sort of redundant and I was wondering if there's a better way for doing this.
from raylib-go.
@Pienkaito yeah, that is pretty inefficient. I recommend using DrawTexturePro --
raylib.DrawTexturePro(target.Texture, rl.NewRectangle(0, 0, target.Texture.Width, -target.Texture.Height), rl.NewRectangle(0, 0, target.Texture.Width, target.Texture.Height), rl.Vector2{0, 0}, 0, rl.White)
from raylib-go.
Related Issues (20)
- Try to use raylib gui but go fail to buid HOT 4
- `raygui.TextBox()` does not update text HOT 1
- `raygui.TextBox()` space character not working properly HOT 1
- Android build failing, undefined symbol: internal_storage_path & asset_manager HOT 6
- [IMPORTANT] GLFW error and wrong (0,0) position HOT 11
- WASM HOT 1
- Building for Android arm64 HOT 2
- Intermittent SIGBUS: bus error When uploading a custom mesh to gpu HOT 1
- log android HOT 2
- how get jni acces? HOT 9
- cannot locate symbol "internal_storage_path" HOT 12
- Dear IMGUI support HOT 1
- 2 or 3 second build times? HOT 2
- Misleading use of color type RGBA. HOT 2
- No function for `GuiLoadIcons` HOT 1
- Cross compiling error HOT 6
- Can't debug via go-delve on M1 MacOS. (missing rodata struct member) HOT 1
- Issues with using DLL on Windows HOT 1
- Adding `SwapScreenBuffer()` and `PollInputEvents()` functions HOT 3
- Can not build for windows/darwin HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from raylib-go.