@@ -18,9 +18,6 @@ ZBuffer *globalFramebuffer = NULL;
1818ucncAssembly * globalScene = NULL ;
1919ucncCamera * globalCamera = NULL ;
2020
21- int framebufferWidth = (int )globalFramebuffer -> xsize ;
22- int framebufferHeight = (int )globalFramebuffer -> ysize ;
23-
2421ucncLight * * globalLights = NULL ;
2522int globalLightCount = 0 ;
2623
@@ -104,14 +101,24 @@ void ucncSetAllAssembliesToHome(ucncAssembly *assembly) {
104101 }
105102}
106103
107- // Set the dimensions of the TinyGL Z-buffer
108- void ucncSetZBufferDimensions (int width , int height ) {
104+ // Set the dimensions of the TinyGL Z-buffer and return width/height
105+ void ucncSetZBufferDimensions (int width , int height , int * outFramebufferWidth , int * outFramebufferHeight ) {
106+
109107 if (globalFramebuffer ) {
110108 ZB_close (globalFramebuffer );
111109 }
112110 globalFramebuffer = ZB_open (width , height , ZB_MODE_RGBA , 0 );
113111 if (!globalFramebuffer ) {
114112 fprintf (stderr , "Failed to initialize Z-buffer with dimensions %d x %d.\n" , width , height );
113+ return ;
114+ }
115+
116+ // Set the output width and height using the provided pointers
117+ if (outFramebufferWidth ) {
118+ * outFramebufferWidth = globalFramebuffer -> xsize ;
119+ }
120+ if (outFramebufferHeight ) {
121+ * outFramebufferHeight = globalFramebuffer -> ysize ;
115122 }
116123}
117124
0 commit comments