## Rotate a Image OpenGL ES

ascft
Posts: 7
Joined: Tue May 10, 2016 4:10 pm

### Rotate a Image OpenGL ES

Hi,
I'm a beginner in OpenGL ES and I use this code to understand how it works :
https://github.com/neagix/librpi2d/tree ... ples/basic

Now I just want to know how to rotate a simple png image in this code. I've some difficulties this that

PeterO
Posts: 4867
Joined: Sun Jul 22, 2012 4:14 pm

### Re: Rotate a Image OpenGL ES

In openGL ES this is trivial. Just assign different coordinates to the triangles vertices that make up your rectangle. Or swap them over in the vertex shader.
But you aren't using openGL ES directly so I don't know what you can do.

PeterO

PS: I see the source for librpi2d is at the address you posted, I think you are going to have to customise some of the functions to swap around the vertex coordinates,

Look at Raspberry2D::makeVertices and Raspberry2D::DrawTile in rpi2d.cpp to see how the vertices are set up.
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

ascft
Posts: 7
Joined: Tue May 10, 2016 4:10 pm

### Re: Rotate a Image OpenGL ES

I'm trying to arrange the Raspberry2D::makeVertices by adding an 'angle' in the parameters. I don't really understange how to change the coodinates.
I know there is the package esUtil and other function, like in OpenGL ES, glRotatef(angle, x, y, z). But I'm a little bit confused and I don't really know I to process.

raysan5
Posts: 37
Joined: Tue Sep 30, 2014 4:44 pm
Location: Barcelona
Contact: Website

### Re: Rotate a Image OpenGL ES

Maybe you can try using raylib (www.raylib.com). It's a simple library over OpenGL that works on RPI.

raylib RPI building instructions: https://github.com/raysan5/raylib/wiki/ ... spberry-Pi

Here it is an example of texture rotation and scaling: http://www.raylib.com/examples_web/exma ... rec_dstrec