w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Web apps: Separate SQL completely from the code
You should have a look at the MVC (Model View Controller) architectural pattern. It will allow you to achieve your goal: Separation of data, logic and presentation. In MVC, your models will handle all SQL related logic, so that the other two layers will never have to deal with queries. Have a look at PHP Frameworks which implement the MVC pattern, they will greatly simplify applying this pattern to your project. My personal favourite is Laravel 4, but there are lots of others, such as FuelPHP, CodeIgniter, CakePHP et al. Most of these frameworks also have caching mechanisms as a bonus and they are able to utilize other means of speeding up your web application: Redis and Memcache, for example.

Categories : PHP

Draw shiny lights in OpenGL to simulate a old monitor scanline
I should point out that not all terminals had shadow mask CRTs (which was responsible for the bulge). Higher end terminals had (relatively) flat aperture grille CRTs. On the other extreme, really cheap terminals had somewhat annoying scrolling horizontal bars. My fondest memories are programming on a SONY Trinitron terminal, which didn't have issues with brightness on horizontal scan lines, but did have a very pronounced vertical pitch between pixels. Here's what things looked like on aperture grille CRTs: I haven't seen any CRT emulating shaders that ever replicate this though. To me, there's more than one way to skin a CRT... you might want to emulate a dot matrix grid, darken alternate fields, have a horizontal line that slowly scrolls up/down the screen, apply a pincushion d

Categories : Opengl

how to make popup in center of screen and overlay/background to full screen high
Place the Popup Window inside the overlay-div! <body id="page1" style="height: 100%;"> <form id="form2" runat="server" style="min-height: 100%;"> <div id="content"> .. content ... </div> </div> <div class="darkenBg" id="popupBackground" style="display:none;"> <div class="greenBox2 popUpWin" id="companySigninPopup" style="display:none;"> <div class="topWrap"> popup window </div> <div class="botWrap"> <div class="corner-bottom-left">&nbsp;</div> <div class="border-bottom">&nbsp;</div> <div class="corner-bottom-right">&nbsp;</div> </div> </div> </div> </fo

Categories : Javascript

How to create videoview like youtube "small screen and full screen play in android "
You have to override setAnchorView in your new java class which extend the Android's MediaController (android.widget.MediaController) and add an extra view/button to the controller. And do something like this @Override public void setAnchorView(View view) { super.setAnchorView(view); Button fullScreen = new Button(context); fullScreen.setText("FullScreen"); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.gravity = Gravity.RIGHT|Gravity.TOP; addView(fullScreen, params); } now add clicklister to view

Categories : Android

Everything moves in website when changed from full screen mode on desktop screen
Something to this effect? The biggest issue was that you didn't have a minimum width for your menu, so it would keep shrinking until it stacked on itself. #navigation { float:left; width:60%; height:24px; min-width:1000px; text-align:center; padding:10px 20px; }

Categories : HTML

I have a background set to the bottom of the screen, but when I go to full screen there is an empty white space beneath. Why is this happening?
First, fix the errors in your HTML. They look terrible. Then, you calculate the height as screen.availHeight. That's a mistake, availHeight is the height of the desktop. Excluding things like taskbars and whatever you may have on your computer. What you need is screen.height.

Categories : HTML

