[4.3]subsystem opengl
-
Anonymous
[4.3]subsystem opengl
If i use the opengl subsystem , and i call openscreen() function , the screen is an sdl screen ?
-
Anonymous
Ok , because i have bug when i use my lib ( written in c++ )
For example :
I create the screen with OpenScreen() and opengl subsystem
and after i create with my lib a simple texture
like this :
and after , in the main code i call the display func
like this :
The texture appear white !
The solution for me is the SDL api for see correctly the texture.
it's work correctly with :
I wan't to use OpenScreen() & co , not SDL api :/
For example :
I create the screen with OpenScreen() and opengl subsystem
and after i create with my lib a simple texture
like this :
Code: Select all
GLubyte Texture[16] =
{
0,0,0,0, 0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF, 0,0,0,0
};
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glGenTextures(1,&gltexture);
glBindTexture(GL_TEXTURE_2D,gltexture); //Sélectionne ce n°
glTexImage2D (
GL_TEXTURE_2D,
0, //Mipmap
GL_RGBA,
2,
2,
0, //Border
GL_RGBA, //Format : RGBA
GL_UNSIGNED_BYTE,
Texture
);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);like this :
Code: Select all
void Draw()
{
GlEnable & Glbind...
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); //Efface le framebuffer et le depthbuffer
glMatrixMode(GL_MODELVIEW); //Un petit gluLookAt()...
glLoadIdentity();
gluLookAt(3,2,3,0,0,0,0,1,0);
glBegin(GL_QUADS); //Et c'est parti pour le cube !
glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
glTexCoord2i(1,0);glVertex3i(+1,-1,-1);
glTexCoord2i(1,1);glVertex3i(+1,+1,-1);
glTexCoord2i(0,1);glVertex3i(-1,+1,-1);
//1 face
glTexCoord2i(0,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,0);glVertex3i(+1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,1);glVertex3i(-1,+1,+1);
//2 faces
glTexCoord2i(0,0);glVertex3i(+1,-1,-1);
glTexCoord2i(1,0);glVertex3i(+1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,1);glVertex3i(+1,+1,-1);
//3 faces
glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
glTexCoord2i(1,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,1);glVertex3i(-1,+1,+1);
glTexCoord2i(0,1);glVertex3i(-1,+1,-1);
//4 faces
glTexCoord2i(1,0);glVertex3i(-1,+1,-1);
glTexCoord2i(1,1);glVertex3i(+1,+1,-1);
glTexCoord2i(0,1);glVertex3i(+1,+1,+1);
glTexCoord2i(0,0);glVertex3i(-1,+1,+1);
//5 faces
glTexCoord2i(1,0);glVertex3i(-1,-1,+1);
glTexCoord2i(1,1);glVertex3i(+1,-1,+1);
glTexCoord2i(0,1);glVertex3i(+1,-1,-1);
glTexCoord2i(0,0);glVertex3i(-1,-1,-1);
//6 faces
glEnd();
} The texture appear white !
The solution for me is the SDL api for see correctly the texture.
it's work correctly with :
Code: Select all
ImportC "-lsgui"
sgui_initialize.i()
sgui_sys_ortho2dstart(gui.i)
sgui_sys_ortho2dend(gui.i)
sgui_sys_createcontext.i( x.i, y.i, width.i, height.i)
sgui_sys_renderingcontext(gui.i , context.i)
GetError_()
EndImport
OpenConsole()
InitSprite() : InitKeyboard()
; OpenScreen(800,600,32,"")
SDL_Init_(#SDL_INIT_VIDEO)
screen = SDL_SetVideoMode_(800, 600, 32, #SDL_OPENGL);
MyGui = sgui_initialize()
context = sgui_sys_createcontext(100,100,128,256)
Repeat
Error = GetError_()
If Error
Debug Error
End
EndIf
; ExamineKeyboard()
sgui_sys_ortho2dstart(MyGui)
sgui_sys_renderingcontext(MyGui,context)
sgui_sys_ortho2dend(MyGui)
SDL_GL_SwapBuffers_();
ForEverI wan't to use OpenScreen() & co , not SDL api :/
