• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED application_surface is drawing the texture page instead of the surface

hdarren

Member
I have a strange problem where I'm trying to draw the application_surface (for use in shaders) but for some reason the surface seems to have a whole bunch of sprites laid out instead. It looks like it's drawing the texture page instead of what the normal screen should be showing which shows fine. Does anybody know what the problem is? These are the things I've tried.

- Cleaning the Cache (by clicking the little broom icon).
- Creating a new Texture Group and move all sprites to it.
- Renaming the entire game project.
- Ran my other games which look fine.
 
Last edited:

FoxyOfJungle

Kazan Games
What function are you using to draw the surface? draw_surface_part()?
What event are you using for this? I suggest not copying the surface, but drawing it directly, "taking" the original application_surface, example:
draw_surface_part(application_surface....)
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Show us what you are doing. A newly created surface will contain any "garbage" that was in the memory location used to store it (ie: creating a surface just reserves memory space but does not clear it), and so this sounds like the situation you have here. But without seeing the code we can't say for sure.
 

hdarren

Member
Yes I am drawing the application_surface directly in the Draw event of a persistent object using this code "draw_surface_stretched_ext(application_surface,xx,yy,ww,hh,-1,1);" I have done this approach for my other games and they work fine.
 

GMWolf

aka fel666
Yes I am drawing the application_surface directly in the Draw event of a persistent object using this code "draw_surface_stretched_ext(application_surface,xx,yy,ww,hh,-1,1);" I have done this approach for my other games and they work fine.
What are you drawing to?
You can't draw from a surface to the same surface.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You can't draw from a surface to the same surface.
This! You can only really use the app surface if you are drawing it in the pre or post draw events, or in the Draw GUI event. Anything else just won't (or shouldn't) work.
 

hdarren

Member
Thank you!

Yes I was an idiot drawing it in the Draw event when it should have been in the Post-Draw event.

It's working now!
 

GMWolf

aka fel666
This! You can only really use the app surface if you are drawing it in the pre or post draw events, or in the Draw GUI event. Anything else just won't (or shouldn't) work.
Or if you have another surface target set, right?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Or if you have another surface target set, right?
Yup, you should be able to draw the app surface to another surface in any event, although, since it gets updated during the draw event, it's possible that the image captured is one step behind if you do it in that event. Not sure about that though, and it's not something I've ever noticed as an issue. :)
 
D

Deleted member 16767

Guest
Yup, you should be able to draw the app surface to another surface in any event, although, since it gets updated during the draw event, it's possible that the image captured is one step behind if you do it in that event. Not sure about that though, and it's not something I've ever noticed as an issue. :)
My drawing app needs to start from one layer above the first surface layer. So global.surf++ or global.surf-- with the arrow keys needs to have a stop sign above that layer. Or it will display the texture page. So yeah, you can in some odd ways bypass it. Not a big deal, just saying.
 
Top