Browse Source

build: minor Windows compilation fixes.

legacy
Sam Hocevar sam 12 years ago
parent
commit
a54bb70d64
2 changed files with 26 additions and 8 deletions
  1. +22
    -0
      src/gradient.cpp
  2. +4
    -8
      test/tutorial/tut03.cpp

+ 22
- 0
src/gradient.cpp View File

@@ -14,11 +14,29 @@

#include <cmath>

#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# if defined USE_D3D9
# include <algorithm>
using std::min;
using std::max;
# include <d3d9.h>
# include <d3dx9shader.h>
# endif
#endif

#include "core.h"
#include "lolgl.h"

using namespace std;

#if defined USE_D3D9
extern IDirect3DDevice9 *g_d3ddevice;
#elif defined _XBOX
extern D3DDevice *g_d3ddevice;
#endif

namespace lol
{

@@ -203,7 +221,11 @@ void Gradient::TickDraw(float deltams)
data->m_vdecl->SetStream(data->m_cbo, attr_col);

/* Draw arrays */
#if defined _XBOX || defined USE_D3D9
g_d3ddevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
#else
glDrawArrays(GL_TRIANGLES, 0, 6);
#endif
}

Gradient::~Gradient()


+ 4
- 8
test/tutorial/tut03.cpp View File

@@ -427,7 +427,6 @@ public:

virtual void TickDraw(float deltams)
{
Log::Error("Tick Fractal\n");
WorldEntity::TickDraw(deltams);

static float const vertices[] =
@@ -607,7 +606,7 @@ Log::Error("Tick Fractal\n");
# endif
"}"
#else
"void main(float4 a_Vertex : POSITION,"
"void main(float2 a_Vertex : POSITION,"
" float2 a_TexCoord : TEXCOORD0,"
" uniform float4x4 u_ZoomSettings,"
" uniform float4 u_TexelSize,"
@@ -618,7 +617,7 @@ Log::Error("Tick Fractal\n");
" out float4 v_IndexX : TEXCOORD2,"
" out float4 v_IndexY : TEXCOORD3)"
"{"
" out_Position = a_Vertex;"
" out_Position = float4(a_Vertex, 0.0, 1.0);"
" float4 offsets = float4(0.5, -0.5, 0.015625, -0.015625);"
" float4 zoomscale = float4(u_ZoomSettings[2][0],"
" u_ZoomSettings[2][1],"
@@ -745,8 +744,7 @@ Log::Error("Tick Fractal\n");
m_vdecl->SetStream(m_tbo, m_texattrib);
#if defined _XBOX || defined USE_D3D9
g_d3ddevice->SetTexture(0, m_tex);
//g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
#elif !defined __CELLOS_LV2__ && !defined __ANDROID__
#else
//glEnableClientState(GL_VERTEX_ARRAY);
@@ -756,8 +754,7 @@ Log::Error("Tick Fractal\n");
#endif

#if defined _XBOX || defined USE_D3D9
/* FIXME: what the fuck? Why does "2" not work here instead of 3? */
g_d3ddevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 3);
g_d3ddevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);
#else
glDrawArrays(GL_TRIANGLES, 0, 6);
#endif
@@ -777,7 +774,6 @@ Log::Error("Tick Fractal\n");
//glDisableClientState(GL_VERTEX_ARRAY);
//glDisableClientState(GL_TEXTURE_COORD_ARRAY);
#endif
Log::Error("~Tick Fractal\n");
}

private:


Loading…
Cancel
Save