Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: sfml/ogl alpha doesnt work  (Read 3697 times)

0 Members and 1 Guest are viewing this topic.

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sfml/ogl alpha doesnt work
« on: June 21, 2010, 06:41:47 pm »
wtf.. im using SFML only for window and input things.. i render only using opengl

i initialise gl like this:
Code: [Select]



// glDepthMask(GL_TRUE);
// 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);

// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0f,1.0f,1.0f,0.0f);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix


drawing like this
Code: [Select]


glColor3f(1.0f,1.0f,1.0f);
glEnable(GL_TEXTURE_2D);
//glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();

glColor4f(1.0f,1.0f,1.0f,0.3f);
glBindTexture(GL_TEXTURE_2D, (*texture)[(int)action]);
glBegin(GL_QUADS);
for (int i=0;i<4;++i)
{
glTexCoord2f(Tex(i).x, Tex(i).y) ;
glVertex2f(Xyz(i).x, Xyz(i).y);
}
glEnd();

glDisable(GL_TEXTURE_2D);
glFlush();

trying to use glEnable(GL_BLEND) anywhere here .. but then nothing after  glColor4f(1.0f,1.0f,1.0f,0.3f) shows up

edit:oh and the window im using is sf::Window

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml/ogl alpha doesnt work
« Reply #1 on: June 21, 2010, 07:49:32 pm »
Hi

Can you show a complete code? Do you call window.Display() at the end?
Laurent Gomila - SFML developer

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sfml/ogl alpha doesnt work
« Reply #2 on: June 21, 2010, 08:03:06 pm »
its a big project.
yes i call.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml/ogl alpha doesnt work
« Reply #3 on: June 21, 2010, 08:17:26 pm »
Quote
its a big project.

So you should extract a complete and minimal example, so that you (and I) can focus on the few relevant percents of the code to find the error.
Laurent Gomila - SFML developer

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sfml/ogl alpha doesnt work
« Reply #4 on: June 21, 2010, 09:16:48 pm »
thought its complete and minimal.

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
sfml/ogl alpha doesnt work
« Reply #5 on: June 21, 2010, 10:07:41 pm »
Look up at my signature ;)
Mindiell
----

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml/ogl alpha doesnt work
« Reply #6 on: June 21, 2010, 11:08:27 pm »
"Complete" means that I don't need to add anything to compile it.
"Minimal" means that it contains nothing that has nothing to do with the error.

So obviously it is not complete and minimal ;)
Laurent Gomila - SFML developer

troopson

  • Newbie
  • *
  • Posts: 30
    • View Profile
sfml/ogl alpha doesnt work
« Reply #7 on: June 21, 2010, 11:22:32 pm »
its impossible, thought u would've helped me just looking at this code,nvm.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sfml/ogl alpha doesnt work
« Reply #8 on: June 22, 2010, 08:15:51 am »
You seem to think that the error is included in the few lines of code that you showed us. If so, you should be able to wrap them into a very small program (add a main(), a sf::Window and a render loop) and test it alone.

If not, which is my opinion, how do you expect us to help you? Your OpenGL code is rather common and I don't see anything wrong in it. We need to see more code, but it will be hard to figure out with real code from your big project (because it will probably depend on other code etc.), that's why I was talking about writing a minimal and complete application. This is a very powerful way to find the source of an error.
Laurent Gomila - SFML developer