1
Graphics / Incredibly slow colored tile rendering. optimization help?
« on: March 06, 2011, 01:05:20 am »
I tried making similar opengl-calls, although not the correct ones, they were approximately as stressfull as they will be if i implement my own opengl drawing methods.
I noticed there's the sf::shape class, is this faster than an sf::sprite with no image?
I could also write my own subclass of sf::Drawable so that i have full control of what is drawn. What's the best approach?
EDIT: Forgot to mention: The opengl calls did almost nothing to the fps.
EDIT2: With nothing I mean that it's still ~70fps
EDIT3:
Okay, i tried subclassing sf::Drawable, but i'm having a bit of trouble. Can anyone tell me what's wrong with the following code?
I noticed there's the sf::shape class, is this faster than an sf::sprite with no image?
I could also write my own subclass of sf::Drawable so that i have full control of what is drawn. What's the best approach?
EDIT: Forgot to mention: The opengl calls did almost nothing to the fps.
EDIT2: With nothing I mean that it's still ~70fps
EDIT3:
Okay, i tried subclassing sf::Drawable, but i'm having a bit of trouble. Can anyone tell me what's wrong with the following code?
Code: [Select]
#ifndef PIXEL_H
#define PIXEL_H
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Drawable.hpp>
class Pixel: public sf::Drawable {
virtual void Render(sf::RenderTarget& Target) const{
sf::Color color = GetColor();
glColor4i(color.r, color.g, color.b, color.a); //using this line gives no tile at all
// glColor3i(0xff, 0xff, 0xff); //when i use this line, i get a black tile
glRecti(0,0,1,1);
}
};
#endif