[Change] Single GLUQuadric object.
[Fix?] Was meant to have fixed laser drawing, I kinda failed. :D
This commit is contained in:
parent
e43c75060f
commit
d0f3ff9d42
@ -75,6 +75,7 @@ public:
|
||||
static SpaceStationView* spaceStationView;
|
||||
|
||||
static ShipCpanel* cpan;
|
||||
static GLUquadric* gluQuadric;
|
||||
|
||||
private:
|
||||
static void InitOpenGL(void);
|
||||
|
@ -43,6 +43,7 @@ StarSystem* L3D::selected_system;
|
||||
MTRand L3D::rng;
|
||||
double L3D::gameTime;
|
||||
float L3D::frameTime;
|
||||
GLUquadric* L3D::gluQuadric;
|
||||
|
||||
void L3D::Init(IniConfig& config) {
|
||||
int width = config.Int("ScrWidth");
|
||||
@ -104,6 +105,8 @@ void L3D::InitOpenGL() {
|
||||
|
||||
glClearColor(0, 0, 0, 0);
|
||||
glViewport(0, 0, scrWidth, scrHeight);
|
||||
|
||||
gluQuadric = gluNewQuadric();
|
||||
}
|
||||
|
||||
void L3D::Quit(void) {
|
||||
@ -234,9 +237,6 @@ void L3D::MainLoop(void) {
|
||||
|
||||
SetView(world_view);
|
||||
|
||||
GLUquadric* quad = gluNewQuadric();
|
||||
gluQuadricOrientation(quad, GLU_INSIDE);
|
||||
|
||||
Uint32 last_stats = SDL_GetTicks();
|
||||
int frame_stat = 0;
|
||||
char fps_readout[32];
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "libs.h"
|
||||
#include "planet.h"
|
||||
#include "frame.h"
|
||||
#include "l3d.h"
|
||||
|
||||
Planet::Planet(StarSystem::SBody::SubType subtype) : Body() {
|
||||
m_radius = 6378135.0;
|
||||
@ -33,10 +34,6 @@ void Planet::SetRadius(double radius) {
|
||||
}
|
||||
|
||||
void Planet::Render(const Frame* a_camFrame) {
|
||||
static GLUquadricObj* qobj = NULL;
|
||||
|
||||
if(!qobj) qobj = gluNewQuadric();
|
||||
|
||||
glPushMatrix();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
@ -63,7 +60,7 @@ void Planet::Render(const Frame* a_camFrame) {
|
||||
glEnd();
|
||||
glEnable(GL_LIGHTING);
|
||||
} else {
|
||||
gluSphere(qobj, rad, 100, 100);
|
||||
gluSphere(L3D::gluQuadric, rad, 100, 100);
|
||||
}
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glPopMatrix();
|
||||
|
@ -29,21 +29,10 @@ SectorView::SectorView(void) : GenericSystemView() {
|
||||
m_zoomOutButton->SetShortcut(SDLK_F8, KMOD_NONE);
|
||||
m_rightButtonBar->Add(m_zoomOutButton, 66, 2);
|
||||
|
||||
GLUquadricObj* qobj = gluNewQuadric();
|
||||
|
||||
/*
|
||||
m_gluSphereDlist = glGenLists(1);
|
||||
glNewList(m_gluSphereDlist, GL_COMPILE);
|
||||
gluDisk(qobj, 0.0, 0.2, 32, 1);
|
||||
glEndList();
|
||||
*/
|
||||
|
||||
m_gluDiskDlist = glGenLists(1);
|
||||
glNewList(m_gluDiskDlist, GL_COMPILE);
|
||||
gluDisk(qobj, 0.0, 0.2, 20, 1);
|
||||
gluDisk(L3D::gluQuadric, 0.0, 0.2, 20, 1);
|
||||
glEndList();
|
||||
|
||||
gluDeleteQuadric(qobj);
|
||||
}
|
||||
|
||||
SectorView::~SectorView(void) {
|
||||
|
@ -137,5 +137,9 @@ void Ship::Render(const Frame* camFrame) {
|
||||
strncpy(params.pText[0], GetLabel().c_str(), sizeof(params.pText));
|
||||
|
||||
RenderSbreModel(camFrame, stype.sbreModel, ¶ms);
|
||||
glPushMatrix();
|
||||
TransformToModelCoords(camFrame);
|
||||
RenderLaserfire();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "libs.h"
|
||||
#include "star.h"
|
||||
#include "l3d.h"
|
||||
|
||||
Star::Star(StarSystem::SBody::SubType subtype): Body() {
|
||||
m_subtype = subtype;
|
||||
@ -21,10 +22,6 @@ void Star::TransformToModelCoords(const Frame* camFrame) {
|
||||
}
|
||||
|
||||
void Star::Render(const Frame* a_camFrame) {
|
||||
static GLUquadricObj* qobj = NULL;
|
||||
|
||||
if(!qobj) qobj = gluNewQuadric();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glPushMatrix();
|
||||
@ -44,7 +41,7 @@ void Star::Render(const Frame* a_camFrame) {
|
||||
|
||||
//TransformToModelCoords(a_camFrame);
|
||||
glColor3fv(StarSystem::starColors[m_subtype]);
|
||||
gluSphere(qobj, rad, 100, 100);
|
||||
gluSphere(L3D::gluQuadric, rad, 100, 100);
|
||||
glPopMatrix();
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
Loading…
Reference in New Issue
Block a user