Event for exiting the screen monitor (with WPF)
You could handle the Window's MouseMove event and check the mouse's position. private void Window_MouseMove(object sender, MouseEventArgs e) { //PrimaryScreenWidth - 1 to account for the cursor itself if (e.GetPosition(this).X >= SystemParameters.PrimaryScreenWidth - 1 || e.GetPosition(this).X <= 1) MessageBox.Show("Edge hit"); } If you're running multiple monitors, you could also handle the MouseLeave event to handle the case where the mouse has moved to the second monitor. private void Window_MouseLeave(object sender, MouseEventArgs e) { MessageBox.Show("Edge hit"); }

Categories : C#

QT getting the screen resolution without the extended monitor
You pretty much had it, just give the screen ID of your main monitor to the geometry() call. QDesktopWidget widget; QRect mainScreenSize = widget.availableGeometry(widget.primaryScreen()); // or screenGeometry(), depending on your needs

Categories : Qt

Show white screen until layout is completely constructed
Use an asynctask like this: private class LoadingMyView extends AsyncTask<void, void, int> { protected void onPreExecute () { requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.main); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title); //show whiteView } protected int doInBackground() { return 0; } protected void onPostExecute(int result) { //Hide white View } } Note: I didnt test the code but i think more or less is ok AsyncTask

Categories : Android

Screen resolution. Full screen - perfect. Normal screen - not perfect
Can't see the rest of the code but if you want the background to be centered don't you want it to set it up as: body{ background-position: center; } The way it is now, the background is properly centered for only one resolution, because it is aligned to the left.

Categories : CSS

Blitting with SDL in an OpenGL context
Welp, I didn't need to do any of that. As datenwolf pointed out, power of two dimensioned images aren't necessary. If I need to do anything like bliting one surface onto another, I'll do it with a Frame Buffer Object and textures instead.

Categories : C++

Get OpenGL (WGL) context from QOpenGLContext
There's not exactly a public API for this, as far as I know. Note that Qt 5 removed most of the native handles from the APIs. This should do the trick: QPlatformNativeInterface *iface = QGuiApplication::platformNativeInterface(); HGLRC ctx = (HGLRC)iface->nativeResourceForContext("renderingContext", context); (not sure about the last cast, but that looks correct according to the relevant source).

Categories : Opengl

No OpenGL context when using SDL2 on Mac OS X 10.8.4
I found the problem. Apparently, the code will still compile if you're missing "-framework OpenGL" I solved this by examining the test programs that came with SDL2 and found that they did indeed work and that I was missing the framework OpenGL. I hope this helps someone else. Thank you Andon. I changed this: __top_builddir__bin_test_sdl_SOURCES = test-sdl.c __top_builddir__bin_test_sdl_LDFLAGS = -lGL -lSDL2 $(top_builddir)/lib/.libs/libsimplegl.a To this: __top_builddir__bin_test_sdl_SOURCES = test-sdl.c __top_builddir__bin_test_sdl_LDFLAGS = -lGL -lSDL2 -framework OpenGL $(top_builddir)/lib/.libs/libsimplegl.a

Categories : C

SDL 2.0 - OpenGL ES context problems
The fine folks at forums.libsdl.org gave me the answer. A call to both SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); is necessary.

Categories : IOS

