1
0
forked from 0ad/0ad

ScEd: add mathutil header (seems to be required now, no longer included automatically); update to ogl_tex API (they have long been renamed in ps); fix issue with PS_CRect vs CRect

ogl_tex: add diagnostic code to track down ScEd crash

This was SVN commit r3159.
This commit is contained in:
janwas 2005-11-19 22:27:53 +00:00
parent 59f9e37930
commit 0491a7980d
6 changed files with 17 additions and 11 deletions

View File

@ -227,9 +227,14 @@ static GLint choose_int_fmt(GLenum fmt, uint q_flags)
return half_bpp? GL_RGBA4 : GL_RGBA8;
default:
{
wchar_t buf[100];
swprintf(buf, ARRAY_SIZE(buf), L"choose_int_fmt: fmt 0x%x isn't covered! please add it", fmt);
DISPLAY_ERROR(buf);
debug_warn("given fmt isn't covered! please add it.");
// fall back to a reasonable default
return half_bpp? GL_RGB4 : GL_RGB8;
}
}
UNREACHABLE;

View File

@ -1,5 +1,6 @@
#include "precompiled.h"
#include "MathUtil.h"
#include "EditorData.h"
#include "ui/UIGlobals.h"
#include "ToolManager.h"
@ -528,7 +529,7 @@ void CEditorData::OnDraw()
bool CEditorData::LoadTerrain(const char* filename)
{
Handle h = tex_load(filename);
Handle h = ogl_tex_load(filename);
if(h<=0) {
char buf[1024];
sprintf(buf,"Failed to load \"%s\"",filename);
@ -536,17 +537,13 @@ bool CEditorData::LoadTerrain(const char* filename)
return false;
} else {
int width=0;
int height=0;
int bpp=0;
uint width=0;
uint height=0;
uint bpp=0;
void *ptr=0;
int i=tex_info(h, &width, &height, NULL, &bpp, &ptr);
if (i)
{
printf("tex_info error: %d\n",i);
fflush(stdout);
}
(void)ogl_tex_get_size(h, &width, &height, &bpp);
(void)ogl_tex_get_data(h, &ptr);
// rescale the texture to fit to the nearest of the 4 possible map sizes
u32 mapsize=9; // assume smallest map

View File

@ -1,6 +1,7 @@
#include "precompiled.h"
#include "timer.h"
#include "MathUtil.h"
#include "CommandManager.h"
#include "ObjectEntry.h"
#include "Unit.h"

View File

@ -10,6 +10,7 @@
#include "Terrain.h"
#include "LightEnv.h"
#include "MathUtil.h"
#include "CommandManager.h"
#include "AlterLightEnvCommand.h"

View File

@ -11,6 +11,7 @@
#include "lib/res/file/vfs.h"
#undef _IGNORE_WGL_H_
#include "MathUtil.h"
#include "ScEd.h"
#include "ScEdView.h"
#include "MiniMap.h"

View File

@ -108,7 +108,7 @@ CTerrainGroup *CTexToolsDlgBar::GetCurrentTerrainType()
BOOL CTexToolsDlgBar::BuildImageListIcon(CTextureEntry* texentry)
{
// bind to texture
g_Renderer.BindTexture(0,tex_id(texentry->GetHandle()));
ogl_tex_bind(texentry->GetHandle());
// get image data in BGRA format
int w,h;
@ -187,6 +187,7 @@ BOOL CTexToolsDlgBar::AddImageListIcon(CTextureEntry* texentry)
BOOL CTexToolsDlgBar::OnInitDialog()
{
#undef CRect // we want MFC's def, not PS_CRect
// get the current window size and position
CRect rect;
GetWindowRect(rect);