SFML community forums
Help => Graphics => Topic started by: troopson on February 01, 2010, 05:12:05 pm
-
Hi, im using SFML+OGL and i use SFML only for Window and Input stuff.
Ive got a problem
here is my initgl function
int CGra::InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping ( NEW )
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f);
return TRUE; // Initialization Went OK
}
here is my drawing function
int CGra::DrawGLScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(-1.5f,0.0f,-6.0f);
glColor3f(1.0f,0.0f,0.0f);
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glEnd();
glPopMatrix();
glFlush();
return TRUE;
}
ive got NO more functions that use GL(only bitmaps loading using SOIL lbirary)..
The triangle is not being drawn ;( If i draw sprites using OGL functions its okay, but simple primitives doesnt work :( why?
i use PreverveOpenGlStates
-
Why do you use a sf::RenderWindow if you only use SFML for windo and input? Use a sf::Window instead.
-
is it rly so important? Renderwindow is useful for displaying Text,screencapture etc..... ??
btw i Found the Error - gluPerspective was uncorrect ..
-
is it rly so important?
sf::Window doesn't mess up your OpenGL states, which can help for debugging :)
-
So is there any way to draw Text using SFML in sf::Window? :D
-
No, but you solved your problem so you don't need to do that :P