How to separate OpenGL drawing into classes
Usual way is as follows: TriangleArray tri; tri.push_back(...); tri.prepare(); while(1) { clear(); tri.draw(); swapbuffers(); } But usually the same class should handle array of objects, not just one object. So TriangleArray is good class name. prepare() is for setting up textures or vertex arrays. (Note: if your world is built from cubes, you'll create CubeArray instead.)

Categories : C++

Qt doesn't create OpenGL context
I don't know wich platform are you on,but I had the same problems building a simple app with a QGLWidget (nothing happens) and I've written a small guide that hope it helps you. So whats I'm proposing you is a brand new installation.I never used glew so mine would be the solution without it. If what you need is fix your current setup,don't read what is next. Easy way: 1: Install qt-windows-opensource-5.0.2-msvc2010_32_opengl-x86-offline 2: Install Visual Studio Express from Microsoft (free,we need its compiler) 3: Be sure that you have glu32.dll,glut32.dll,opengl32.dll in windows/system32 and windows/sysWOW64 4: set in Qt the msvc x86 compiler Hard Way: If you are using VS2012 compiler and you want to use it here is the way (you have to recompile QT): 1: Install qt-windows-ope

Categories : Qt

What OpenGL state needs to be reset upon a new shared context?
create a new window and use the same context Not quite. GLFW will create a new context that shares some of the other contexts' objects. Namely ever object that holds some data (textures, buffer objects, shaders and programs, etc) will be shared, i.e. accessible from both contexts. Container objects, which reference other objects, are not shared (framebuffer objects, vertex array objects). however as I understand it you still need to reset the OpenGL states Technically the newly created contexts start in a reset default state, with some objects already preallocated and initialized. However like any state machine you should never assume OpenGL to be in a certain state when you're about to use it. Always make sure you set all the required state right before you need it when you ne

Categories : C++

Make current OpenGL context on Linux
That 'GLXDrawable' is the X11 window for which you have got the context. If you are using qt, I would have assumed it would have provided a 'myWindow.makeCurrent()' function, or something to the effect. You can make a window using XCreateWindow (there is also a function for making a basic window with less options). Before this, you will need to have got a connection to the display using XOpenDisplay. I have been very short on the details here, as there is a lot steps for getting an OpenGL Context in an X11 window, and whilst not hard, does involve a lot of error checking. I suggest you make use of a library that handles this for you.

Categories : Linux

How to use Linderdaum Engine with the existing OpenGL context?
You can use DeployEnvironment instead of DeployDefaultEnvironment DeployEnvironment requires a handle to the current window, and one of the examples shows how this can be achieved using GLUT on windows. You can get the current window handle on SDL using the following code SDL_SysWMinfo SysInfo; //Will hold our Window information SDL_VERSION(&SysInfo.version); //Set SDL version if(SDL_GetWMInfo(&SysInfo) <= 0) { printf("%s : %d ", SDL_GetError(), SysInfo.window); return; //or throw exception or whatever } #ifdef __WIN32__ HWND WindowHandle = SysInfo.window; //Win32 window handle #else Window WindowHandle = SysInfo.window; //X11 window handle #endif Finally the definition of DeployEnvironment looks something like this: DeployEnvironment (const std::vector&l

Categories : Opengl

Android: check if opengl context has been lost
I don't quite get how you are loading your textures. OnResume should be a good place to do so if you disposed them in onPause... just to free some memory when user leaves activity. Anyway, I stick to your question. In a simple case, you should initialize your textures inside onSurfaceCreated. Also, don't do things like this: if(texture != null) texture = initializeTexture(); because that doesn't mean it's loaded into the opengl memory, that's just a reference to a java object which many times lives longer than the opengl context (specially if it's static) Some offical doc: http://developer.android.com/reference/android/opengl/GLSurfaceView.Renderer.html EGL Context Lost There are situations where the EGL rendering context will be lost. This typically happens when device

Categories : Android

Opengl and opencl can use only 1 kernel in a single shared context
What error message to you get when it doesn't work? There isn't a rule requiring that each kernel must be in a separate context. You should be able to have multiple kernels in a single cl_program and multiple programs in a context. What hardware are you using e.g. Nvidia or AMD GPUs?

Categories : C#

Enable Migrations with Context in Separate Assembly?
This will only work in EF 6, but there was a release that added the -ContextProjectName parameter to the -enable-migrations command. By using this command you could do the following: enable-migrations -ContextProjectName MyProject.MVC -StartUpProjectName MyProject.MVC -ContextTypeName MyProject.MVC.MyContextFolder.MyContextName -ProjectName MyProject This will add migrations to your MyProject project using the context in the MyProject.MVC. You need to make sure that the project with the Migrations has a reference to the project with your Context, i.e., MyProject references MyProject.MVC

Categories : C#

Using SDL2 and xcode 4.6. I manage to create a OpenGL 3.2 core context. BUT can not use glsl 1.50
You are using fread() incorrectly. Instead of fread(buf, length, 1, fptr); it should be fread(buf, 1, length, fptr); This might not be the problem, as far as i can see the your read function is void of any errors, but it is still preferable to use library functions as they were intended. I'm not sure for the second part of your code though. Posting a more descriptive error message would help.

Categories : Osx

how to set up CAEAGLLayer subclass with openGL context: Current draw framebuffer is invalid
As far as I know you have to overwrite the layerClass method in the View, like this + (Class)layerClass { return [MYCEAGLLayer class]; } Also you have to set the drawableProperties on the MYCEAGLLayer.

Categories : IOS

