blob: 0b29f78ef0e9dcd421bcc4bb1c8a9ab9762f7104 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "pointsprite.h"
#include "gl.h"
PointSprite::PointSprite(float _size, const Texture& _texture) : texture(_texture) {
size = _size;
}
void PointSprite::draw(const Vector2& pos) const {
texture.bind();
glPointSize(size);
glBegin(GL_POINTS);
glVertex2f(pos.x, pos.y);
glEnd();
}
void PointSprite::draw_array(void* ptr, unsigned int coords, unsigned int stride, unsigned int first, unsigned int num) {
texture.bind();
glPointSize(size);
glVertexPointer(coords, GL_FLOAT, stride, ptr);
glDrawArrays(GL_POINTS, first, num);
}
|