Index: ddraw/glDirect3DDevice.cpp |
— | — | @@ -128,6 +128,9 @@ |
129 | 129 |
|
130 | 130 | glDirect3DDevice7::glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
|
131 | 131 | {
|
| 132 | + vertices = normals = NULL;
|
| 133 | + diffuse = specular = NULL;
|
| 134 | + ZeroMemory(texcoords,8*sizeof(GLfloat*));
|
132 | 135 | memcpy(renderstate,renderstate_default,153*sizeof(DWORD));
|
133 | 136 | GLfloat ambient[] = {0.0,0.0,0.0,0.0};
|
134 | 137 | identity._11 = identity._22 = identity._33 = identity._44 = 1.0;
|
— | — | @@ -256,9 +259,44 @@ |
257 | 260 | FIXME("glDirect3DDevice7::DeleteStateBlock: stub");
|
258 | 261 | ERR(DDERR_GENERIC);
|
259 | 262 | }
|
| 263 | +int setdrawmode(D3DPRIMITIVETYPE d3dptPrimitiveType)
|
| 264 | +{
|
| 265 | + switch(d3dptPrimitiveType)
|
| 266 | + {
|
| 267 | + case D3DPT_POINTLIST:
|
| 268 | + return GL_POINTS;
|
| 269 | + case D3DPT_LINELIST:
|
| 270 | + return GL_LINES;
|
| 271 | + case D3DPT_LINESTRIP:
|
| 272 | + return GL_LINE_STRIP;
|
| 273 | + case D3DPT_TRIANGLELIST:
|
| 274 | + return GL_TRIANGLES;
|
| 275 | + case D3DPT_TRIANGLESTRIP:
|
| 276 | + return GL_TRIANGLE_STRIP;
|
| 277 | + case D3DPT_TRIANGLEFAN:
|
| 278 | + return GL_TRIANGLE_FAN;
|
| 279 | + default:
|
| 280 | + return -1;
|
| 281 | + }
|
| 282 | +}
|
| 283 | +
|
| 284 | +void glDirect3DDevice7::SetArraySize(DWORD size, DWORD vertex, DWORD texcoord)
|
| 285 | +{
|
| 286 | + if(!vertices) vertices = (GLfloat*)malloc(size*4*sizeof(GLfloat));
|
| 287 | + else if(size > maxarray) vertices = (GLfloat*)realloc(vertices,size*4*sizeof(GLfloat));
|
| 288 | + if(!normals) normals = (GLfloat*)malloc(size*4*sizeof(GLfloat));
|
| 289 | + else if(size > maxarray) normals = (GLfloat*)realloc(normals,size*4*sizeof(GLfloat));
|
| 290 | +}
|
| 291 | +
|
260 | 292 | HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
|
261 | 293 | LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags)
|
262 | 294 | {
|
| 295 | + if(!inscene) return D3DERR_SCENE_NOT_IN_SCENE;
|
| 296 | + int drawmode = setdrawmode(d3dptPrimitiveType);
|
| 297 | + if(drawmode == -1) return DDERR_INVALIDPARAMS;
|
| 298 | + if(dwVertexTypeDesc & D3DFVF_XYZB1) ERR(DDERR_GENERIC);
|
| 299 | +
|
| 300 | + //for(int i = 0; i <
|
263 | 301 | FIXME("glDirect3DDevice7::DrawIndexedPrimitive: stub");
|
264 | 302 | ERR(DDERR_GENERIC);
|
265 | 303 | }
|
Index: ddraw/glDirect3DDevice.h |
— | — | @@ -85,6 +85,7 @@ |
86 | 86 | HRESULT WINAPI SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
87 | 87 | HRESULT WINAPI SetViewport(LPD3DVIEWPORT7 lpViewport);
|
88 | 88 | HRESULT WINAPI ValidateDevice(LPDWORD lpdwPasses);
|
| 89 | + void SetArraySize(DWORD size, DWORD vertex, DWORD texcoord);
|
89 | 90 |
|
90 | 91 | private:
|
91 | 92 | D3DMATRIX matWorld,matView,matProjection;
|
— | — | @@ -98,6 +99,14 @@ |
99 | 100 | int gllights[8];
|
100 | 101 | DWORD lightsmax;
|
101 | 102 | bool inscene;
|
| 103 | + DWORD maxarray;
|
| 104 | + DWORD vertexsize;
|
| 105 | + DWORD texcoordsize;
|
| 106 | + GLfloat *vertices;
|
| 107 | + GLfloat *normals;
|
| 108 | + GLubyte *diffuse;
|
| 109 | + GLubyte *specular;
|
| 110 | + GLfloat *texcoords[8];
|
102 | 111 | };
|
103 | 112 |
|
104 | 113 | #endif //__GLDIRECT3DDEVICE_H |
\ No newline at end of file |
Index: ddraw/glDirectDraw.h |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2011 William Feely
|
| 3 | +// Copyright (C) 2011-2012 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
Index: ddraw/glutil.cpp |
— | — | @@ -29,10 +29,12 @@ |
30 | 30 | if(GLEXT_ARB_framebuffer_object)
|
31 | 31 | {
|
32 | 32 | glGenFramebuffers(1,&fbo);
|
| 33 | + glBindFramebuffer(GL_FRAMEBUFFER,0);
|
33 | 34 | }
|
34 | 35 | else if(GLEXT_EXT_framebuffer_object)
|
35 | 36 | {
|
36 | 37 | glGenFramebuffersEXT(1,&fbo);
|
| 38 | + glBindFramebufferEXT(GL_FRAMEBUFFER,0);
|
37 | 39 | }
|
38 | 40 | }
|
39 | 41 |
|