OpenGL screen layout
You need to use functions glViewport and glOrtho with correct values. Basically glViewport sets the part of your window capable of rendering 3D-Graphics using OpenGL. glOrtho establishes coordinate system within that part of a window using OpenGL's coordinates. So for your task you need to know exact width and height of your window. If you are saying they are 480 and 320 respectively then you need to call glViewport(0, 0, 480, 320) // or: glViewport ( 0,0,w,h) somewhere, maybe in your SizeChanging-handler(if you are using WINAPI it is WM_SIZE message) Next, when establishing OpenGL's scene you need to specify OpenGL's coordinates. For orthographic projection they will be the same as dimensions of a window so glOrtho(-240, 240, -160, 160, -100, 100) // or: glOrtho ( -w/2, w/2, -h/2, h/

Categories : C++

OpenGL, C++ -> How do you lay out objects on screen?
OpenGL has the concept of a Viewport. This is the box in screen/window co-ordinates that you are going to be drawing into. Once you set the viewport, you are now using what is sometimes termed Camera coordinates. Camera coordinates go from -1.0 on the extreme left of the viewport to 1.0 on the extremeright. Similarly for Y coordinates -1.0 on the extreme bottom and 1.0 on the extreme top. Anything that lies outside the viewport is not draw. Your models can exist in any coordinate system you like. You then transform your objects into camera coordinates using transformation matrices.

Categories : C++

OpenGL + SDL2 Black Screen
The order of those is wrong: SDL_GLContext context; context = SDL_GL_CreateContext(win); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); The OpenGL context attributes must be set before creating the context (they are state variables, that control the context creation process). This makes no sense: First you clear, then you swap, then you draw (into a then undefined back buffer, since the content of the back buffer is undefined after a swap) and then you don't swap. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); SDL_GL_SwapWindow(win); glColor3f(1.0f, 1.0f, 1.0f); /* this translate will move the triangle out * of the NDC space i.e. it gets clipped or * won't be visible at all. */ glTranslatef(-1.5f, 0.0f, -6.0f);

Categories : C++

OS X OpenGL 3.2 Core (Black Screen)
You don't have layout in #version 150 so you have to use glGetAttribLocation() to ask OpenGL where it put your attributes and adjust the first parameter of your glVertexAttribPointer() calls appropriately. Make sure you bind your program before calling glGetAttribLocation().

Categories : C++

