4.30 Drawing to screen or sprite with opengl subsystem

Linux specific forum
Anonymous

4.30 Drawing to screen or sprite with opengl subsystem

Post by Anonymous »

I wan't to draw directly on screen or sprite with this :

Code: Select all

StartDrawing()
I use opengl subsystem (for sprite3D) , we can't draw directly on the screen , then i wan't do draw on standard sprite. but , i have an error message : the spécified output is null.
The sprite as been created , it's not null.
i don't understand the problem. bug ?
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Drawing on the screen/sprite is not supported with OpenGL.

http://www.purebasic.com/documentation/ ... cific.html
quidquid Latine dictum sit altum videtur
Anonymous

Post by Anonymous »

yes , i know, but i want draw on standard pixel ( not sprite3D ) is not possible because opengl subsystem is activated ?
with opengl subsystem we can't draw image on the screen ?
Anonymous

Post by Anonymous »

With OpenGL subsystem , Purebasic use SDL ?
if yes , where i can grab the pointer of SDL_Surface ?
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Post by GBeebe »

*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

Post by Philippe-felixer76-2 »

GBeebe wrote:*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels
And is it possible to change the pixels realtime? Yes? How???
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Here is the best solution ever:

http://www.purebasic.fr/english/viewtop ... 854#248854

:lol:

I could also try to make it possible to draw directly on the screen. But it would also result in a code like this.

[EDIT]
Just noticed, that this code doesn't work right anymore. But it worked in PB 4.30 beta somenumber.
bye,
Daniel
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

Post by Philippe-felixer76-2 »

DarkDragon wrote:Here is the best solution ever:

http://www.purebasic.fr/english/viewtop ... 854#248854

:lol:

I could also try to make it possible to draw directly on the screen. But it would also result in a code like this.

[EDIT]
Just noticed, that this code doesn't work right anymore. But it worked in PB 4.30 beta somenumber.
Ill check it out, tnx!
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Post by GBeebe »

How do I take that sprite after i've drawn on it and make a sprite3d out of it?
Anonymous

Post by Anonymous »

Philippe-felixer76-2 wrote:
GBeebe wrote:*pointer.sdl_surface = SpriteID(sprite) for sprites
*pointer.sdl_surface = ScreenID() for screen

all the pixel data is then in *pointer\pixels
And is it possible to change the pixels realtime? Yes? How???

Try this :

Code: Select all

InitSprite()

OpenWindow(0,0,0,800,600,"")
	OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)

CreateSprite(0,256,256)
	
	
	Repeat
		Event = WindowEvent()
			ClearScreen($FF00FF)
	

	*pointer.sdl_surface = SpriteID(0)
	
	For x = 0 To 256-1
		For y = 0 To 256-1
		
		; Operation for GET or PUT any data in memory :
		; Memory + ( x * DataOffset ) + MemoryWidth * ( y* DataOffset )    
		; if is Memory structured :
		; (Memory + ( x * DataOffset ) + MemoryWidth * ( y* DataOffset )  ) + OffsetOf( Structure\Data )
		
	    PokeL(*pointer\Pixels + (x*4) + 256 * (y*4),RGB(x*255/64,x*255/64,y*255/64))
		Next 
	Next 
	
	
	DisplaySprite(0,100,100)
	
	 		FlipBuffers()
	Until Event = #PB_Event_CloseWindow
Post Reply