C++ :: Alpha Zone Just Won't Be Alpha
Jun 28, 2014
I found a targa loader that works great and implemented it in my code.
But for some reason, the alpha region of my texture , just won't be alpha when I load the Texture in my code.
If I make a texture that is a full purple colored rectangle, and carve out the central part with an alpha zone, in-game the quad is all full purple, instead of having the central part being transparent.
I tried the following code too, and it doesn't work, I don't understand
//NPC
glEnable(GL_BLEND);// Enable Blending
NPC00->Draw();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);// Set The Blending To A Nice 50/50 Mode
glDisable(GL_BLEND);// Disable Blending
Draw Function, basically draws a Quad and applies the texture to it.
I'm just trying to get textures with alpha to work, I usually work with targas, so thats why I got a targa loader.
View 1 Replies
Sep 18, 2013
I want to change the alpha of a sprite without changing any other colours
View 4 Replies
View Related
Jul 14, 2014
I want to use a new color for BaseColor in iTextSharp.
I can easily set a new color using RGB values from 0 to 255.
However, if I want to adjust the alpha value (and I know alpha ranges from 0 to 1), I can't make the alpha 0.5 because it's not an integer in the definition of BaseColor.
public BaseColor(int red, int green, int blue, int alpha);
So I can set my BaseColor like below:
static BaseColor newColor = new BaseColor(192, 192, 192);
but I can't use a non-int value for alpha. How can I easily convert double alpha values to integer values? What would be the range for alpha in int values and how do I, e.g., set the alpha value to 0.5 in int values?
EDIT: btw, I found online something like this: int alpha = (pixel >> 24). I don't understand why 24 and how can I break that into chunks I understand?
View 5 Replies
View Related
Jul 9, 2014
I made this function to check in string is alpha only or alphanumeric but always give me alfa way ?
Code:
int checkIfStringisAlfa(const char str[]){
int lenStr = getStringLength(str);
int i = 0;
int ret;
for(i = 0; i < lenStr; i++){
if(str[i] >= 'a' && str[i] <= 'z' || str[i] >= 'A' && str[i] <= 'Z'){
//printf(" alfa
[Code] .....
View 8 Replies
View Related
Nov 7, 2013
I am looking for a way to sort a string just by the alpha characters, not by the ASCII table. Therefore
string sort(string name) {
sort(name.begin(), name.end());
return name;
}
will not work. And I am looking for the most simple way to go about it!
View 7 Replies
View Related
Nov 3, 2013
How to stalk a random alpha letter in order in a minimum possible way.. and write the cases which the container can be stalked.
for example.. ACMICPC can be a store in three stalks.
ACC
M -----------> three stalks
IP
Another example... CBACBACBACBACBA can have three stalks
View 12 Replies
View Related
Jun 27, 2014
I'm trying to load a Quad with a Monster Image on it that will always face the Camera, a la Doom 2.
Now I don't know how to load an image with an Alpha part on it.
In 2D using SDL I always used tga files.
Here is my LoadTexture functions.
AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
[Code].....
View 2 Replies
View Related
Nov 20, 2012
I am unable to check if the character in the 2D array is alpha
here is my code
#include<iostream>
#include<cctype>
#include<cassert>
#include<cstring>
const int maxChar = 20 ;
using namespace std ;
int main() {
int count = 0 ;
char d[2][20] = { "hi" , "di" } ;
[code]....
View 8 Replies
View Related
Oct 10, 2012
Why the first code snippet inserts properly into a list and the second code snippet does not. The position of the bold expressions are the only differences. iter, s and LS were declared elsewhere in main().
snippet 1.)
while (true) {
cout << "Enter string (ENTER to exit): ";
getline(cin, s);
if (s.size() == 0)
[Code] .....
View 2 Replies
View Related
Apr 25, 2013
I want to create 2 functions to (1) convert a passed string into proper case (capitalize the first alpha character of a string and every alpha character that follows a non-alpha character); (2) sort the array of names (after it has been converted to proper case).
I tried these two:
console.writeline (lower.toUpper());
void bubblesort (string array[],int length);
but I don't know if they are good.
View 2 Replies
View Related
Mar 2, 2013
I want to create a GUI using C, for displaying time when a time zone is selected.
I absolutely don't know how to write a program for that. How to get the time of a zone displayed when the zone name is given as input.
View 2 Replies
View Related