Wednesday, July 13, 2022
HomeGame Developmentrecreation loop - How can I render a texture in a particular...

recreation loop – How can I render a texture in a particular x/y place on the display? (OpenGL – glium)


I’m within the technique of writing a 2D recreation in Rust, and determined to make use of glium for the graphics half. To date I am doing effective, in a position to render textures and shapes completely.

Now comes an important half the place I get the mouse coordinates, after which each time I click on, a texture might be positioned underneath the mouse cursor. I’ve applied the primary two components of listening on mouse motion and mouse down occasions, so now I’ve to load the feel and go it is place on the vertex buffer.

From my understanding, I’ve to transform my mouse’s X and Y from window coordinates to OpenGL coordinates (-1, 1), then go these to the vertex buffer. This nonetheless would not make any sense on my head although.

(You may reply even in case you have no idea about glium; I understand how to implement uncooked OpenGL calls to glium calls).

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments