@@ -51,12 +51,87 @@ MyBlit(
51
51
if (!bSenderInitialized)
52
52
{
53
53
printf (" Create sender\n " );
54
+ HWND m_hwnd;
55
+ HDC m_hdc;
56
+ HGLRC m_hRC;
57
+ HGLRC m_hSharedRC;
58
+ bool bOpenGL = false ;
59
+
60
+ m_hwnd = CreateWindow (L" BUTTON" , L" VDJ Sender" , WS_OVERLAPPEDWINDOW | CS_OWNDC, 0 , 0 , 32 , 32 , NULL , NULL , NULL , NULL );
61
+
62
+ if (!m_hwnd)
63
+ {
64
+ printf (" InitOpenGL error 1\n " );
65
+ MessageBoxA (NULL , " Error 1\n " , " InitOpenGL" , MB_OK);
66
+ }
67
+
68
+ m_hdc = GetDC (m_hwnd);
69
+ if (!m_hdc)
70
+ {
71
+ printf (" InitOpenGL error 2\n " );
72
+ MessageBoxA (NULL , " Error 2\n " , " InitOpenGL" , MB_OK);
73
+ }
74
+
75
+ PIXELFORMATDESCRIPTOR pfd;
76
+ ZeroMemory (&pfd, sizeof (pfd));
77
+ pfd.nSize = sizeof (pfd);
78
+ pfd.nVersion = 1 ;
79
+ pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
80
+ pfd.iPixelType = PFD_TYPE_RGBA;
81
+ pfd.cColorBits = 32 ;
82
+ pfd.cDepthBits = 24 ;
83
+ pfd.cStencilBits = 8 ;
84
+ pfd.iLayerType = PFD_MAIN_PLANE;
85
+ int iFormat = ChoosePixelFormat (m_hdc, &pfd);
86
+ if (!iFormat)
87
+ {
88
+ printf (" InitOpenGL error 3\n " );
89
+ MessageBoxA (NULL , " Error 3\n " , " InitOpenGL" , MB_OK);
90
+ }
91
+
92
+ if (!SetPixelFormat (m_hdc, iFormat, &pfd))
93
+ {
94
+ printf (" InitOpenGL error 4\n " );
95
+ MessageBoxA (NULL , " Error 4\n " , " InitOpenGL" , MB_OK);
96
+ }
97
+
98
+ m_hRC = wglCreateContext (m_hdc);
99
+ if (!m_hRC)
100
+ {
101
+ printf (" InitOpenGL error 5\n " );
102
+ MessageBoxA (NULL , " Error 5\n " , " InitOpenGL" , MB_OK);
103
+ }
104
+
105
+ wglMakeCurrent (m_hdc, m_hRC);
106
+ if (wglGetCurrentContext () == NULL )
107
+ {
108
+ printf (" InitOpenGL error 6\n " );
109
+ MessageBoxA (NULL , " Error 6\n " , " InitOpenGL" , MB_OK);
110
+ }
111
+
112
+ m_hSharedRC = wglCreateContext (m_hdc);
113
+ if (!m_hSharedRC) printf (" InitOpenGL shared context not created\n " );
114
+ if (!wglShareLists (m_hSharedRC, m_hRC)) printf (" wglShare Lists failed\n " );
115
+
116
+ // spoutSender = std::make_shared<SpoutSender>();
117
+ std::cout << std::endl << std::endl << " Num Adapters:\t " << spoutsender.GetNumAdapters () << std::endl;
118
+ std::cout << " Using Adapter:\t " << spoutsender.GetAdapter () << std::endl;
119
+ std::cout << " using DX9?\t " << spoutsender.GetDX9 () << std::endl << " using CPU?\t " << spoutsender.GetCPUmode () << std::endl << " GetShareMode():\t " << spoutsender.GetShareMode () << std::endl;
54
120
bSenderInitialized = spoutsender.CreateSender (senderName, tWidth, tHeight);
121
+
55
122
if (pixels2 != nullptr )
56
123
{
57
124
delete pixels2;
58
- pixels2 = (PF_Pixel8 *)malloc (tWidth* tHeight * sizeof (PF_Pixel8));
125
+ pixels2 = (PF_Pixel8*)malloc (tWidth * tHeight * sizeof (PF_Pixel8));
59
126
}
127
+
128
+ /*
129
+ bSenderInitialized = spoutsender.CreateSender(senderName, tWidth, tHeight);
130
+ if (pixels2 != nullptr)
131
+ {
132
+ delete pixels2;
133
+ pixels2 = (PF_Pixel8 *)malloc(tWidth*tHeight * sizeof(PF_Pixel8));
134
+ }*/
60
135
}
61
136
else if (shouldUpdate)
62
137
{
@@ -147,15 +222,15 @@ MyDeath(
147
222
void *hook_refconPV)
148
223
{
149
224
// free anything you allocated.
225
+ spoutsender.SpoutCleanUp (true );
150
226
}
151
227
152
228
static void
153
229
MyVersion (
154
230
void *hook_refconPV,
155
231
A_u_long *versionPV)
156
232
{
157
- spoutsender.SpoutCleanUp (true );
158
-
233
+
159
234
*versionPV = 1 ;
160
235
}
161
236
@@ -173,14 +248,14 @@ EntryPointFunc(
173
248
hooksP->version_hook_func = MyVersion;
174
249
175
250
176
- /*
177
- AllocConsole();
178
- freopen("CONIN$", "r", stdin);
179
- freopen("CONOUT$", "w", stdout);
180
- freopen("CONOUT$", "w", stderr);
181
251
182
- printf("SpoutAE EntryPoint\n");
183
- */
252
+ // AllocConsole();
253
+ // freopen("CONIN$", "r", stdin);
254
+ // freopen("CONOUT$", "w", stdout);
255
+ // freopen("CONOUT$", "w", stderr);
256
+ //
257
+ // printf("SpoutAE EntryPoint\n");
258
+
184
259
185
260
186
261
// spoutsender = GetSpout(); // Create an instance of the Spout library
0 commit comments