Adding Text to Screen with OpenGL
I want to add texts(degrees) to compass and want to do that with pure OpenGl methods. Unless you can live with not very pleasantly looking center stroke fonts, you have no choice but to use help from some other library or API. Theoretically OpenGL can collaborate with OpenVG, but so far overall support for OpenVG is very poor, and OpenGL interoperability even worse. But say you had a proper working OpenVG – OpenGL interoperability working, then OpenVG was the way to go. Practically you have to something different. A very fruitful approach is to use a font renderer library (like FreeType) together with some layout engine (like Pango) to produce an outline stroke list of the text to be rendered, which in turn can be either rendered directly using some extension by NVidia (http://www

Categories : Java

OpenGL ES Green Screen... But I want to use black
You can calculate how close value to black, simplest way is to take maximum of the r g and b values, then set some threshold when you consider color opaque, and map your alpha values to [0..1] in pseudo code: float brightness = max(textureColor.r, textureColor.g, textureColor.b); float threshold = 0.1; float alpha = brightness > threshold ? 1 : (threshold - brightness) / threshold; gl_FragColor = vec4(textureColor.rgb, alpha);

Categories : IOS

OpenGL ES 2D on Samsung 4 - no textures on the screen
One issue is that you have enabled alpha blending, but you can't use GLUtils.texImage2D() to load alpha textures on Android. This is a common problem that Google really should document better. The problem is that the Bitmap class converts all images into pre-multiplied format, but that does not work with OpenGL ES unless the image is completely opaque. The best solution is to use native code. This article gives more detail on this: http://software.intel.com/en-us/articles/porting-opengl-games-to-android-on-intel-atom-processors-part-1

Categories : Android

Screen corruption when using Opengl Buffers
SFML but it can only saves/restores OpenGL 2.x states. We must disable what we enable in +3.x states. It works adding: It's fixed adding at the end of own drawing something like: glBindBuffer( GL_ARRAY_BUFFER, 0 ); glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, 0 ); glBindTexture( GL_TEXTURE_2D, 0 ); glDisableVertexAttribArray( 0 ); glUseProgram( 0 );

Categories : C++

Blank Screen in OpenGL and Glut
i agree with pwny. too much untested code. Usual causes: bad camera/object position wrong frustrum/perspective (bad znear or zfar) enabled textures without using them improper lighting/material parameters forgotten to set glColor to check for what is wrong disable CULL_FACE,DEPTH_TEST,GL_TEXTURE_1D,2D,...lighting,material,blend set camera and modelview to defined state (unit matrix for example) try to render quad without CULL_FACE at the right position and size to be visible after success set projection matrix to perspective tweak znear,zfar and quad position to match your scene replace quad with your cube after success re-enable all what you need incrementally P.S. also good idea is to check for glerrors (may be wrong something entirely else)

Categories : C++

div to appear in full screen
Use the full-screen pseudo class (for webkit and mozila) : :-webkit-full-screen { /* css rules for full screen */ } :-moz-full-screen { /* css rules for full screen */ } See this Mozilla article and this David Walsh article for usage

Categories : HTML

Flashing black screen in Android under OpenGL ES
You should not need to modify GLSurfaceView. It's much more likely that your problem is caused by the drivers or configuration of your system. I would try a different test device with different graphics drivers. What happens when you run it on an AVD? It could be that your test device is not making enough memory available to the underlying linux framebuffer device to get the normal triple buffering. Most systems will fall back to single buffering in that case. I recommend that you check these fb device parameters. The virtual_size should be large enough for 2 or 3 buffers for the display mode you are using: cat /sys/class/graphics/fb0/mode U:1024x768p-60 cat /sys/class/graphics/fb0/virtual_size 800,1440

Categories : Android

OpenGL-ES iOS DrawText on screen drops FPS dramastically
Allocating 1000 textures takes up a huge amount of memory and will slow down your app, especially if they are at a high enough resolution for readable text. You should generate these textures as they are needed and free them once they are no longer being displayed. Make sure that you aren't generating and freeing textures each frame, but only as needed. If you are drawing all 1000 strings in the same scene, you should combine as many as you can into like textures. This will allow you to leverage Cocos2D's TrueType rendering system to keep text high-quality. On the other hand if this is not an option and all 1000 strings need to be distinct from each other, consider building a font rendering system that renders each character as a glyph image. This will reduce the number of textures used f

Categories : IOS

OpenGL perspective projection to map the screen pixels
I am trying to set up perspective projection in OpenGL such that it maps exactly to the screen pixels By its very nature this kind of mapping will hold for only one certain depth. For all others it simply can't map view X,Y to viewport X,Y I want to set up perspective projection because I want to provide an ability to rotate the sprites along x and y axes too. Nothing stops you from doing that with an ortho projection.

Categories : C++

OpenGL Additive blending causes white screen
Well I fixed it, and I feel like an idiot now :) My opengl was set to glClearColor(1.0, 1.0, 1.0, 1.0); which (obviously) is pure white. I just changed it to black background glClearColor(0.0, 0.0, 0.0, 1.0); And now I see everything fine. I guess it was additively blending with the white background, which obviously would be white.

Categories : C++

Full Screen bug with my C# application
In both cases you are calling WindowState = FormWindowState.Maximized; and that is why your window always goes to full screen. In your second code block, you should remove that call and just leave it to WindowState = FormWindowState.Normal;

Categories : C#

How to disable "You have gone full screen" box?
After some further research I found the Chrome has the kiosk mode. It can be enabled with command line flag: google-chrome --kiosk www.web.page.com In kiosk mode the F11 box doesn't show up.

Categories : Google Chrome



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.